Maintainers
This module is maintained by the OCA.
- + + +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 @@ + +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 !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! -->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 !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! -->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.
- + + +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 @@