diff --git a/account_invoice_blocking/README.rst b/account_invoice_blocking/README.rst new file mode 100644 index 00000000000..9bba9a892f6 --- /dev/null +++ b/account_invoice_blocking/README.rst @@ -0,0 +1,88 @@ +======================== +Account Invoice Blocking +======================== + +.. !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + !! 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--invoicing-lightgray.png?logo=github + :target: https://github.com/OCA/account-invoicing/tree/14.0/account_invoice_blocking + :alt: OCA/account-invoicing +.. |badge4| image:: https://img.shields.io/badge/weblate-Translate%20me-F47D42.png + :target: https://translation.odoo-community.org/projects/account-invoicing-14-0/account-invoicing-14-0-account_invoice_blocking + :alt: Translate me on Weblate +.. |badge5| image:: https://img.shields.io/badge/runbot-Try%20me-875A7B.png + :target: https://runbot.odoo-community.org/runbot/95/14.0 + :alt: Try me on Runbot + +|badge1| |badge2| |badge3| |badge4| |badge5| + +This module allows the user to set a blocking (No Follow-up) flag directly on the invoice. This facilitates the blocking of the invoice's move lines. + +**Table of contents** + +.. contents:: + :local: + +Usage +===== + +You can set the No Follow-up flag on invoices. + +Known issues / Roadmap +====================== + +Future possible improvement : +Blocking invoice can also mean "do not send overdue reminders", so the blocking flag could be displayed on both supplier and customer invoices. + +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 +~~~~~~~~~~~~ + +* Adrien Peiffer +* Stéphane Bidoul +* Thomas Binsfeld +* Andrea Stirpe +* Nikul Chaudhary + +Maintainers +~~~~~~~~~~~ + +This module is maintained by the OCA. + +.. image:: https://odoo-community.org/logo.png + :alt: Odoo Community Association + :target: https://odoo-community.org + +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-invoicing `_ project on GitHub. + +You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute. diff --git a/account_invoice_blocking/__init__.py b/account_invoice_blocking/__init__.py new file mode 100644 index 00000000000..31660d6a965 --- /dev/null +++ b/account_invoice_blocking/__init__.py @@ -0,0 +1,3 @@ +# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl). + +from . import models diff --git a/account_invoice_blocking/__manifest__.py b/account_invoice_blocking/__manifest__.py new file mode 100644 index 00000000000..e14f6f4963d --- /dev/null +++ b/account_invoice_blocking/__manifest__.py @@ -0,0 +1,14 @@ +# Copyright 2016 Acsone SA/NV +# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl). + +{ + "name": "Account Invoice Blocking", + "summary": "Set a blocking (No Follow-up) flag on invoices", + "version": "15.0.1.0.1", + "license": "AGPL-3", + "category": "Accounting", + "author": "Acsone SA/NV,Odoo Community Association (OCA)", + "website": "https://github.com/OCA/account-invoicing", + "depends": ["account"], + "data": ["views/account_move.xml"], +} diff --git a/account_invoice_blocking/i18n/account_invoice_blocking.pot b/account_invoice_blocking/i18n/account_invoice_blocking.pot new file mode 100644 index 00000000000..93ed04fdf41 --- /dev/null +++ b/account_invoice_blocking/i18n/account_invoice_blocking.pot @@ -0,0 +1,41 @@ +# Translation of Odoo Server. +# This file contains the translation of the following modules: +# * account_invoice_blocking +# +msgid "" +msgstr "" +"Project-Id-Version: Odoo Server 14.0\n" +"Report-Msgid-Bugs-To: \n" +"Last-Translator: \n" +"Language-Team: \n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: \n" +"Plural-Forms: \n" + +#. module: account_invoice_blocking +#: model:ir.model.fields,field_description:account_invoice_blocking.field_account_move__display_name +msgid "Display Name" +msgstr "" + +#. module: account_invoice_blocking +#: model:ir.model.fields,field_description:account_invoice_blocking.field_account_move__id +msgid "ID" +msgstr "" + +#. module: account_invoice_blocking +#: model:ir.model,name:account_invoice_blocking.model_account_move +msgid "Journal Entry" +msgstr "" + +#. module: account_invoice_blocking +#: model:ir.model.fields,field_description:account_invoice_blocking.field_account_move____last_update +msgid "Last Modified on" +msgstr "" + +#. module: account_invoice_blocking +#: model:ir.model.fields,field_description:account_invoice_blocking.field_account_bank_statement_line__blocked +#: model:ir.model.fields,field_description:account_invoice_blocking.field_account_move__blocked +#: model:ir.model.fields,field_description:account_invoice_blocking.field_account_payment__blocked +msgid "No Follow-up" +msgstr "" diff --git a/account_invoice_blocking/i18n/de.po b/account_invoice_blocking/i18n/de.po new file mode 100644 index 00000000000..cf9db85bf19 --- /dev/null +++ b/account_invoice_blocking/i18n/de.po @@ -0,0 +1,38 @@ +# Translation of Odoo Server. +# This file contains the translation of the following modules: +# * account_invoice_blocking +# +msgid "" +msgstr "" +"Project-Id-Version: Odoo Server 12.0\n" +"Report-Msgid-Bugs-To: \n" +"PO-Revision-Date: 2020-06-12 13:19+0000\n" +"Last-Translator: Maria Sparenberg \n" +"Language-Team: none\n" +"Language: de\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: \n" +"Plural-Forms: nplurals=2; plural=n != 1;\n" +"X-Generator: Weblate 3.10\n" + +#. module: account_invoice_blocking +#: model:ir.model.fields,field_description:account_invoice_blocking.field_account_invoice__draft_blocked +msgid "Draft Blocked" +msgstr "Entwurf blockiert" + +#. module: account_invoice_blocking +#: model:ir.model,name:account_invoice_blocking.model_account_invoice +msgid "Invoice" +msgstr "Rechnung" + +#. module: account_invoice_blocking +#: model:ir.model.fields,field_description:account_invoice_blocking.field_account_invoice__blocked +#: model_terms:ir.ui.view,arch_db:account_invoice_blocking.account_invoice_form_view +msgid "No Follow-up" +msgstr "" + +#. module: account_invoice_blocking +#: model:ir.model.fields,help:account_invoice_blocking.field_account_invoice__draft_blocked +msgid "This flag facilitates the blocking of the invoice's move lines." +msgstr "" diff --git a/account_invoice_blocking/i18n/es.po b/account_invoice_blocking/i18n/es.po new file mode 100644 index 00000000000..ec16713aac4 --- /dev/null +++ b/account_invoice_blocking/i18n/es.po @@ -0,0 +1,38 @@ +# Translation of Odoo Server. +# This file contains the translation of the following modules: +# * account_invoice_blocking +# +msgid "" +msgstr "" +"Project-Id-Version: Odoo Server 12.0\n" +"Report-Msgid-Bugs-To: \n" +"PO-Revision-Date: 2021-03-11 13:45+0000\n" +"Last-Translator: Ana Suárez \n" +"Language-Team: none\n" +"Language: es\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: \n" +"Plural-Forms: nplurals=2; plural=n != 1;\n" +"X-Generator: Weblate 4.3.2\n" + +#. module: account_invoice_blocking +#: model:ir.model.fields,field_description:account_invoice_blocking.field_account_invoice__draft_blocked +msgid "Draft Blocked" +msgstr "Bloqueado Borrador" + +#. module: account_invoice_blocking +#: model:ir.model,name:account_invoice_blocking.model_account_invoice +msgid "Invoice" +msgstr "Factura" + +#. module: account_invoice_blocking +#: model:ir.model.fields,field_description:account_invoice_blocking.field_account_invoice__blocked +#: model_terms:ir.ui.view,arch_db:account_invoice_blocking.account_invoice_form_view +msgid "No Follow-up" +msgstr "Sin seguimiento" + +#. module: account_invoice_blocking +#: model:ir.model.fields,help:account_invoice_blocking.field_account_invoice__draft_blocked +msgid "This flag facilitates the blocking of the invoice's move lines." +msgstr "" diff --git a/account_invoice_blocking/i18n/hr.po b/account_invoice_blocking/i18n/hr.po new file mode 100644 index 00000000000..eaded1aac63 --- /dev/null +++ b/account_invoice_blocking/i18n/hr.po @@ -0,0 +1,39 @@ +# Translation of Odoo Server. +# This file contains the translation of the following modules: +# * account_invoice_blocking +# +msgid "" +msgstr "" +"Project-Id-Version: Odoo Server 12.0\n" +"Report-Msgid-Bugs-To: \n" +"PO-Revision-Date: 2020-03-05 16:13+0000\n" +"Last-Translator: Bole \n" +"Language-Team: none\n" +"Language: hr\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: \n" +"Plural-Forms: nplurals=3; plural=n%10==1 && n%100!=11 ? 0 : n%10>=2 && n%10<=" +"4 && (n%100<10 || n%100>=20) ? 1 : 2;\n" +"X-Generator: Weblate 3.10\n" + +#. module: account_invoice_blocking +#: model:ir.model.fields,field_description:account_invoice_blocking.field_account_invoice__draft_blocked +msgid "Draft Blocked" +msgstr "Nacrt blokiran" + +#. module: account_invoice_blocking +#: model:ir.model,name:account_invoice_blocking.model_account_invoice +msgid "Invoice" +msgstr "Račun" + +#. module: account_invoice_blocking +#: model:ir.model.fields,field_description:account_invoice_blocking.field_account_invoice__blocked +#: model_terms:ir.ui.view,arch_db:account_invoice_blocking.account_invoice_form_view +msgid "No Follow-up" +msgstr "" + +#. module: account_invoice_blocking +#: model:ir.model.fields,help:account_invoice_blocking.field_account_invoice__draft_blocked +msgid "This flag facilitates the blocking of the invoice's move lines." +msgstr "" diff --git a/account_invoice_blocking/i18n/nl.po b/account_invoice_blocking/i18n/nl.po new file mode 100644 index 00000000000..2d8ce6d2c85 --- /dev/null +++ b/account_invoice_blocking/i18n/nl.po @@ -0,0 +1,39 @@ +# Translation of Odoo Server. +# This file contains the translation of the following modules: +# * account_invoice_blocking +# +msgid "" +msgstr "" +"Project-Id-Version: Odoo Server 11.0\n" +"Report-Msgid-Bugs-To: \n" +"PO-Revision-Date: 2018-12-14 10:58+0000\n" +"Last-Translator: Yung-Wa \n" +"Language-Team: none\n" +"Language: nl\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: \n" +"Plural-Forms: nplurals=2; plural=n != 1;\n" +"X-Generator: Weblate 3.3\n" + +#. module: account_invoice_blocking +#: model:ir.model.fields,field_description:account_invoice_blocking.field_account_invoice__draft_blocked +msgid "Draft Blocked" +msgstr "" + +#. module: account_invoice_blocking +#: model:ir.model,name:account_invoice_blocking.model_account_invoice +msgid "Invoice" +msgstr "Factuur" + +#. module: account_invoice_blocking +#: model:ir.model.fields,field_description:account_invoice_blocking.field_account_invoice__blocked +#: model_terms:ir.ui.view,arch_db:account_invoice_blocking.account_invoice_form_view +msgid "No Follow-up" +msgstr "Geen opvolging" + +#. module: account_invoice_blocking +#: model:ir.model.fields,help:account_invoice_blocking.field_account_invoice__draft_blocked +msgid "This flag facilitates the blocking of the invoice's move lines." +msgstr "" +"De optie maakt het mogelijk om factuuregels uit te sluiten van opvolging." diff --git a/account_invoice_blocking/i18n/pt.po b/account_invoice_blocking/i18n/pt.po new file mode 100644 index 00000000000..e78dccc5010 --- /dev/null +++ b/account_invoice_blocking/i18n/pt.po @@ -0,0 +1,38 @@ +# Translation of Odoo Server. +# This file contains the translation of the following modules: +# * account_invoice_blocking +# +msgid "" +msgstr "" +"Project-Id-Version: Odoo Server 12.0\n" +"Report-Msgid-Bugs-To: \n" +"PO-Revision-Date: 2021-03-15 21:45+0000\n" +"Last-Translator: Pedro Castro Silva \n" +"Language-Team: none\n" +"Language: pt\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: \n" +"Plural-Forms: nplurals=2; plural=n > 1;\n" +"X-Generator: Weblate 4.3.2\n" + +#. module: account_invoice_blocking +#: model:ir.model.fields,field_description:account_invoice_blocking.field_account_invoice__draft_blocked +msgid "Draft Blocked" +msgstr "Rascunho Bloqueado" + +#. module: account_invoice_blocking +#: model:ir.model,name:account_invoice_blocking.model_account_invoice +msgid "Invoice" +msgstr "Fatura" + +#. module: account_invoice_blocking +#: model:ir.model.fields,field_description:account_invoice_blocking.field_account_invoice__blocked +#: model_terms:ir.ui.view,arch_db:account_invoice_blocking.account_invoice_form_view +msgid "No Follow-up" +msgstr "Sem Seguimento" + +#. module: account_invoice_blocking +#: model:ir.model.fields,help:account_invoice_blocking.field_account_invoice__draft_blocked +msgid "This flag facilitates the blocking of the invoice's move lines." +msgstr "Esta flag facilita o bloqueio das linhas de movimentos da fatura." diff --git a/account_invoice_blocking/i18n/pt_BR.po b/account_invoice_blocking/i18n/pt_BR.po new file mode 100644 index 00000000000..8c7e9a9ec4d --- /dev/null +++ b/account_invoice_blocking/i18n/pt_BR.po @@ -0,0 +1,36 @@ +# Translation of Odoo Server. +# This file contains the translation of the following modules: +# * account_invoice_blocking +# +msgid "" +msgstr "" +"Project-Id-Version: Odoo Server 12.0\n" +"Report-Msgid-Bugs-To: \n" +"Last-Translator: Automatically generated\n" +"Language-Team: none\n" +"Language: pt_BR\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: \n" +"Plural-Forms: nplurals=2; plural=n > 1;\n" + +#. module: account_invoice_blocking +#: model:ir.model.fields,field_description:account_invoice_blocking.field_account_invoice__draft_blocked +msgid "Draft Blocked" +msgstr "" + +#. module: account_invoice_blocking +#: model:ir.model,name:account_invoice_blocking.model_account_invoice +msgid "Invoice" +msgstr "" + +#. module: account_invoice_blocking +#: model:ir.model.fields,field_description:account_invoice_blocking.field_account_invoice__blocked +#: model_terms:ir.ui.view,arch_db:account_invoice_blocking.account_invoice_form_view +msgid "No Follow-up" +msgstr "" + +#. module: account_invoice_blocking +#: model:ir.model.fields,help:account_invoice_blocking.field_account_invoice__draft_blocked +msgid "This flag facilitates the blocking of the invoice's move lines." +msgstr "" diff --git a/account_invoice_blocking/models/__init__.py b/account_invoice_blocking/models/__init__.py new file mode 100644 index 00000000000..0c439503ce7 --- /dev/null +++ b/account_invoice_blocking/models/__init__.py @@ -0,0 +1,3 @@ +# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl). + +from . import account_move diff --git a/account_invoice_blocking/models/account_move.py b/account_invoice_blocking/models/account_move.py new file mode 100644 index 00000000000..954aa68b9e6 --- /dev/null +++ b/account_invoice_blocking/models/account_move.py @@ -0,0 +1,58 @@ +# Copyright 2016 Acsone SA/NV +# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl). + +from odoo import api, fields, models + + +class AccountMove(models.Model): + _inherit = "account.move" + + blocked = fields.Boolean( + "No Follow-up", + states={"draft": [("readonly", True)]}, + compute="_compute_move_blocked", + inverse="_inverse_move_blocked", + ) + + def _get_move_line(self): + """ + This method searches for payable or receivable move line + of the invoice + :returns payable or receivable move line of the invoice + """ + self.ensure_one() + type_receivable = self.env.ref("account.data_account_type_receivable") + type_payable = self.env.ref("account.data_account_type_payable") + user_type = type_receivable | type_payable + return self.line_ids.filtered(lambda r: r.account_id.user_type_id in user_type) + + def _update_blocked(self, value): + """ + This method updates the boolean field 'blocked' of the move line + of the passed invoice with the passed value + :param value: value to set to the 'blocked' field of the move line + """ + self.ensure_one() + move_line_ids = self._get_move_line() + move_line_ids.write({"blocked": value}) + + def _inverse_move_blocked(self): + """ + Inverse method of the computed field 'blocked' + This method calls the update of the invoice's move line based on + the value of the field 'blocked' + """ + for invoice in self: + invoice._update_blocked(invoice.blocked) + + @api.depends("line_ids", "line_ids.blocked") + def _compute_move_blocked(self): + """ + This method set the value of the field 'blocked' to True + If every line of the move is actually blocked + """ + for move in self: + move_lines = move._get_move_line() + move.blocked = ( + all(line.blocked for line in move_lines) if move_lines else False + ) diff --git a/account_invoice_blocking/readme/CONTRIBUTORS.rst b/account_invoice_blocking/readme/CONTRIBUTORS.rst new file mode 100644 index 00000000000..28ba9076514 --- /dev/null +++ b/account_invoice_blocking/readme/CONTRIBUTORS.rst @@ -0,0 +1,5 @@ +* Adrien Peiffer +* Stéphane Bidoul +* Thomas Binsfeld +* Andrea Stirpe +* Nikul Chaudhary diff --git a/account_invoice_blocking/readme/DESCRIPTION.rst b/account_invoice_blocking/readme/DESCRIPTION.rst new file mode 100644 index 00000000000..e7be7a8b188 --- /dev/null +++ b/account_invoice_blocking/readme/DESCRIPTION.rst @@ -0,0 +1 @@ +This module allows the user to set a blocking (No Follow-up) flag directly on the invoice. This facilitates the blocking of the invoice's move lines. diff --git a/account_invoice_blocking/readme/ROADMAP.rst b/account_invoice_blocking/readme/ROADMAP.rst new file mode 100644 index 00000000000..d52b228a8ef --- /dev/null +++ b/account_invoice_blocking/readme/ROADMAP.rst @@ -0,0 +1,2 @@ +Future possible improvement : +Blocking invoice can also mean "do not send overdue reminders", so the blocking flag could be displayed on both supplier and customer invoices. diff --git a/account_invoice_blocking/readme/USAGE.rst b/account_invoice_blocking/readme/USAGE.rst new file mode 100644 index 00000000000..5221008d3c7 --- /dev/null +++ b/account_invoice_blocking/readme/USAGE.rst @@ -0,0 +1 @@ +You can set the No Follow-up flag on invoices. diff --git a/account_invoice_blocking/static/description/icon.png b/account_invoice_blocking/static/description/icon.png new file mode 100644 index 00000000000..3a0328b516c Binary files /dev/null and b/account_invoice_blocking/static/description/icon.png differ diff --git a/account_invoice_blocking/static/description/index.html b/account_invoice_blocking/static/description/index.html new file mode 100644 index 00000000000..95cf426aa74 --- /dev/null +++ b/account_invoice_blocking/static/description/index.html @@ -0,0 +1,434 @@ + + + + + + +Account Invoice Blocking + + + +
+

