From d273598c7f5f3f4930f59f2d24d9cb23a7362233 Mon Sep 17 00:00:00 2001 From: "Luis J. Salvatierra" Date: Mon, 28 Nov 2022 15:56:32 +0100 Subject: [PATCH] [MIG] account_move_line_tax_editable: Migration to 16.0 Update account_move_line_tax_editable/i18n/es.po Co-authored-by: Yadier-Tecnativa <129773077+Yadier-Tecnativa@users.noreply.github.com> --- account_move_line_tax_editable/README.rst | 14 +- .../__manifest__.py | 4 +- .../i18n/account_move_line_tax_editable.pot | 2 +- account_move_line_tax_editable/i18n/es.po | 2 +- .../readme/CONTRIBUTORS.rst | 4 + .../static/description/index.html | 10 +- .../test_account_move_line_tax_editable.py | 157 ++++++++++-------- .../views/account_move.xml | 27 ++- .../views/account_move_line.xml | 29 ---- 9 files changed, 131 insertions(+), 118 deletions(-) delete mode 100644 account_move_line_tax_editable/views/account_move_line.xml diff --git a/account_move_line_tax_editable/README.rst b/account_move_line_tax_editable/README.rst index 0ada4d5a4..e49fb943b 100644 --- a/account_move_line_tax_editable/README.rst +++ b/account_move_line_tax_editable/README.rst @@ -14,13 +14,13 @@ Account Move Line Tax Editable :target: http://www.gnu.org/licenses/agpl-3.0-standalone.html :alt: License: AGPL-3 .. |badge3| image:: https://img.shields.io/badge/github-OCA%2Faccount--financial--tools-lightgray.png?logo=github - :target: https://github.com/OCA/account-financial-tools/tree/15.0/account_move_line_tax_editable + :target: https://github.com/OCA/account-financial-tools/tree/16.0/account_move_line_tax_editable :alt: OCA/account-financial-tools .. |badge4| image:: https://img.shields.io/badge/weblate-Translate%20me-F47D42.png - :target: https://translation.odoo-community.org/projects/account-financial-tools-15-0/account-financial-tools-15-0-account_move_line_tax_editable + :target: https://translation.odoo-community.org/projects/account-financial-tools-16-0/account-financial-tools-16-0-account_move_line_tax_editable :alt: Translate me on Weblate .. |badge5| image:: https://img.shields.io/badge/runbot-Try%20me-875A7B.png - :target: https://runbot.odoo-community.org/runbot/92/15.0 + :target: https://runbot.odoo-community.org/runbot/92/16.0 :alt: Try me on Runbot |badge1| |badge2| |badge3| |badge4| |badge5| @@ -38,7 +38,7 @@ Bug Tracker Bugs are tracked on `GitHub Issues `_. In case of trouble, please check there if your issue has already been reported. If you spotted it first, help us smashing it by providing a detailed and welcomed -`feedback `_. +`feedback `_. Do not contact contributors directly about support or help with technical issues. @@ -64,6 +64,10 @@ Contributors * Manuel Regidor +* `Factor Libre `_: + + * Luis J. Salvatierra + Maintainers ~~~~~~~~~~~ @@ -77,6 +81,6 @@ 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. -This module is part of the `OCA/account-financial-tools `_ project on GitHub. +This module is part of the `OCA/account-financial-tools `_ project on GitHub. You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute. diff --git a/account_move_line_tax_editable/__manifest__.py b/account_move_line_tax_editable/__manifest__.py index eceffe222..991d516b1 100644 --- a/account_move_line_tax_editable/__manifest__.py +++ b/account_move_line_tax_editable/__manifest__.py @@ -4,10 +4,10 @@ { "name": "Account Move Line Tax Editable", "summary": "Allows to edit taxes on non-posted account move lines", - "version": "15.0.1.0.1", + "version": "16.0.1.0.0", "license": "AGPL-3", "author": "ACSONE SA/NV, Odoo Community Association (OCA)", "website": "https://github.com/OCA/account-financial-tools", "depends": ["account"], - "data": ["views/account_move.xml", "views/account_move_line.xml"], + "data": ["views/account_move.xml"], } diff --git a/account_move_line_tax_editable/i18n/account_move_line_tax_editable.pot b/account_move_line_tax_editable/i18n/account_move_line_tax_editable.pot index 0982ee920..8c53c6438 100644 --- a/account_move_line_tax_editable/i18n/account_move_line_tax_editable.pot +++ b/account_move_line_tax_editable/i18n/account_move_line_tax_editable.pot @@ -4,7 +4,7 @@ # msgid "" msgstr "" -"Project-Id-Version: Odoo Server 15.0\n" +"Project-Id-Version: Odoo Server 16.0\n" "Report-Msgid-Bugs-To: \n" "Last-Translator: \n" "Language-Team: \n" diff --git a/account_move_line_tax_editable/i18n/es.po b/account_move_line_tax_editable/i18n/es.po index f8985b6a8..110b221a1 100644 --- a/account_move_line_tax_editable/i18n/es.po +++ b/account_move_line_tax_editable/i18n/es.po @@ -29,7 +29,7 @@ msgstr "Identificación" #. module: account_move_line_tax_editable #: model:ir.model.fields,field_description:account_move_line_tax_editable.field_account_move_line__is_tax_editable msgid "Is tax data editable?" -msgstr "" +msgstr "¿Los datos fiscales son editables?" #. module: account_move_line_tax_editable #: model:ir.model,name:account_move_line_tax_editable.model_account_move_line diff --git a/account_move_line_tax_editable/readme/CONTRIBUTORS.rst b/account_move_line_tax_editable/readme/CONTRIBUTORS.rst index 5b1100177..9478ec3f2 100644 --- a/account_move_line_tax_editable/readme/CONTRIBUTORS.rst +++ b/account_move_line_tax_editable/readme/CONTRIBUTORS.rst @@ -8,3 +8,7 @@ * `Sygel `_: * Manuel Regidor + +* `Factor Libre `_: + + * Luis J. Salvatierra diff --git a/account_move_line_tax_editable/static/description/index.html b/account_move_line_tax_editable/static/description/index.html index b378f830f..5bade7647 100644 --- a/account_move_line_tax_editable/static/description/index.html +++ b/account_move_line_tax_editable/static/description/index.html @@ -367,7 +367,7 @@ ul.auto-toc { !! This file is generated by oca-gen-addon-readme !! !! changes will be overwritten. !! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! --> -

