Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[14.0][IMP] supporto per la conversione degli importi in EUR per fatture in valuta estera #2563

Merged
merged 21 commits into from
Apr 15, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
21 commits
Select commit Hold shift + click to select a range
0e2ade3
[FIX] l10n_it_reverse_charge: disable one test (for now)
TheMule71 Apr 8, 2022
b24b62f
[FIX] account_vat_period_end_statement: fix test tags
TheMule71 Apr 15, 2022
9b396ad
[FIX] l10n_it_declaration_of_intent: fix test tags
TheMule71 Apr 15, 2022
785df3f
[FIX] l10n_it_fatturapa_out_di: fix test tags
TheMule71 Apr 15, 2022
9dc9898
[FIX] l10n_it_fatturapa_out_rc: fix test tags
TheMule71 Apr 15, 2022
7b47ce0
[FIX] l10n_it_fatturapa_out_sp: fix test tags
TheMule71 Apr 15, 2022
2b3051c
[FIX] l10n_it_fatturapa_pec: fix test tags
TheMule71 Apr 15, 2022
afe6264
[FIX] l10n_it_fiscal_document_type: fix test tags
TheMule71 Apr 15, 2022
d3e238b
[FIX] l10n_it_intrastat: fix test tags
TheMule71 Apr 15, 2022
f0fd147
[FIX] l10n_it_reverse_charge: fix test tags
TheMule71 Apr 15, 2022
33626b4
[FIX] l10n_it_account: fix test tags
TheMule71 Apr 15, 2022
569351d
[FIX] l10n_it_split_payment: fix test tags
TheMule71 Apr 15, 2022
c019630
[FIX] l10n_it_vat_registries_split_payment: fix test tags
TheMule71 Apr 15, 2022
9d7e2ef
[FIX] l10n_it_vat_statement_split_payment: fix test tags
TheMule71 Apr 15, 2022
7ec14ad
[FIX] l10n_it_withholding_tax_payment: fix test tags
TheMule71 Apr 15, 2022
dabbabd
[FIX] l10n_it_fatturapa_out: fix test tags
TheMule71 Apr 15, 2022
fd8b44c
[IMP] l10n_it_fatturapa_out: supporto per la conversione degli import…
TheMule71 Dec 17, 2021
1e862c3
[IMP] l10n_it_fatturapa_out_sp: supporto per la conversione degli imp…
TheMule71 Jan 14, 2022
07f73ce
[IMP] l10n_it_fatturapa_out_rc: supporto per la conversione degli imp…
TheMule71 Feb 11, 2022
e11f64f
[FIX] Adjust price in USD for products used in tests
TheMule71 Apr 8, 2022
e1875f3
[FIX] l10n_it_sdi_channel: remove required attr from field in view
TheMule71 Apr 15, 2022
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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