diff --git a/l10n_do_accounting/__manifest__.py b/l10n_do_accounting/__manifest__.py index b091af381..e4004bf2e 100644 --- a/l10n_do_accounting/__manifest__.py +++ b/l10n_do_accounting/__manifest__.py @@ -8,7 +8,7 @@ "category": "Localization", "license": "LGPL-3", "website": "https://github.com/odoo-dominicana", - "version": "16.0.1.5.2", + "version": "16.0.1.5.3", # any module necessary for this one to work correctly "depends": ["l10n_latam_invoice_document", "l10n_do"], # always loaded diff --git a/l10n_do_accounting/tests/common.py b/l10n_do_accounting/tests/common.py index 22ee08d52..a266e1657 100644 --- a/l10n_do_accounting/tests/common.py +++ b/l10n_do_accounting/tests/common.py @@ -14,6 +14,17 @@ def setUpClass(cls, chart_template_ref="l10n_do.do_chart_template"): street="dummy address", country_id=cls.env.ref("base.do").id, )["company"] + + # multi-currency variables + cls.usd_currency = cls.env.ref("base.USD") + cls.env["res.currency.rate"].create( + { + "currency_id": cls.usd_currency.id, + "rate": 0.01694915254, + "company_id": cls.do_company.id, + } + ) + cls.fiscal_partner = cls.env["res.partner"].create( { "name": "ITERATIVO SRL", diff --git a/l10n_do_accounting/tests/test_account_move.py b/l10n_do_accounting/tests/test_account_move.py index abca7643f..6191eda4b 100644 --- a/l10n_do_accounting/tests/test_account_move.py +++ b/l10n_do_accounting/tests/test_account_move.py @@ -711,3 +711,95 @@ def test_010_ncf_format(self): with self.assertRaises(ValidationError): self._create_l10n_do_invoice(data={"document_number": "B310000000001"}) + + def test_011_get_l10n_do_line_amounts(self): + invoice_1 = self._create_l10n_do_invoice( + data={ + "document_number": "B0100000001", + } + ) + self.assertDictEqual( + invoice_1._get_l10n_do_amounts(), + { + "base_amount": 100.0, + "exempt_amount": 0, + "isr_withholding_amount": 0, + "isr_withholding_base_amount": 0, + "itbis_0_base_amount": 0, + "itbis_0_tax_amount": 0, + "itbis_16_base_amount": 0, + "itbis_16_tax_amount": 0, + "itbis_18_base_amount": 100.0, + "itbis_18_tax_amount": 18.0, + "itbis_withholding_amount": 0, + "itbis_withholding_base_amount": 0, + "l10n_do_invoice_total": 118.0, + }, + ) + + invoice_2 = self._create_l10n_do_invoice( + data={ + "partner": self.consumo_partner, + "document_number": "B1100000001", + "expense_type": "02", + }, + invoice_type="in_invoice", + ) + + self.assertDictEqual( + invoice_2._get_l10n_do_amounts(), + { + "base_amount": 100.0, + "exempt_amount": 0, + "isr_withholding_amount": 10.0, + "isr_withholding_base_amount": 100.0, + "itbis_0_base_amount": 0, + "itbis_0_tax_amount": 0, + "itbis_16_base_amount": 0, + "itbis_16_tax_amount": 0, + "itbis_18_base_amount": 100.0, + "itbis_18_tax_amount": 18.0, + "itbis_withholding_amount": 18.0, + "itbis_withholding_base_amount": 100.0, + "l10n_do_invoice_total": 118.0, + }, + ) + + invoice_3 = self._create_l10n_do_invoice( + data={ + "document_number": "B0100000002", + "currency": self.usd_currency, + } + ) + + self.assertDictEqual( + invoice_3._get_l10n_do_amounts(), + { + "base_amount": 100.0, + "base_amount_currency": 5900.000000825999, + "exempt_amount": 0, + "exempt_amount_currency": 0.0, + "isr_withholding_amount": 0, + "isr_withholding_amount_currency": 0.0, + "isr_withholding_base_amount": 0, + "isr_withholding_base_amount_currency": 0.0, + "itbis_0_base_amount": 0, + "itbis_0_base_amount_currency": 0.0, + "itbis_0_tax_amount": 0, + "itbis_0_tax_amount_currency": 0.0, + "itbis_16_base_amount": 0, + "itbis_16_base_amount_currency": 0.0, + "itbis_16_tax_amount": 0, + "itbis_16_tax_amount_currency": 0.0, + "itbis_18_base_amount": 100.0, + "itbis_18_base_amount_currency": 5900.000000825999, + "itbis_18_tax_amount": 18.0, + "itbis_18_tax_amount_currency": 1062.0000001486799, + "itbis_withholding_amount": 0, + "itbis_withholding_amount_currency": 0.0, + "itbis_withholding_base_amount": 0, + "itbis_withholding_base_amount_currency": 0.0, + "l10n_do_invoice_total": 118.0, + "l10n_do_invoice_total_currency": 6962.000000974679, + }, + )