Account Invoice Blocking

+ + +

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

+

This module allows the user to set a blocking (No Follow-up) flag directly on the invoice. This facilitates the blocking of the invoice’s move lines.

+

Table of contents

+ +
+

Usage

+

You can set the No Follow-up flag on invoices.

+
+
+

Known issues / Roadmap

+

Future possible improvement : +Blocking invoice can also mean “do not send overdue reminders”, so the blocking flag could be displayed on both supplier and customer invoices.

+
+
+

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-invoicing project on GitHub.

+

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

+
+
+
+ + diff --git a/account_invoice_blocking/tests/__init__.py b/account_invoice_blocking/tests/__init__.py new file mode 100644 index 00000000000..106d4590e8e --- /dev/null +++ b/account_invoice_blocking/tests/__init__.py @@ -0,0 +1 @@ +from . import test_account_move_blocking diff --git a/account_invoice_blocking/tests/test_account_move_blocking.py b/account_invoice_blocking/tests/test_account_move_blocking.py new file mode 100644 index 00000000000..255c117fe6d --- /dev/null +++ b/account_invoice_blocking/tests/test_account_move_blocking.py @@ -0,0 +1,47 @@ +# Copyright 2016 Acsone SA/NV +# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl). + +from odoo.tests import tagged + +from odoo.addons.account.tests.common import AccountTestInvoicingCommon + + +@tagged("post_install", "-at_install") +class TestAccountMoveBlocking(AccountTestInvoicingCommon): + @classmethod + def setUpClass(cls, chart_template_ref=None): + super().setUpClass(chart_template_ref=chart_template_ref) + cls.in_invoice = cls.init_invoice( + "in_invoice", products=cls.product_a + cls.product_b + ) + cls.in_invoice._post() + cls.out_invoice = cls.init_invoice( + "out_invoice", products=cls.product_a + cls.product_b + ) + cls.out_invoice._post() + + def test_in_invoice_blocking(self): + self.assertFalse(self.in_invoice.blocked) + line = self.in_invoice.line_ids.filtered( + lambda r: r.account_id.user_type_id + == self.env.ref("account.data_account_type_payable") + ) + self.assertTrue(line) + self.assertFalse(line.blocked) + self.assertFalse(any(il.blocked for il in (self.in_invoice.line_ids - line))) + self.in_invoice.blocked = True + self.assertTrue(line.blocked) + self.assertFalse(any(il.blocked for il in (self.in_invoice.line_ids - line))) + + def test_out_invoice_blocking(self): + self.assertFalse(self.out_invoice.blocked) + line = self.out_invoice.line_ids.filtered( + lambda r: r.account_id.user_type_id + == self.env.ref("account.data_account_type_receivable") + ) + self.assertTrue(line) + self.assertFalse(line.blocked) + self.assertFalse(any(il.blocked for il in (self.out_invoice.line_ids - line))) + self.out_invoice.blocked = True + self.assertTrue(line.blocked) + self.assertFalse(any(il.blocked for il in (self.out_invoice.line_ids - line))) diff --git a/account_invoice_blocking/views/account_move.xml b/account_invoice_blocking/views/account_move.xml new file mode 100644 index 00000000000..e9a559accab --- /dev/null +++ b/account_invoice_blocking/views/account_move.xml @@ -0,0 +1,14 @@ + + + + + account.move + + + + + + + + diff --git a/setup/account_invoice_blocking/odoo/addons/account_invoice_blocking b/setup/account_invoice_blocking/odoo/addons/account_invoice_blocking new file mode 120000 index 00000000000..f2b4d02fb4a --- /dev/null +++ b/setup/account_invoice_blocking/odoo/addons/account_invoice_blocking @@ -0,0 +1 @@ +../../../../account_invoice_blocking \ No newline at end of file diff --git a/setup/account_invoice_blocking/setup.py b/setup/account_invoice_blocking/setup.py new file mode 100644 index 00000000000..28c57bb6403 --- /dev/null +++ b/setup/account_invoice_blocking/setup.py @@ -0,0 +1,6 @@ +import setuptools + +setuptools.setup( + setup_requires=['setuptools-odoo'], + odoo_addon=True, +)