Skip to content

Commit

Permalink
[IMP] add obliged subject checkbox on partner
Browse files Browse the repository at this point in the history
  • Loading branch information
primes2h committed Jan 20, 2020
1 parent 0075ae5 commit 6bf4455
Show file tree
Hide file tree
Showing 4 changed files with 41 additions and 19 deletions.
4 changes: 2 additions & 2 deletions l10n_it_fatturapa/__manifest__.py
@@ -1,11 +1,11 @@
# Copyright 2014 Davide Corio <davide.corio@abstract.it>
# Copyright 2015-2016 Lorenzo Battistini - Agile Business Group
# Copyright 2018 Sergio Zanchetta (Associazione PNLUG - Gruppo Odoo)
# Copyright 2018-2019 Sergio Zanchetta (Associazione PNLUG - Gruppo Odoo)
# Copyright 2019 Gianluigi Tiesi - Netfarm S.r.l.
# License LGPL-3.0 or later (http://www.gnu.org/licenses/lgpl).

{
'name': 'Italian Localization - Fattura elettronica - Base',
'name': 'ITA - Fattura elettronica - Base',
'version': '12.0.1.9.0',
'category': 'Localization/Italy',
'summary': 'Fatture elettroniche',
Expand Down
19 changes: 19 additions & 0 deletions l10n_it_fatturapa/models/partner.py
@@ -1,4 +1,5 @@
# Copyright 2014 Davide Corio <davide.corio@abstract.it>
# Copyright 2019 Sergio Zanchetta <https://github.com/primes2h>
# License LGPL-3.0 or later (http://www.gnu.org/licenses/lgpl).

from odoo import fields, models, api, _
Expand Down Expand Up @@ -45,6 +46,8 @@ class ResPartner(models.Model):
)
electronic_invoice_subjected = fields.Boolean(
"Enable electronic invoicing")
electronic_invoice_obliged_subject = fields.Boolean(
"Obliged Subject")
electronic_invoice_data_complete = fields.Boolean(
compute="_compute_electronic_invoice_data_complete")

Expand Down Expand Up @@ -149,3 +152,19 @@ def onchange_country_id_e_inv(self):
self.codice_destinatario = STANDARD_ADDRESSEE_CODE
else:
self.codice_destinatario = 'XXXXXXX'

@api.onchange('electronic_invoice_subjected')
def onchange_electronic_invoice_subjected(self):
if not self.electronic_invoice_subjected:
self.electronic_invoice_obliged_subject = False
else:
if self.supplier:
self.onchange_country_id_e_inv()
self.electronic_invoice_obliged_subject = True

@api.onchange('electronic_invoice_obliged_subject')
def onchange_e_inv_obliged_subject(self):
if not self.electronic_invoice_obliged_subject:
self.onchange_country_id_e_inv()
self.pec_destinatario = ''
self.eori_code = ''
26 changes: 14 additions & 12 deletions l10n_it_fatturapa/readme/CONFIGURE.rst
@@ -1,17 +1,19 @@
**Italiano**

* Nella scheda "Fattura elettronica" del partner, selezionare "Soggetto a fattura elettronica" per i clienti e i fornitori soggetti alla fatturazione elettronica.
* Le pubbliche amministrazioni devono avere un codice IPA
* Gli altri devono avere il codice destinatario o la PEC
* Configurare le imposte riguardo a "Natura non imponibile", "Riferimento normativo" ed "Esigibilità IVA"
* Configurare i dati della fattura elettronica nella configurazione della contabilità, dove necessario
* Opzionalmente configurare lo stile dell'anteprima della fattura elettronica, selezionando "Stile del formato di anteprima" in "Configurazione Contabilità"
* Nella scheda "Fattura elettronica" del partner, selezionare "Abilitare fatturazione elettronica" per attivare la funzionalità di generazione delle e-fatture.
* Per i clienti e i fornitori che sono soggetti obbligati all'emissione della fattura elettronica va abilitata la casella "Soggetto obbligato".
* Le pubbliche amministrazioni devono avere un codice IPA.
* Gli altri devono avere il codice destinatario o la PEC.
* Configurare le imposte riguardo a "Natura non imponibile", "Riferimento normativo" ed "Esigibilità IVA".
* Configurare i dati della fattura elettronica in *Fatturazione/Contabilità → Configurazione → Impostazioni → Fatture elettroniche*, dove necessario.
* Opzionalmente, configurare lo stile dell'anteprima della fattura elettronica selezionando lo "Stile formato di anteprima".

**English**

* In partner form, select 'Subjected to electronic invoice' in 'Electronic Invoice' tab for customers and suppliers subjected to electronic invoicing
* Public administrations must have IPA code
* Others must have Addressee Code or PEC
* Configure taxes about 'Non taxable nature', 'Law reference' and 'VAT payability'
* Configure Electronic Invoice data in Accounting Configuration, where needed
* Optionally configure the Electronic Invoice preview format style by selecting 'Preview Format Style' in 'Accounting Configuration'
* In partner form, select 'Enable Electronic Invoicing' in 'Electronic Invoice' tab to activate e-invoices generation feature.
* Enable "Obliged Subject" for customers and suppliers subject to the obligation to issue electronic invoices.
* Public administrations must have IPA code.
* Others must have Addressee Code or PEC.
* Configure taxes about 'Non taxable nature', 'Law reference' and 'VAT payability'.
* Configure Electronic Invoice data in *Invoicing/Accounting → Configuration → Settings → Electronic Invoices*, where needed.
* Optionally configure the Electronic Invoice preview format style by selecting 'Preview Format Style'.
11 changes: 6 additions & 5 deletions l10n_it_fatturapa/views/partner_view.xml
Expand Up @@ -11,17 +11,18 @@
<group name="fatturapa_group">
<label for="electronic_invoice_no_contact_update" attrs="{'invisible': [('supplier', '=', False)]}"/>
<field name="electronic_invoice_no_contact_update" attrs="{'invisible': [('supplier', '=', False)]}"/>
<label for="electronic_invoice_subjected"/>
<field name="electronic_invoice_subjected"/>

<group attrs="{'invisible': [('electronic_invoice_subjected', '=', False)]}">
<group>
<field name="electronic_invoice_subjected"/>
<field name="electronic_invoice_obliged_subject" attrs="{'invisible': [('electronic_invoice_subjected', '=', False)]}"/>
</group>
<group attrs="{'invisible': ['|',('electronic_invoice_subjected', '=', False), ('electronic_invoice_obliged_subject', '=', False)]}">
<field name="ipa_code" placeholder="IPA123" attrs="{'invisible': [('is_pa','=', False)]}"/>
<field name="codice_destinatario" attrs="{'invisible': [('is_pa', '=', True)]}"/>
<field name="pec_destinatario"
attrs="{'invisible': ['|',('is_pa', '=', True), ('codice_destinatario', '!=', '0000000')]}"/>
<field name="eori_code"/>
</group>
</group>
</group>
</page>
</notebook>
</field>
Expand Down

0 comments on commit 6bf4455

Please sign in to comment.