Beta License: AGPL-3 OCA/account-financial-tools Translate me on Weblate Try me on Runbot

+

Beta License: AGPL-3 OCA/account-financial-tools Translate me on Weblate Try me on Runbot

Allows to edit taxes on account move lines.

Table of contents

@@ -386,7 +386,7 @@ ul.auto-toc {

Bugs are tracked on GitHub Issues. In case of trouble, please check there if your issue has already been reported. If you spotted it first, help us smashing it by providing a detailed and welcomed -feedback.

+feedback.

Do not contact contributors directly about support or help with technical issues.

@@ -410,6 +410,10 @@ If you spotted it first, help us smashing it by providing a detailed and welcome
  • Manuel Regidor
  • +
  • Factor Libre: +
  • @@ -419,7 +423,7 @@ If you spotted it first, help us smashing it by providing a detailed and welcome

    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.

    -

    This module is part of the OCA/account-financial-tools project on GitHub.

    +

    This module is part of the OCA/account-financial-tools project on GitHub.

    You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute.

    diff --git a/account_move_line_tax_editable/tests/test_account_move_line_tax_editable.py b/account_move_line_tax_editable/tests/test_account_move_line_tax_editable.py index 0d8a97326..199c57bb3 100644 --- a/account_move_line_tax_editable/tests/test_account_move_line_tax_editable.py +++ b/account_move_line_tax_editable/tests/test_account_move_line_tax_editable.py @@ -1,89 +1,104 @@ # Copyright 2019 Tecnativa - Ernesto Tejeda # License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). - -import odoo.tests.common as common from odoo import fields +from odoo.tests import tagged + +from odoo.addons.account.tests.common import AccountTestInvoicingCommon -class TestAccountMoveLineTaxEditable(common.TransactionCase): +@tagged("post_install", "-at_install") +class TestAccountMoveLineTaxEditable(AccountTestInvoicingCommon): @classmethod - def setUpClass(cls): - super().setUpClass() - - acc_obj = cls.env["account.account"] - account100 = acc_obj.create( - { - "code": "100", - "name": "Account 100", - "user_type_id": cls.env.ref("account.data_account_type_receivable").id, - "reconcile": True, - } + def setUpClass(cls, chart_template_ref=None): + super().setUpClass(chart_template_ref=chart_template_ref) + refund_repartitions = cls.company_data[ + "default_tax_sale" + ].refund_repartition_line_ids + tax_repartition_line = refund_repartitions.filtered( + lambda line: line.repartition_type == "tax" ) - account300 = acc_obj.create( + cls.account_revenue = cls.company_data["default_account_revenue"] + cls.account_expense = cls.company_data["default_account_expense"] + cls.account_tax_sale = cls.company_data["default_account_tax_sale"] + cls.tax_sale = cls.company_data["default_tax_sale"] + cls.tax_sale_copy = cls.tax_sale.copy() + cls.test_move = cls.env["account.move"].create( { - "code": "300", - "name": "Account 300", - "user_type_id": cls.env.ref( - "account.data_account_type_other_income" - ).id, - } - ) - - journal = cls.env["account.journal"].create( - {"name": "Test journal", "type": "sale", "code": "TEST"} - ) - move_vals = { - "journal_id": journal.id, - "name": "move test", - "date": fields.Date.today(), - "line_ids": [ - ( - 0, - 0, - { - "name": "move test line 1", - "debit": 0.0, - "credit": 1000.0, - "account_id": account300.id, - }, - ), - ( - 0, - 0, - { - "name": "move test line 2", - "debit": 1000.0, - "credit": 0.0, - "account_id": account100.id, - }, - ), - ], - } - cls.move = cls.env["account.move"].create(move_vals) - cls.tax15 = cls.env["account.tax"].create( - { - "name": "Test tax 15", - "amount": 15, + "move_type": "entry", + "date": fields.Date.from_string("2016-01-01"), + "line_ids": [ + ( + 0, + None, + { + "name": "revenue line 1", + "account_id": cls.account_revenue.id, + "debit": 500.0, + "credit": 0.0, + }, + ), + ( + 0, + None, + { + "name": "revenue line 2", + "account_id": cls.account_revenue.id, + "debit": 1000.0, + "credit": 0.0, + "tax_ids": [(6, 0, cls.tax_sale.ids)], + }, + ), + ( + 0, + None, + { + "name": "tax line", + "account_id": cls.account_tax_sale.id, + "debit": 150.0, + "credit": 0.0, + "tax_repartition_line_id": tax_repartition_line.id, + }, + ), + ( + 0, + None, + { + "name": "counterpart line", + "account_id": cls.account_expense.id, + "debit": 0.0, + "credit": 1650.0, + }, + ), + ], } ) def test_compute_is_tax_editable(self): - self.assertEqual(self.move.line_ids.mapped("is_tax_editable"), [True, True]) - self.move.action_post() - self.assertEqual(self.move.line_ids.mapped("is_tax_editable"), [False, False]) + self.assertTrue(all(self.test_move.line_ids.mapped("is_tax_editable"))) + self.test_move.action_post() + self.assertFalse(any(self.test_move.line_ids.mapped("is_tax_editable"))) def test_tax_edited(self): - line1 = self.move.line_ids[0] - line1.tax_line_id = self.tax15.id - line2 = self.move.line_ids[1] - self.move.action_post() - self.assertEqual(line1.tax_line_id.id, self.tax15.id) - self.assertEqual(line2.tax_line_id.id, False) - self.assertEqual(line1.tax_repartition_line_id.tax_id.id, self.tax15.id) + tax_line = self.test_move.line_ids.filtered( + lambda x: x.account_id == self.account_tax_sale + ) + self.assertEqual(tax_line.tax_repartition_line_id.tax_id, self.tax_sale) + self.assertEqual(tax_line.tax_line_id, self.tax_sale) + tax_line.tax_line_id = self.tax_sale_copy.id + self.test_move.action_post() + self.assertEqual(tax_line.tax_line_id.id, self.tax_sale_copy.id) + self.assertEqual( + tax_line.tax_repartition_line_id.tax_id.id, self.tax_sale_copy.id + ) def test_tax_not_edited(self): """In this case we set the tax_repartition_line_id field, simulating that the move came from an invoice with tax applied. Thus, tax_line_id should be computed""" - line1 = self.move.line_ids[1] - line1.tax_repartition_line_id = self.tax15.invoice_repartition_line_ids[1] - self.assertEqual(line1.tax_line_id.id, self.tax15.id) + tax_line = self.test_move.line_ids.filtered( + lambda x: x.account_id == self.account_tax_sale + ) + tax_line.tax_line_id = self.tax_sale_copy.id + tax_line.tax_repartition_line_id = ( + self.tax_sale_copy.invoice_repartition_line_ids[1] + ) + self.assertEqual(tax_line.tax_line_id.id, self.tax_sale_copy.id) diff --git a/account_move_line_tax_editable/views/account_move.xml b/account_move_line_tax_editable/views/account_move.xml index 2d4fcb9a2..b42b05372 100644 --- a/account_move_line_tax_editable/views/account_move.xml +++ b/account_move_line_tax_editable/views/account_move.xml @@ -1,5 +1,6 @@ @@ -8,14 +9,28 @@ - + + 0 + {'readonly': [('is_tax_editable', '=', False)]} + hide + + + diff --git a/account_move_line_tax_editable/views/account_move_line.xml b/account_move_line_tax_editable/views/account_move_line.xml deleted file mode 100644 index c9e45f6c5..000000000 --- a/account_move_line_tax_editable/views/account_move_line.xml +++ /dev/null @@ -1,29 +0,0 @@ - - - - - account.move.line.form (in account_move_line_tax_editable) - account.move.line - - - - - - - 0 - {'readonly': [('is_tax_editable', '=', False)]} - - - 0 - {'readonly': [('is_tax_editable', '=', False)]} - - - -