diff --git a/README.md b/README.md index 583ad0c5586..85ef9bf9223 100644 --- a/README.md +++ b/README.md @@ -38,7 +38,7 @@ addon | version | maintainers | summary [l10n_es_aeat_mod303_vat_prorate](l10n_es_aeat_mod303_vat_prorate/) | 16.0.1.0.1 | [![victoralmau](https://github.com/victoralmau.png?size=30px)](https://github.com/victoralmau) [![pedrobaeza](https://github.com/pedrobaeza.png?size=30px)](https://github.com/pedrobaeza) | Prorrata de IVA [303] [l10n_es_aeat_mod347](l10n_es_aeat_mod347/) | 16.0.1.7.3 | | AEAT modelo 347 [l10n_es_aeat_mod347_igic](l10n_es_aeat_mod347_igic/) | 16.0.1.0.0 | [![nicolasramos](https://github.com/nicolasramos.png?size=30px)](https://github.com/nicolasramos) | AEAT modelo 347 IGIC -[l10n_es_aeat_mod349](l10n_es_aeat_mod349/) | 16.0.1.3.1 | [![pedrobaeza](https://github.com/pedrobaeza.png?size=30px)](https://github.com/pedrobaeza) | AEAT modelo 349 +[l10n_es_aeat_mod349](l10n_es_aeat_mod349/) | 16.0.1.3.2 | [![pedrobaeza](https://github.com/pedrobaeza.png?size=30px)](https://github.com/pedrobaeza) | AEAT modelo 349 [l10n_es_aeat_mod369](l10n_es_aeat_mod369/) | 16.0.1.1.0 | | AEAT modelo 369 [l10n_es_aeat_mod390](l10n_es_aeat_mod390/) | 16.0.2.6.0 | [![pedrobaeza](https://github.com/pedrobaeza.png?size=30px)](https://github.com/pedrobaeza) | AEAT modelo 390 [l10n_es_aeat_partner_check](l10n_es_aeat_partner_check/) | 16.0.1.0.1 | | AEAT - Comprobación de Calidad de datos identificativos @@ -67,7 +67,7 @@ addon | version | maintainers | summary [l10n_es_payment_order_confirming_sabadell](l10n_es_payment_order_confirming_sabadell/) | 16.0.1.0.1 | | Exportación de fichero bancario Confirming para Banco Sabadell [l10n_es_pos](l10n_es_pos/) | 16.0.1.0.2 | | Punto de venta adaptado a la legislación española [l10n_es_pos_by_device](l10n_es_pos_by_device/) | 16.0.1.0.1 | [![ao-landoo](https://github.com/ao-landoo.png?size=30px)](https://github.com/ao-landoo) | Múltiples dispositivos por sesión en el punto de venta -[l10n_es_pos_sii](l10n_es_pos_sii/) | 16.0.2.0.0 | | Envío de pedidos del TPV al SII +[l10n_es_pos_sii](l10n_es_pos_sii/) | 16.0.2.1.0 | | Envío de pedidos del TPV al SII [l10n_es_sigaus_account](l10n_es_sigaus_account/) | 16.0.1.0.0 | | Sistema de gestión de aceites industriales usados en España - Facturación [l10n_es_sigaus_purchase](l10n_es_sigaus_purchase/) | 16.0.1.0.1 | | Sistema de gestión de aceites industriales usados en España - Compras [l10n_es_sigaus_sale](l10n_es_sigaus_sale/) | 16.0.1.0.1 | | Sist. gestión aceites industriales usados en España - Ventas @@ -81,7 +81,7 @@ addon | version | maintainers | summary [l10n_es_vat_book_igic](l10n_es_vat_book_igic/) | 16.0.1.0.0 | [![nicolasramos](https://github.com/nicolasramos.png?size=30px)](https://github.com/nicolasramos) | Libro de IGIC [l10n_es_vat_book_invoice_summary](l10n_es_vat_book_invoice_summary/) | 16.0.1.0.0 | [![victoralmau](https://github.com/victoralmau.png?size=30px)](https://github.com/victoralmau) | Facturas resumen en libro de IVA [l10n_es_vat_book_oss](l10n_es_vat_book_oss/) | 16.0.1.0.0 | | Libro de IVA OSS -[l10n_es_vat_prorate](l10n_es_vat_prorate/) | 16.0.1.0.1 | | Prorrata de IVA para la localización española +[l10n_es_vat_prorate](l10n_es_vat_prorate/) | 16.0.1.1.0 | | Prorrata de IVA para la localización española [payment_redsys](payment_redsys/) | 16.0.1.0.1 | | Payment Acquirer: Redsys Implementation [//]: # (end addons) diff --git a/l10n_es_aeat_mod349/README.rst b/l10n_es_aeat_mod349/README.rst index b1e8f2ea9d1..f8edd55c078 100644 --- a/l10n_es_aeat_mod349/README.rst +++ b/l10n_es_aeat_mod349/README.rst @@ -7,7 +7,7 @@ AEAT modelo 349 !! This file is generated by oca-gen-addon-readme !! !! changes will be overwritten. !! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! - !! source digest: sha256:afcf0458fa11cc81bd00037f9ee9a8d9552b79f53d977a6348aadb0bd6aa6563 + !! source digest: sha256:b2bb38b300e3376bea4b1999a10bb6e47b946cfbff1b5a9c64ee245ab037336d !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! .. |badge1| image:: https://img.shields.io/badge/maturity-Mature-brightgreen.png diff --git a/l10n_es_aeat_mod349/__manifest__.py b/l10n_es_aeat_mod349/__manifest__.py index b3fa6214147..87fe5fcb87b 100644 --- a/l10n_es_aeat_mod349/__manifest__.py +++ b/l10n_es_aeat_mod349/__manifest__.py @@ -9,7 +9,7 @@ { "name": "AEAT modelo 349", - "version": "16.0.1.3.1", + "version": "16.0.1.3.2", "author": "Tecnativa, ForgeFlow, Odoo Community Association (OCA)", "license": "AGPL-3", "category": "Localisation/Accounting", diff --git a/l10n_es_aeat_mod349/models/mod349.py b/l10n_es_aeat_mod349/models/mod349.py index 6ce16d64663..7d013560037 100644 --- a/l10n_es_aeat_mod349/models/mod349.py +++ b/l10n_es_aeat_mod349/models/mod349.py @@ -224,25 +224,12 @@ def _create_349_refund_records(self): if original_details: # There's at least one previous 349 declaration report report = original_details.mapped("report_id")[:1] - partner_id = original_details.mapped("partner_id")[:1] original_details = original_details.filtered( lambda d: d.report_id == report ) origin_amount = sum(original_details.mapped("amount_untaxed")) period_type = report.period_type year = str(report.year) - - # Sum all details period origin - all_details_period = detail_obj.search( - [ - ("partner_id", "=", partner_id.id), - ("partner_record_id.operation_key", "=", op_key), - ("report_id", "=", report.id), - ], - order="report_id desc", - ) - origin_amount = sum(all_details_period.mapped("amount_untaxed")) - # If there are intermediate periods between the original # period and the period where the rectification is taking # place, it's necessary to check if there is any rectification @@ -261,7 +248,6 @@ def _create_349_refund_records(self): ) if last_refund_detail: origin_amount = last_refund_detail.refund_id.total_operation_amount - else: # There's no previous 349 declaration report in Odoo original_amls = move_line_obj.search( diff --git a/l10n_es_aeat_mod349/static/description/index.html b/l10n_es_aeat_mod349/static/description/index.html index e212e789a98..dba6599812a 100644 --- a/l10n_es_aeat_mod349/static/description/index.html +++ b/l10n_es_aeat_mod349/static/description/index.html @@ -8,10 +8,11 @@ /* :Author: David Goodger (goodger@python.org) -:Id: $Id: html4css1.css 8954 2022-01-20 10:10:25Z milde $ +:Id: $Id: html4css1.css 9511 2024-01-13 09:50:07Z milde $ :Copyright: This stylesheet has been placed in the public domain. Default cascading style sheet for the HTML output of Docutils. +Despite the name, some widely supported CSS2 features are used. See https://docutils.sourceforge.io/docs/howto/html-stylesheets.html for how to customize this style sheet. @@ -274,7 +275,7 @@ margin-left: 2em ; margin-right: 2em } -pre.code .ln { color: grey; } /* line numbers */ +pre.code .ln { color: gray; } /* line numbers */ pre.code, code { background-color: #eeeeee } pre.code .comment, code .comment { color: #5C6576 } pre.code .keyword, code .keyword { color: #3B0D06; font-weight: bold } @@ -300,7 +301,7 @@ span.pre { white-space: pre } -span.problematic { +span.problematic, pre.problematic { color: red } span.section-subtitle { @@ -366,7 +367,7 @@

AEAT modelo 349

!! This file is generated by oca-gen-addon-readme !! !! changes will be overwritten. !! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! -!! source digest: sha256:afcf0458fa11cc81bd00037f9ee9a8d9552b79f53d977a6348aadb0bd6aa6563 +!! source digest: sha256:b2bb38b300e3376bea4b1999a10bb6e47b946cfbff1b5a9c64ee245ab037336d !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! -->

Mature License: AGPL-3 OCA/l10n-spain Translate me on Weblate Try me on Runboat

Módulo para la presentación del Modelo AEAT 349 (Declaración Recapitulativa de @@ -538,7 +539,9 @@

Contributors

Maintainers

This module is maintained by the OCA.

-Odoo Community Association + +Odoo Community Association +

OCA, or the Odoo Community Association, is a nonprofit organization whose mission is to support the collaborative development of Odoo features and promote its widespread use.

diff --git a/l10n_es_pos_sii/README.rst b/l10n_es_pos_sii/README.rst index 401bff05d24..2461b1901e0 100644 --- a/l10n_es_pos_sii/README.rst +++ b/l10n_es_pos_sii/README.rst @@ -7,7 +7,7 @@ Envío de pedidos del TPV al SII !! This file is generated by oca-gen-addon-readme !! !! changes will be overwritten. !! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! - !! source digest: sha256:87cf1bd889797cdb7318b3784ef6923204bbf29432748ef9b8245324e2fca76c + !! source digest: sha256:d336aa126fe4478ed702b2375e2f16399293ed03bc06b1459204cfaf5e2e9b01 !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! .. |badge1| image:: https://img.shields.io/badge/maturity-Beta-yellow.png diff --git a/l10n_es_pos_sii/__manifest__.py b/l10n_es_pos_sii/__manifest__.py index 1a28de3d3a4..f4eb7b2dd02 100644 --- a/l10n_es_pos_sii/__manifest__.py +++ b/l10n_es_pos_sii/__manifest__.py @@ -6,7 +6,7 @@ "author": "Aures Tic, Odoo Community Association (OCA)", "website": "https://github.com/OCA/l10n-spain", "license": "AGPL-3", - "version": "16.0.2.0.0", + "version": "16.0.2.1.0", "depends": [ "point_of_sale", "l10n_es_pos", @@ -14,6 +14,7 @@ "pos_default_partner", ], "data": [ + "data/aeat_sii_queue_job.xml", "views/pos_order.xml", "views/res_company.xml", ], diff --git a/l10n_es_pos_sii/data/aeat_sii_queue_job.xml b/l10n_es_pos_sii/data/aeat_sii_queue_job.xml new file mode 100644 index 00000000000..e99f2415d4f --- /dev/null +++ b/l10n_es_pos_sii/data/aeat_sii_queue_job.xml @@ -0,0 +1,17 @@ + + + + pos_order_validate_sii + + + + + confirm_one_document + + + + + cancel_one_invoice + + + diff --git a/l10n_es_pos_sii/static/description/index.html b/l10n_es_pos_sii/static/description/index.html index f97c6dd256c..bd066dbf03c 100644 --- a/l10n_es_pos_sii/static/description/index.html +++ b/l10n_es_pos_sii/static/description/index.html @@ -367,7 +367,7 @@

Envío de pedidos del TPV al SII

!! This file is generated by oca-gen-addon-readme !! !! changes will be overwritten. !! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! -!! source digest: sha256:87cf1bd889797cdb7318b3784ef6923204bbf29432748ef9b8245324e2fca76c +!! source digest: sha256:d336aa126fe4478ed702b2375e2f16399293ed03bc06b1459204cfaf5e2e9b01 !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! -->

Beta License: AGPL-3 OCA/l10n-spain Translate me on Weblate Try me on Runboat

Envío al SII de pedidos del TPV de forma individual.

diff --git a/l10n_es_vat_prorate/README.rst b/l10n_es_vat_prorate/README.rst index a3d3529e743..a33408a134e 100644 --- a/l10n_es_vat_prorate/README.rst +++ b/l10n_es_vat_prorate/README.rst @@ -7,7 +7,7 @@ Prorrata de IVA !! This file is generated by oca-gen-addon-readme !! !! changes will be overwritten. !! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! - !! source digest: sha256:59f1ace90d09cc30ce3bf2a8cdb9d9c5670648913348b64eb9980c4ffb977bff + !! source digest: sha256:32ee5897933f771dc81edfa6475c7190b53b1a5b2724d94f89f7caef95aff379 !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! .. |badge1| image:: https://img.shields.io/badge/maturity-Beta-yellow.png diff --git a/l10n_es_vat_prorate/__manifest__.py b/l10n_es_vat_prorate/__manifest__.py index c940f7393de..19cd6b64f77 100644 --- a/l10n_es_vat_prorate/__manifest__.py +++ b/l10n_es_vat_prorate/__manifest__.py @@ -5,7 +5,7 @@ { "name": "Prorrata de IVA", "summary": "Prorrata de IVA para la localización española", - "version": "16.0.1.0.1", + "version": "16.0.1.1.0", "license": "AGPL-3", "author": "Creu Blanca, Tecnativa, Odoo Community Association (OCA)", "website": "https://github.com/OCA/l10n-spain", diff --git a/l10n_es_vat_prorate/i18n/ca.po b/l10n_es_vat_prorate/i18n/ca.po index a5e5602a332..fb5e6fbd410 100644 --- a/l10n_es_vat_prorate/i18n/ca.po +++ b/l10n_es_vat_prorate/i18n/ca.po @@ -91,6 +91,16 @@ msgstr "Compte prorratejat" msgid "Prorate Account Template" msgstr "Plantilla del compte prorratejat" +#. module: l10n_es_vat_prorate +#: model:ir.model.fields,field_description:l10n_es_vat_prorate.field_res_company__prorrate_asset_account_id +msgid "Prorrate Asset Account" +msgstr "" + +#. module: l10n_es_vat_prorate +#: model:ir.model.fields,field_description:l10n_es_vat_prorate.field_res_company__prorrate_investment_account_id +msgid "Prorrate Investment Account" +msgstr "" + #. module: l10n_es_vat_prorate #: model:ir.model,name:l10n_es_vat_prorate.model_account_tax msgid "Tax" diff --git a/l10n_es_vat_prorate/i18n/es.po b/l10n_es_vat_prorate/i18n/es.po index 28d9f629ea0..bbe842d2108 100644 --- a/l10n_es_vat_prorate/i18n/es.po +++ b/l10n_es_vat_prorate/i18n/es.po @@ -91,6 +91,16 @@ msgstr "Cuenta prorrateada" msgid "Prorate Account Template" msgstr "Plantilla de cuenta prorrateada" +#. module: l10n_es_vat_prorate +#: model:ir.model.fields,field_description:l10n_es_vat_prorate.field_res_company__prorrate_asset_account_id +msgid "Prorrate Asset Account" +msgstr "" + +#. module: l10n_es_vat_prorate +#: model:ir.model.fields,field_description:l10n_es_vat_prorate.field_res_company__prorrate_investment_account_id +msgid "Prorrate Investment Account" +msgstr "" + #. module: l10n_es_vat_prorate #: model:ir.model,name:l10n_es_vat_prorate.model_account_tax msgid "Tax" diff --git a/l10n_es_vat_prorate/i18n/l10n_es_vat_prorate.pot b/l10n_es_vat_prorate/i18n/l10n_es_vat_prorate.pot index fd5fbe4abd9..2fc55622688 100644 --- a/l10n_es_vat_prorate/i18n/l10n_es_vat_prorate.pot +++ b/l10n_es_vat_prorate/i18n/l10n_es_vat_prorate.pot @@ -88,6 +88,16 @@ msgstr "" msgid "Prorate Account Template" msgstr "" +#. module: l10n_es_vat_prorate +#: model:ir.model.fields,field_description:l10n_es_vat_prorate.field_res_company__prorrate_asset_account_id +msgid "Prorrate Asset Account" +msgstr "" + +#. module: l10n_es_vat_prorate +#: model:ir.model.fields,field_description:l10n_es_vat_prorate.field_res_company__prorrate_investment_account_id +msgid "Prorrate Investment Account" +msgstr "" + #. module: l10n_es_vat_prorate #: model:ir.model,name:l10n_es_vat_prorate.model_account_tax msgid "Tax" diff --git a/l10n_es_vat_prorate/models/account_move.py b/l10n_es_vat_prorate/models/account_move.py index f323e3b5de1..e0c52d60dc1 100644 --- a/l10n_es_vat_prorate/models/account_move.py +++ b/l10n_es_vat_prorate/models/account_move.py @@ -55,7 +55,10 @@ def _compute_all_tax(self): new_key.update( { "vat_prorate": True, - "account_id": line.account_id.id, + "account_id": line.company_id._get_tax_prorrate_account_map().get( + line.account_id.account_type + ) + or line.account_id.id, "analytic_distribution": line.analytic_distribution, } ) diff --git a/l10n_es_vat_prorate/models/res_company.py b/l10n_es_vat_prorate/models/res_company.py index a695efa4629..a7f433403ab 100644 --- a/l10n_es_vat_prorate/models/res_company.py +++ b/l10n_es_vat_prorate/models/res_company.py @@ -2,7 +2,7 @@ # Copyright 2023 Tecnativa Carolina Fernandez # License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). -from odoo import _, api, fields, models +from odoo import _, api, fields, models, tools from odoo.exceptions import ValidationError @@ -13,6 +13,36 @@ class ResCompany(models.Model): vat_prorate_ids = fields.One2many( "res.company.vat.prorate", inverse_name="company_id" ) + prorrate_asset_account_id = fields.Many2one( + "account.account", + domain="[('company_id', '=', id)]", + compute="_compute_prorrate_accounts", + store=True, + readonly=False, + ) + prorrate_investment_account_id = fields.Many2one( + "account.account", + domain="[('company_id', '=', id)]", + compute="_compute_prorrate_accounts", + store=True, + readonly=False, + ) + + @api.depends("chart_template_id", "with_vat_prorate") + def _compute_prorrate_accounts(self): + for record in self: + if record.with_vat_prorate and record.chart_template_id: + record.prorrate_asset_account_id = self.env.ref( + "l10n_es.%s_account_common_6341" % record.id, + raise_if_not_found=False, + ) + record.prorrate_investment_account_id = self.env.ref( + "l10n_es.%s_account_common_6342" % record.id, + raise_if_not_found=False, + ) + else: + record.prorrate_asset_account_id = False + record.prorrate_investment_account_id = False def get_prorate(self, date): self.ensure_one() @@ -29,6 +59,21 @@ def _check_vat_prorate_ids(self): if rec.with_vat_prorate and not rec.vat_prorate_ids: raise ValidationError(_("You must complete VAT prorate information")) + @tools.ormcache( + "self.id", + "self.prorrate_asset_account_id.id", + "self.prorrate_investment_account_id.id", + ) + def _get_tax_prorrate_account_map(self): + """Get the account mapping according user type""" + return { + "asset_current": self.prorrate_asset_account_id.id, + "asset_non_current": self.prorrate_asset_account_id.id, + "asset_fixed": self.prorrate_asset_account_id.id, + "liability_current": self.prorrate_investment_account_id.id, + "liability_non_current": self.prorrate_investment_account_id.id, + } + class ResCompanyVatProrate(models.Model): _name = "res.company.vat.prorate" @@ -36,7 +81,7 @@ class ResCompanyVatProrate(models.Model): _rec_name = "date" _order = "date DESC" - company_id = fields.Many2one("res.company", required=True) + company_id = fields.Many2one("res.company", required=True, ondelete="cascade") date = fields.Date(required=True, default=fields.Date.today()) vat_prorate = fields.Float() diff --git a/l10n_es_vat_prorate/static/description/index.html b/l10n_es_vat_prorate/static/description/index.html index 6e46897c0dc..a9f0ac3b11b 100644 --- a/l10n_es_vat_prorate/static/description/index.html +++ b/l10n_es_vat_prorate/static/description/index.html @@ -8,10 +8,11 @@ /* :Author: David Goodger (goodger@python.org) -:Id: $Id: html4css1.css 8954 2022-01-20 10:10:25Z milde $ +:Id: $Id: html4css1.css 9511 2024-01-13 09:50:07Z milde $ :Copyright: This stylesheet has been placed in the public domain. Default cascading style sheet for the HTML output of Docutils. +Despite the name, some widely supported CSS2 features are used. See https://docutils.sourceforge.io/docs/howto/html-stylesheets.html for how to customize this style sheet. @@ -274,7 +275,7 @@ margin-left: 2em ; margin-right: 2em } -pre.code .ln { color: grey; } /* line numbers */ +pre.code .ln { color: gray; } /* line numbers */ pre.code, code { background-color: #eeeeee } pre.code .comment, code .comment { color: #5C6576 } pre.code .keyword, code .keyword { color: #3B0D06; font-weight: bold } @@ -300,7 +301,7 @@ span.pre { white-space: pre } -span.problematic { +span.problematic, pre.problematic { color: red } span.section-subtitle { @@ -366,7 +367,7 @@

Prorrata de IVA

!! This file is generated by oca-gen-addon-readme !! !! changes will be overwritten. !! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! -!! source digest: sha256:59f1ace90d09cc30ce3bf2a8cdb9d9c5670648913348b64eb9980c4ffb977bff +!! source digest: sha256:32ee5897933f771dc81edfa6475c7190b53b1a5b2724d94f89f7caef95aff379 !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! -->

Beta License: AGPL-3 OCA/l10n-spain Translate me on Weblate Try me on Runboat

El módulo nos divide los IVA según la prorrata de la compañía.

@@ -429,7 +430,9 @@

Contributors

Maintainers

This module is maintained by the OCA.

-Odoo Community Association + +Odoo Community Association +

OCA, or the Odoo Community Association, is a nonprofit organization whose mission is to support the collaborative development of Odoo features and promote its widespread use.

diff --git a/l10n_es_vat_prorate/tests/test_vat_prorate.py b/l10n_es_vat_prorate/tests/test_vat_prorate.py index f094a6a2404..2cb5fe69f35 100644 --- a/l10n_es_vat_prorate/tests/test_vat_prorate.py +++ b/l10n_es_vat_prorate/tests/test_vat_prorate.py @@ -63,6 +63,14 @@ def test_no_company_vat_prorate_information(self): with self.assertRaises(exceptions.ValidationError): self.env.company.write({"vat_prorate_ids": False}) + def test_company_configuration(self): + self.assertTrue(self.env.company.with_vat_prorate) + self.assertTrue(self.env.company.prorrate_asset_account_id) + self.assertTrue(self.env.company.prorrate_investment_account_id) + self.env.company.write({"with_vat_prorate": False}) + self.assertFalse(self.env.company.prorrate_asset_account_id) + self.assertFalse(self.env.company.prorrate_investment_account_id) + def test_no_prorate_in_invoice(self): self.env.company.write( {"with_vat_prorate": False} @@ -79,6 +87,18 @@ def test_prorate_different_accounts_in_invoice(self): ) self.assertEqual(6, len(invoice.line_ids)) self.assertEqual(3, len(invoice.line_ids.filtered(lambda r: r.tax_line_id))) + self.assertTrue( + invoice.line_ids.filtered( + lambda r: r.tax_line_id + and r.account_id == self.product_a.property_account_expense_id + ) + ) + self.assertTrue( + invoice.line_ids.filtered( + lambda r: r.tax_line_id + and r.account_id == self.product_b.property_account_expense_id + ) + ) # Deal with analytics invoice.line_ids[0].analytic_distribution = {self.analytic_account.id: 100} self.assertEqual(6, len(invoice.line_ids)) @@ -105,6 +125,20 @@ def test_prorate_same_accounts_in_invoice(self): # One of the tax lines should have expense account and the other the tax account self.assertNotEqual(tax_lines[0].account_id, tax_lines[1].account_id) + def test_prorate_asset_in_invoice(self): + self.product_b.property_account_expense_id = self.company_data[ + "default_account_assets" + ] + invoice = self.init_invoice("in_invoice", products=[self.product_b]) + self.assertEqual(4, len(invoice.line_ids)) + self.assertEqual(2, len(invoice.line_ids.filtered(lambda r: r.tax_line_id))) + self.assertFalse( + invoice.line_ids.filtered( + lambda r: r.tax_line_id + and r.account_id == self.product_b.property_account_expense_id + ) + ) + def test_no_prorate_in_refund(self): self.env.company.write( {"with_vat_prorate": False} diff --git a/l10n_es_vat_prorate/views/res_company_views.xml b/l10n_es_vat_prorate/views/res_company_views.xml index 95279225cec..09f47272254 100644 --- a/l10n_es_vat_prorate/views/res_company_views.xml +++ b/l10n_es_vat_prorate/views/res_company_views.xml @@ -18,6 +18,14 @@ + +