Skip to content

Commit

Permalink
Merge PR OCA#2563 into 14.0
Browse files Browse the repository at this point in the history
Signed-off-by tafaRU
  • Loading branch information
OCA-git-bot committed Apr 15, 2022
2 parents fd320c8 + e1875f3 commit 32300e3
Show file tree
Hide file tree
Showing 34 changed files with 485 additions and 219 deletions.
3 changes: 3 additions & 0 deletions account_vat_period_end_statement/tests/test_vat_statement.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,12 @@

from dateutil.rrule import MONTHLY

from odoo.tests import tagged

from odoo.addons.account.tests.common import AccountTestInvoicingCommon


@tagged("post_install", "-at_install")
class TestTax(AccountTestInvoicingCommon):
@classmethod
def setUpClass(cls, chart_template_ref=None):
Expand Down
2 changes: 2 additions & 0 deletions l10n_it_account/tests/test_l10n_it_account.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,13 @@

from odoo import fields
from odoo.exceptions import ValidationError
from odoo.tests import tagged
from odoo.tests.common import Form

from odoo.addons.account.tests.common import AccountTestInvoicingCommon


@tagged("post_install", "-at_install")
class TestAccount(AccountTestInvoicingCommon):
@classmethod
def setUpClass(cls, chart_template_ref=None):
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,14 @@

from odoo import fields
from odoo.exceptions import UserError, ValidationError
from odoo.tests import tagged
from odoo.tests.common import Form
from odoo.tools import DEFAULT_SERVER_DATE_FORMAT

from odoo.addons.account.tests.common import AccountTestInvoicingCommon


@tagged("post_install", "-at_install")
class TestDeclarationOfIntent(AccountTestInvoicingCommon):
@classmethod
def _create_declaration(cls, partner, type_d):
Expand Down
47 changes: 40 additions & 7 deletions l10n_it_fatturapa_out/data/invoice_it_template.xml
Original file line number Diff line number Diff line change
Expand Up @@ -170,7 +170,9 @@ e 'line' per riga di fattura (a seconda del livello in cui sono chiamati)
<t
t-call="l10n_it_fatturapa_out.account_invoice_line_it_sconto_maggiorazione"
/>
<PrezzoTotale t-esc="format_monetary(line.price_subtotal, currency)" />
<PrezzoTotale
t-esc="format_monetary(fpa_to_eur(line.price_subtotal, record), euro)"
/>
<AliquotaIVA
t-if="not line_is_section_note"
t-esc="format_numbers(tax_ids.amount)"
Expand Down Expand Up @@ -205,6 +207,16 @@ e 'line' per riga di fattura (a seconda del livello in cui sono chiamati)
>
<TipoDato>INVCONT</TipoDato>
</AltriDatiGestionali>
<AltriDatiGestionali
t-if="not line_is_section_note and line.currency_id != euro"
>
<TipoDato>Valuta</TipoDato>
<RiferimentoTesto t-esc="line.currency_id.name" />
<RiferimentoNumero
t-esc="format_price(line, original_currency=True)"
/>
<RiferimentoData t-esc="format_date(record.date)" />
</AltriDatiGestionali>
</DettaglioLinee>
</template>

