From 6ad16fdcd3784606b248aeacabf482d9a9073cbe Mon Sep 17 00:00:00 2001 From: ernesto Date: Thu, 25 Apr 2019 10:57:45 -0400 Subject: [PATCH] [MIG] account_move_line_tax_editable: Migration to 12.0 --- account_move_line_tax_editable/README.rst | 67 ++- .../__manifest__.py | 4 +- .../i18n/account_move_line_tax_editable.pot | 4 +- account_move_line_tax_editable/i18n/de.po | 2 +- account_move_line_tax_editable/i18n/es_EC.po | 2 +- account_move_line_tax_editable/i18n/fr.po | 2 +- account_move_line_tax_editable/i18n/hr.po | 2 +- account_move_line_tax_editable/i18n/tr_TR.po | 2 +- .../models/account_move_line.py | 7 +- .../readme/CONTRIBUTORS.rst | 6 + .../readme/DESCRIPTION.rst | 1 + .../static/description/index.html | 424 ++++++++++++++++++ .../tests/__init__.py | 1 + .../test_account_move_line_tax_editable.py | 57 +++ .../views/account_move.xml | 2 +- .../views/account_move_line.xml | 2 +- 16 files changed, 551 insertions(+), 34 deletions(-) create mode 100644 account_move_line_tax_editable/readme/CONTRIBUTORS.rst create mode 100644 account_move_line_tax_editable/readme/DESCRIPTION.rst create mode 100644 account_move_line_tax_editable/static/description/index.html create mode 100644 account_move_line_tax_editable/tests/__init__.py create mode 100644 account_move_line_tax_editable/tests/test_account_move_line_tax_editable.py diff --git a/account_move_line_tax_editable/README.rst b/account_move_line_tax_editable/README.rst index b0986704..fc544edd 100644 --- a/account_move_line_tax_editable/README.rst +++ b/account_move_line_tax_editable/README.rst @@ -1,45 +1,78 @@ -.. image:: https://img.shields.io/badge/license-AGPL--3-blue.png - :target: https://www.gnu.org/licenses/agpl - :alt: License: AGPL-3 - ============================== Account Move Line Tax Editable ============================== +.. !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + !! This file is generated by oca-gen-addon-readme !! + !! changes will be overwritten. !! + !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + +.. |badge1| image:: https://img.shields.io/badge/maturity-Beta-yellow.png + :target: https://odoo-community.org/page/development-status + :alt: Beta +.. |badge2| image:: https://img.shields.io/badge/licence-AGPL--3-blue.png + :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/12.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-12-0/account-financial-tools-12-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/12.0 + :alt: Try me on Runbot + +|badge1| |badge2| |badge3| |badge4| |badge5| + Allows to edit taxes on account move lines -.. image:: https://odoo-community.org/website/image/ir.attachment/5784_f2813bd/datas - :alt: Try me on Runbot - :target: https://runbot.odoo-community.org/runbot/92/11.0 +**Table of contents** + +.. contents:: + :local: 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. +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 `_. + +Do not contact contributors directly about support or help with technical issues. Credits ======= +Authors +~~~~~~~ + +* ACSONE SA/NV + Contributors ------------- +~~~~~~~~~~~~ * Thomas Binsfeld * Benjamin Willig -Maintainer ----------- +* `Tecnativa `_: + + * Ernesto Tejeda + +Maintainers +~~~~~~~~~~~ + +This module is maintained by the OCA. .. image:: https://odoo-community.org/logo.png :alt: Odoo Community Association :target: https://odoo-community.org -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. -To contribute to this module, please visit https://odoo-community.org. +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 eeea220c..5816763f 100644 --- a/account_move_line_tax_editable/__manifest__.py +++ b/account_move_line_tax_editable/__manifest__.py @@ -5,10 +5,10 @@ 'name': 'Account Move Line Tax Editable', 'summary': """ Allows to edit taxes on non-posted account move lines""", - 'version': '11.0.1.0.0', + 'version': '12.0.1.0.0', 'license': 'AGPL-3', 'author': 'ACSONE SA/NV,Odoo Community Association (OCA)', - 'website': 'https://www.acsone.eu', + 'website': 'https://github.com/OCA/account-financial-tools', 'depends': [ 'account', ], 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 a8d486b3..0aecf744 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 11.0\n" +"Project-Id-Version: Odoo Server 12.0\n" "Report-Msgid-Bugs-To: \n" "Last-Translator: <>\n" "Language-Team: \n" @@ -14,7 +14,7 @@ msgstr "" "Plural-Forms: \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 +#: model:ir.model.fields,field_description:account_move_line_tax_editable.field_account_move_line__is_tax_editable msgid "Is tax data editable?" msgstr "" diff --git a/account_move_line_tax_editable/i18n/de.po b/account_move_line_tax_editable/i18n/de.po index b1b47415..c6e85744 100644 --- a/account_move_line_tax_editable/i18n/de.po +++ b/account_move_line_tax_editable/i18n/de.po @@ -20,7 +20,7 @@ msgstr "" "X-Generator: Weblate 3.1.1\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 +#: model:ir.model.fields,field_description:account_move_line_tax_editable.field_account_move_line__is_tax_editable msgid "Is tax data editable?" msgstr "Sind Steuerdaten änderbar?" diff --git a/account_move_line_tax_editable/i18n/es_EC.po b/account_move_line_tax_editable/i18n/es_EC.po index 1bb13470..0a9154d9 100644 --- a/account_move_line_tax_editable/i18n/es_EC.po +++ b/account_move_line_tax_editable/i18n/es_EC.po @@ -20,7 +20,7 @@ msgstr "" "Plural-Forms: nplurals=2; plural=(n != 1);\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 +#: model:ir.model.fields,field_description:account_move_line_tax_editable.field_account_move_line__is_tax_editable msgid "Is tax data editable?" msgstr "" diff --git a/account_move_line_tax_editable/i18n/fr.po b/account_move_line_tax_editable/i18n/fr.po index 6ac4879a..6c6a9b2f 100644 --- a/account_move_line_tax_editable/i18n/fr.po +++ b/account_move_line_tax_editable/i18n/fr.po @@ -19,7 +19,7 @@ msgstr "" "Plural-Forms: nplurals=2; plural=(n > 1);\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 +#: model:ir.model.fields,field_description:account_move_line_tax_editable.field_account_move_line__is_tax_editable msgid "Is tax data editable?" msgstr "Les données de la taxe sont-elles éditables ?" diff --git a/account_move_line_tax_editable/i18n/hr.po b/account_move_line_tax_editable/i18n/hr.po index ca712e87..9e421268 100644 --- a/account_move_line_tax_editable/i18n/hr.po +++ b/account_move_line_tax_editable/i18n/hr.po @@ -20,7 +20,7 @@ msgstr "" "%10<=4 && (n%100<10 || n%100>=20) ? 1 : 2;\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 +#: model:ir.model.fields,field_description:account_move_line_tax_editable.field_account_move_line__is_tax_editable msgid "Is tax data editable?" msgstr "" diff --git a/account_move_line_tax_editable/i18n/tr_TR.po b/account_move_line_tax_editable/i18n/tr_TR.po index 8b8cfb2d..70fe5266 100644 --- a/account_move_line_tax_editable/i18n/tr_TR.po +++ b/account_move_line_tax_editable/i18n/tr_TR.po @@ -20,7 +20,7 @@ msgstr "" "Plural-Forms: nplurals=1; plural=0;\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 +#: model:ir.model.fields,field_description:account_move_line_tax_editable.field_account_move_line__is_tax_editable msgid "Is tax data editable?" msgstr "" diff --git a/account_move_line_tax_editable/models/account_move_line.py b/account_move_line_tax_editable/models/account_move_line.py index dd6d328a..fe3d1fc7 100644 --- a/account_move_line_tax_editable/models/account_move_line.py +++ b/account_move_line_tax_editable/models/account_move_line.py @@ -15,9 +15,4 @@ class AccountMoveLine(models.Model): @api.depends('move_id.state') def _compute_is_tax_editable(self): for rec in self: - rec.is_tax_editable = rec._get_is_tax_editable() - - @api.multi - def _get_is_tax_editable(self): - self.ensure_one() - return self.move_id.state == 'draft' + rec.is_tax_editable = (rec.move_id.state == 'draft') diff --git a/account_move_line_tax_editable/readme/CONTRIBUTORS.rst b/account_move_line_tax_editable/readme/CONTRIBUTORS.rst new file mode 100644 index 00000000..444ee578 --- /dev/null +++ b/account_move_line_tax_editable/readme/CONTRIBUTORS.rst @@ -0,0 +1,6 @@ +* Thomas Binsfeld +* Benjamin Willig + +* `Tecnativa `_: + + * Ernesto Tejeda diff --git a/account_move_line_tax_editable/readme/DESCRIPTION.rst b/account_move_line_tax_editable/readme/DESCRIPTION.rst new file mode 100644 index 00000000..a7968283 --- /dev/null +++ b/account_move_line_tax_editable/readme/DESCRIPTION.rst @@ -0,0 +1 @@ +Allows to edit taxes on account move lines diff --git a/account_move_line_tax_editable/static/description/index.html b/account_move_line_tax_editable/static/description/index.html new file mode 100644 index 00000000..b1867951 --- /dev/null +++ b/account_move_line_tax_editable/static/description/index.html @@ -0,0 +1,424 @@ + + + + + + +Account Move Line Tax Editable + + + +
+

Account Move Line Tax Editable

+ + +

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

+ +
+

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.

+

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

+
+
+

Credits

+
+

Authors

+
    +
  • ACSONE SA/NV
  • +
+
+
+

Contributors

+ +
+
+

Maintainers

+

This module is maintained by the OCA.

+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.

+

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/__init__.py b/account_move_line_tax_editable/tests/__init__.py new file mode 100644 index 00000000..8c4b6ecb --- /dev/null +++ b/account_move_line_tax_editable/tests/__init__.py @@ -0,0 +1 @@ +from . import test_account_move_line_tax_editable 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 new file mode 100644 index 00000000..fc58339f --- /dev/null +++ b/account_move_line_tax_editable/tests/test_account_move_line_tax_editable.py @@ -0,0 +1,57 @@ +# Copyright 2019 Tecnativa - Ernesto Tejeda +# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). + +from odoo import fields +import odoo.tests.common as common + + +class TestAccountMoveLineTaxEditable(common.SavepointCase): + + @classmethod + def setUpClass(cls): + super(TestAccountMoveLineTaxEditable, cls).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 + }) + account300 = acc_obj.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', + 'debit': 0.0, + 'credit': 1000.0, + 'account_id': account300.id}), + (0, 0, { + 'name': 'move test', + 'debit': 1000.0, + 'credit': 0.0, + 'account_id': account100.id}) + ]} + cls.move = cls.env['account.move'].create(move_vals) + + def test_compute_is_tax_editable(self): + self.assertEqual(self.move.line_ids.mapped('is_tax_editable'), + [True, True]) + self.move.post() + self.assertEqual(self.move.line_ids.mapped('is_tax_editable'), + [False, False]) diff --git a/account_move_line_tax_editable/views/account_move.xml b/account_move_line_tax_editable/views/account_move.xml index 072f8081..53971b81 100644 --- a/account_move_line_tax_editable/views/account_move.xml +++ b/account_move_line_tax_editable/views/account_move.xml @@ -4,7 +4,7 @@ - + account.move.form (in account_move_line_tax_editable) account.move diff --git a/account_move_line_tax_editable/views/account_move_line.xml b/account_move_line_tax_editable/views/account_move_line.xml index 8dc439f6..a4c04681 100644 --- a/account_move_line_tax_editable/views/account_move_line.xml +++ b/account_move_line_tax_editable/views/account_move_line.xml @@ -4,7 +4,7 @@ - + account.move.line.form (in account_move_line_tax_editable) account.move.line