Expand All @@ -217,9 +229,11 @@ e 'line' per riga di fattura (a seconda del livello in cui sono chiamati)
<!-- <SpeseAccessorie t-esc=""/>-->
<!-- <Arrotondamento t-esc=""/>-->
<ImponibileImporto
t-esc="format_monetary(tax_line.tax_base_amount, currency)"
t-esc="format_monetary(fpa_to_eur(tax_line.tax_base_amount, record), euro)"
/>
<Imposta
t-esc="format_monetary(fpa_to_eur(tax_line.price_total, record), euro)"
/>
<Imposta t-esc="format_monetary(tax_line.price_total, currency)" />
<EsigibilitaIVA t-if="tax.payability" t-esc="tax.payability" />
<RiferimentoNormativo
t-if="tax.law_reference"
Expand Down Expand Up @@ -530,13 +544,21 @@ e 'line' per riga di fattura (a seconda del livello in cui sono chiamati)
t-set="currency"
t-value="record.currency_id or record.company_currency_id"
/>
<t t-set="euro" t-value="env.ref('base.EUR')" />
<t t-set="bank" t-value="record.partner_bank_id" />
<FatturaElettronicaBody>
<DatiGenerali>
<DatiGeneraliDocumento>
<!--2.1.1-->
<TipoDocumento t-esc="record.fiscal_document_type_id.code" />
<Divisa t-esc="currency.name" />
<Divisa
t-if="record.company_id.xml_divisa_value == 'keep_orig'"
t-esc="currency.name"
/>
<Divisa
t-if="not record.company_id.xml_divisa_value == 'keep_orig'"
t-esc="euro.name"
/>
<Data t-esc="format_date(record.invoice_date)" />
<Numero t-esc="record.name" />
<t
Expand All @@ -554,7 +576,12 @@ e 'line' per riga di fattura (a seconda del livello in cui sono chiamati)
<!-- <Importo t-esc=""/>-->
<!-- </ScontoMaggiorazione>-->
<ImportoTotaleDocumento
t-esc="format_numbers_two(record.amount_total)"
t-if="record.company_id.xml_divisa_value == 'keep_orig'"
t-esc="format_numbers_two(get_importo_totale(record))"
/>
<ImportoTotaleDocumento
t-if="not record.company_id.xml_divisa_value == 'keep_orig'"
t-esc="format_numbers_two(fpa_to_eur(get_importo_totale(record), record))"
/>
<!-- <Arrotondamento t-esc=""/>-->
<t t-foreach="get_causale(record)" t-as="causale">
Expand Down Expand Up @@ -600,10 +627,10 @@ e 'line' per riga di fattura (a seconda del livello in cui sono chiamati)
<!-- <SpeseAccessorie t-esc=""/>-->
<!-- <Arrotondamento t-esc=""/>-->
<ImponibileImporto
t-esc="format_monetary(tax_data['ImponibileImporto'], currency)"
t-esc="format_monetary(fpa_to_eur(tax_data['ImponibileImporto'], record), euro)"
/>
<Imposta
t-esc="format_monetary(tax_data['Imposta'], currency)"
t-esc="format_monetary(fpa_to_eur(tax_data['Imposta'], record), euro)"
/>
<EsigibilitaIVA
t-if="tax_data.get('EsigibilitaIVA', False)"
Expand Down Expand Up @@ -646,8 +673,14 @@ e 'line' per riga di fattura (a seconda del livello in cui sono chiamati)
t-esc="format_date(move_line.date_maturity)"
/>
<ImportoPagamento
t-if="record.company_id.xml_divisa_value == 'keep_orig'"
t-esc="format_numbers_two(move_line.amount_currency or move_line.debit)"
/>
<ImportoPagamento
t-if="not record.company_id.xml_divisa_value == 'keep_orig'"
t-esc="format_numbers_two(fpa_to_eur(move_line.amount_currency or move_line.debit, record))"
/>

<!-- <CodUfficioPostale t-esc=""/>-->
<!-- <CognomeQuietanzante t-esc=""/>-->
<!-- <NomeQuietanzante t-esc=""/>-->
Expand Down
20 changes: 20 additions & 0 deletions l10n_it_fatturapa_out/models/company.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,12 @@
# Copyright 2019 Roberto Fichera <[email protected]>
# Copyright 2022 Marco Colombo <[email protected]>
# License LGPL-3.0 or later (http://www.gnu.org/licenses/lgpl).

from odoo import _, api, fields, models
from odoo.exceptions import ValidationError

_DEFAULT_XML_DIVISA_VALUE = "force_eur"


class ResCompany(models.Model):
_inherit = "res.company"
Expand All @@ -15,6 +18,15 @@ class ResCompany(models.Model):
"in a single XML file. 0=Unlimited",
)

xml_divisa_value = fields.Selection(
[
("keep_orig", "Keep original"),
("force_eur", "Force euro"),
],
string="XML Divisa value",
default=_DEFAULT_XML_DIVISA_VALUE,
)

@api.constrains("max_invoice_in_xml")
def _validate_max_invoice_in_xml(self):
if self.max_invoice_in_xml < 0:
Expand All @@ -33,12 +45,20 @@ class AccountConfigSettings(models.TransientModel):
related="company_id.max_invoice_in_xml", readonly=False
)

xml_divisa_value = fields.Selection(
related="company_id.xml_divisa_value", readonly=False
)

@api.onchange("company_id")
def onchange_company_id(self):
res = super(AccountConfigSettings, self).onchange_company_id()
if self.company_id:
company = self.company_id
self.max_invoice_in_xml = company.max_invoice_in_xml or 0
self.xml_divisa_value = (
company.xml_divisa_value or _DEFAULT_XML_DIVISA_VALUE
)
else:
self.max_invoice_in_xml = 0
self.xml_divisa_value = _DEFAULT_XML_DIVISA_VALUE
return res
104 changes: 0 additions & 104 deletions l10n_it_fatturapa_out/tests/data/IT06363391001_00009.xml

This file was deleted.

Loading

0 comments on commit 32300e3

Please sign in to comment.