From 44726b34d61ee6777c8d6308f1dce0ab48d4ddd1 Mon Sep 17 00:00:00 2001 From: vrenaville Date: Mon, 15 Jun 2015 13:40:10 +0200 Subject: [PATCH 1/7] [ADD] account_invoice_tax_required --- account_invoice_tax_required/README.rst | 36 ++++++++++++++ account_invoice_tax_required/__init__.py | 20 ++++++++ account_invoice_tax_required/__openerp__.py | 31 ++++++++++++ .../i18n/account_invoice_tax_require.pot | 34 ++++++++++++++ account_invoice_tax_required/i18n/fr.po | 34 ++++++++++++++ .../models/__init__.py | 20 ++++++++ .../models/account_invoice.py | 47 +++++++++++++++++++ .../views/account_invoice_view.xml | 42 +++++++++++++++++ 8 files changed, 264 insertions(+) create mode 100644 account_invoice_tax_required/README.rst create mode 100644 account_invoice_tax_required/__init__.py create mode 100644 account_invoice_tax_required/__openerp__.py create mode 100644 account_invoice_tax_required/i18n/account_invoice_tax_require.pot create mode 100644 account_invoice_tax_required/i18n/fr.po create mode 100644 account_invoice_tax_required/models/__init__.py create mode 100644 account_invoice_tax_required/models/account_invoice.py create mode 100644 account_invoice_tax_required/views/account_invoice_view.xml diff --git a/account_invoice_tax_required/README.rst b/account_invoice_tax_required/README.rst new file mode 100644 index 000000000..6cc891cb8 --- /dev/null +++ b/account_invoice_tax_required/README.rst @@ -0,0 +1,36 @@ +Account invoices with tax required in invoice line +================================================== + +This module adds functional a check on invoice +to force user to set tax on invoice line. + + + +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 + + +Credits +======= + +Contributors +------------ + +* Vincent Renaville + +Maintainer +---------- + +.. image:: http://odoo-community.org/logo.png + :alt: Odoo Community Association + :target: http://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 http://odoo-community.org. \ No newline at end of file diff --git a/account_invoice_tax_required/__init__.py b/account_invoice_tax_required/__init__.py new file mode 100644 index 000000000..ebb9d9601 --- /dev/null +++ b/account_invoice_tax_required/__init__.py @@ -0,0 +1,20 @@ +# -*- coding: utf-8 -*- +############################################################################## +# +# Author Vincent Renaville. Copyright 2015 Camptocamp SA +# +# This program is free software: you can redistribute it and/or modify +# it under the terms of the GNU Affero General Public License as +# published by the Free Software Foundation, either version 3 of the +# License, or (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU Affero General Public License for more details. +# +# You should have received a copy of the GNU Affero General Public License +# along with this program. If not, see . +# +############################################################################## +from . import models diff --git a/account_invoice_tax_required/__openerp__.py b/account_invoice_tax_required/__openerp__.py new file mode 100644 index 000000000..bccc62998 --- /dev/null +++ b/account_invoice_tax_required/__openerp__.py @@ -0,0 +1,31 @@ +# -*- coding: utf-8 -*- +############################################################################## +# +# Author Vincent Renaville. Copyright 2015 Camptocamp SA +# +# This program is free software: you can redistribute it and/or modify +# it under the terms of the GNU Affero General Public License as +# published by the Free Software Foundation, either version 3 of the +# License, or (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU Affero General Public License for more details. +# +# You should have received a copy of the GNU Affero General Public License +# along with this program. If not, see . +# +############################################################################## +{ + 'name': "Tax required in invoice", + 'version': "1.0", + 'author': "Vincent Renaville", + 'website': "http://www.camptocamp.com", + 'category': "Localisation / Accounting", + 'license': "AGPL-3", + 'depends': ["account"], + 'data': [ + ], + 'installable': True, +} diff --git a/account_invoice_tax_required/i18n/account_invoice_tax_require.pot b/account_invoice_tax_required/i18n/account_invoice_tax_require.pot new file mode 100644 index 000000000..23c49ae89 --- /dev/null +++ b/account_invoice_tax_required/i18n/account_invoice_tax_require.pot @@ -0,0 +1,34 @@ +# Translation of Odoo Server. +# This file contains the translation of the following modules: +# * account_invoice_tax_required +# +msgid "" +msgstr "" +"Project-Id-Version: Odoo Server 8.0\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2015-06-15 11:36+0000\n" +"PO-Revision-Date: 2015-06-15 11:36+0000\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_tax_required +#: model:ir.model,name:account_invoice_tax_required.model_account_invoice +msgid "Invoice" +msgstr "" + +#. module: account_invoice_tax_required +#: code:addons/account_invoice_tax_required/models/account_invoice.py:29 +#, python-format +msgid "Invoice have a line with product %s with no taxes" +msgstr "" + +#. module: account_invoice_tax_required +#: code:addons/account_invoice_tax_required/models/account_invoice.py:39 +#, python-format +msgid "No Taxes Defined!" +msgstr "" + diff --git a/account_invoice_tax_required/i18n/fr.po b/account_invoice_tax_required/i18n/fr.po new file mode 100644 index 000000000..dc9935476 --- /dev/null +++ b/account_invoice_tax_required/i18n/fr.po @@ -0,0 +1,34 @@ +# Translation of Odoo Server. +# This file contains the translation of the following modules: +# * account_invoice_tax_required +# +msgid "" +msgstr "" +"Project-Id-Version: Odoo Server 8.0\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2015-06-15 11:36+0000\n" +"PO-Revision-Date: 2015-06-15 11:36+0000\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_tax_required +#: model:ir.model,name:account_invoice_tax_required.model_account_invoice +msgid "Invoice" +msgstr "Facture" + +#. module: account_invoice_tax_required +#: code:addons/account_invoice_tax_required/models/account_invoice.py:29 +#, python-format +msgid "Invoice have a line with product %s with no taxes" +msgstr "La facture a un produit %s sans taxe" + +#. module: account_invoice_tax_required +#: code:addons/account_invoice_tax_required/models/account_invoice.py:39 +#, python-format +msgid "No Taxes Defined!" +msgstr "Aucunes taxes définies" + diff --git a/account_invoice_tax_required/models/__init__.py b/account_invoice_tax_required/models/__init__.py new file mode 100644 index 000000000..ea7bac2d5 --- /dev/null +++ b/account_invoice_tax_required/models/__init__.py @@ -0,0 +1,20 @@ +# -*- coding: utf-8 -*- +############################################################################## +# +# Author Vincent Renaville. Copyright 2015 Camptocamp SA +# +# This program is free software: you can redistribute it and/or modify +# it under the terms of the GNU Affero General Public License as +# published by the Free Software Foundation, either version 3 of the +# License, or (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU Affero General Public License for more details. +# +# You should have received a copy of the GNU Affero General Public License +# along with this program. If not, see . +# +############################################################################## +from . import account_invoice diff --git a/account_invoice_tax_required/models/account_invoice.py b/account_invoice_tax_required/models/account_invoice.py new file mode 100644 index 000000000..9ffbd15d2 --- /dev/null +++ b/account_invoice_tax_required/models/account_invoice.py @@ -0,0 +1,47 @@ +# -*- coding: utf-8 -*- +############################################################################## +# +# Author Vincent Renaville. Copyright 2015 Camptocamp SA +# +# This program is free software: you can redistribute it and/or modify +# it under the terms of the GNU Affero General Public License as +# published by the Free Software Foundation, either version 3 of the +# License, or (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU Affero General Public License for more details. +# +# You should have received a copy of the GNU Affero General Public License +# along with this program. If not, see . +# +############################################################################## +from openerp import models, api, _ +from openerp.exceptions import except_orm + +class AccountInvoice(models.Model): + _inherit = "account.invoice" + + @api.multi + def test_invoice_line_tax(self): + errors = [] + error_template = _("Invoice have a line with product %s with no taxes") + # check whether all corresponding account move lines are reconciled + for invoice in self: + for invoice_line in invoice.invoice_line: + # + if not invoice_line.invoice_line_tax_id: + error_string = error_template % (invoice_line.name) + errors.append(error_string) + if errors: + errors_full_string = ','.join(x for x in errors) + raise except_orm(_('No Taxes Defined!'), errors_full_string) + else: + return True + + @api.multi + def invoice_validate(self): + self.test_invoice_line_tax() + res = super(AccountInvoice, self).invoice_validate() + return res diff --git a/account_invoice_tax_required/views/account_invoice_view.xml b/account_invoice_tax_required/views/account_invoice_view.xml new file mode 100644 index 000000000..7bd743f64 --- /dev/null +++ b/account_invoice_tax_required/views/account_invoice_view.xml @@ -0,0 +1,42 @@ + + + + + + + + + Account invoice supplier (form) - add company currency + account.invoice + + + + + + + + + + + + + + + Account invoice (form) - add company currency + account.invoice + + + + + + + + + + + + + + From 31cbecf51198b894aef56580dd53db1a5d849198 Mon Sep 17 00:00:00 2001 From: vrenaville Date: Tue, 16 Jun 2015 16:22:47 +0200 Subject: [PATCH 2/7] [FIX] remove deprecated code + add contributor + issue tracking --- account_invoice_tax_required/README.rst | 12 ++++++++++-- account_invoice_tax_required/__openerp__.py | 2 +- .../models/account_invoice.py | 9 ++++----- 3 files changed, 15 insertions(+), 8 deletions(-) diff --git a/account_invoice_tax_required/README.rst b/account_invoice_tax_required/README.rst index 6cc891cb8..11f3cdfff 100644 --- a/account_invoice_tax_required/README.rst +++ b/account_invoice_tax_required/README.rst @@ -1,4 +1,4 @@ -Account invoices with tax required in invoice line +Account invoice with tax required in invoice line ================================================== This module adds functional a check on invoice @@ -33,4 +33,12 @@ 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 http://odoo-community.org. \ No newline at end of file +To contribute to this module, please visit http://odoo-community.org. + +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 +`here `_. diff --git a/account_invoice_tax_required/__openerp__.py b/account_invoice_tax_required/__openerp__.py index bccc62998..2a23a5cad 100644 --- a/account_invoice_tax_required/__openerp__.py +++ b/account_invoice_tax_required/__openerp__.py @@ -20,7 +20,7 @@ { 'name': "Tax required in invoice", 'version': "1.0", - 'author': "Vincent Renaville", + "author": "Camptocamp,Odoo Community Association (OCA)", 'website': "http://www.camptocamp.com", 'category': "Localisation / Accounting", 'license': "AGPL-3", diff --git a/account_invoice_tax_required/models/account_invoice.py b/account_invoice_tax_required/models/account_invoice.py index 9ffbd15d2..44b0f06ba 100644 --- a/account_invoice_tax_required/models/account_invoice.py +++ b/account_invoice_tax_required/models/account_invoice.py @@ -17,8 +17,8 @@ # along with this program. If not, see . # ############################################################################## -from openerp import models, api, _ -from openerp.exceptions import except_orm +from openerp import models, api, exceptions, _ + class AccountInvoice(models.Model): _inherit = "account.invoice" @@ -27,16 +27,15 @@ class AccountInvoice(models.Model): def test_invoice_line_tax(self): errors = [] error_template = _("Invoice have a line with product %s with no taxes") - # check whether all corresponding account move lines are reconciled for invoice in self: for invoice_line in invoice.invoice_line: - # if not invoice_line.invoice_line_tax_id: error_string = error_template % (invoice_line.name) errors.append(error_string) if errors: errors_full_string = ','.join(x for x in errors) - raise except_orm(_('No Taxes Defined!'), errors_full_string) + raise exceptions.Warning(_('No Taxes Defined!'), + errors_full_string) else: return True From 88aacb47595228eb410b7cf5c59d17156dbe8b4d Mon Sep 17 00:00:00 2001 From: vrenaville Date: Tue, 16 Jun 2015 17:03:20 +0200 Subject: [PATCH 3/7] [FIX] Tracker link --- account_invoice_tax_required/README.rst | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-) diff --git a/account_invoice_tax_required/README.rst b/account_invoice_tax_required/README.rst index 11f3cdfff..43608c04f 100644 --- a/account_invoice_tax_required/README.rst +++ b/account_invoice_tax_required/README.rst @@ -9,9 +9,10 @@ to force user to set tax on invoice line. Bug Tracker =========== -Bugs are tracked on `GitHub Issues `_. +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 +`here `_. Credits @@ -35,10 +36,3 @@ OCA, or the Odoo Community Association, is a nonprofit organization whose missio To contribute to this module, please visit http://odoo-community.org. -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 -`here `_. From 4324c0db0a698bb3488c9efd9070875dfba6c892 Mon Sep 17 00:00:00 2001 From: vrenaville Date: Wed, 17 Jun 2015 08:45:41 +0200 Subject: [PATCH 4/7] [FIX] replace {} variable --- account_invoice_tax_required/README.rst | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/account_invoice_tax_required/README.rst b/account_invoice_tax_required/README.rst index 43608c04f..ddf3c3336 100644 --- a/account_invoice_tax_required/README.rst +++ b/account_invoice_tax_required/README.rst @@ -9,10 +9,10 @@ to force user to set tax on invoice line. Bug Tracker =========== -Bugs are tracked on `GitHub Issues `_. +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 -`here `_. +`here `_. Credits From d5c0c53e47344e9cc5533d224eccd45b63538b7c Mon Sep 17 00:00:00 2001 From: vrenaville Date: Tue, 23 Jun 2015 16:48:03 +0200 Subject: [PATCH 5/7] [ADD] change error message --- .../i18n/account_invoice_tax_require.pot | 2 +- account_invoice_tax_required/i18n/fr.po | 2 +- account_invoice_tax_required/models/account_invoice.py | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/account_invoice_tax_required/i18n/account_invoice_tax_require.pot b/account_invoice_tax_required/i18n/account_invoice_tax_require.pot index 23c49ae89..8ec91e874 100644 --- a/account_invoice_tax_required/i18n/account_invoice_tax_require.pot +++ b/account_invoice_tax_required/i18n/account_invoice_tax_require.pot @@ -23,7 +23,7 @@ msgstr "" #. module: account_invoice_tax_required #: code:addons/account_invoice_tax_required/models/account_invoice.py:29 #, python-format -msgid "Invoice have a line with product %s with no taxes" +msgid "Invoice has a line with product %s with no taxes" msgstr "" #. module: account_invoice_tax_required diff --git a/account_invoice_tax_required/i18n/fr.po b/account_invoice_tax_required/i18n/fr.po index dc9935476..5ee1dd07f 100644 --- a/account_invoice_tax_required/i18n/fr.po +++ b/account_invoice_tax_required/i18n/fr.po @@ -23,7 +23,7 @@ msgstr "Facture" #. module: account_invoice_tax_required #: code:addons/account_invoice_tax_required/models/account_invoice.py:29 #, python-format -msgid "Invoice have a line with product %s with no taxes" +msgid "Invoice has a line with product %s with no taxes" msgstr "La facture a un produit %s sans taxe" #. module: account_invoice_tax_required diff --git a/account_invoice_tax_required/models/account_invoice.py b/account_invoice_tax_required/models/account_invoice.py index 44b0f06ba..836ef236c 100644 --- a/account_invoice_tax_required/models/account_invoice.py +++ b/account_invoice_tax_required/models/account_invoice.py @@ -26,7 +26,7 @@ class AccountInvoice(models.Model): @api.multi def test_invoice_line_tax(self): errors = [] - error_template = _("Invoice have a line with product %s with no taxes") + error_template = _("Invoice has a line with product %s with no taxes") for invoice in self: for invoice_line in invoice.invoice_line: if not invoice_line.invoice_line_tax_id: From 3135646d1e9bf736937ba0fbca603bc333abff52 Mon Sep 17 00:00:00 2001 From: vrenaville Date: Mon, 29 Jun 2015 14:46:58 +0200 Subject: [PATCH 6/7] [FIX] remove non related file --- .../views/account_invoice_view.xml | 42 ------------------- 1 file changed, 42 deletions(-) delete mode 100644 account_invoice_tax_required/views/account_invoice_view.xml diff --git a/account_invoice_tax_required/views/account_invoice_view.xml b/account_invoice_tax_required/views/account_invoice_view.xml deleted file mode 100644 index 7bd743f64..000000000 --- a/account_invoice_tax_required/views/account_invoice_view.xml +++ /dev/null @@ -1,42 +0,0 @@ - - - - - - - - - Account invoice supplier (form) - add company currency - account.invoice - - - - - - - - - - - - - - - Account invoice (form) - add company currency - account.invoice - - - - - - - - - - - - - - From 2a16cb3fb08032b33f7f1a491fdeca06d8288ef1 Mon Sep 17 00:00:00 2001 From: vrenaville Date: Wed, 1 Jul 2015 12:04:09 +0200 Subject: [PATCH 7/7] [FIX] version --- account_invoice_tax_required/README.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/account_invoice_tax_required/README.rst b/account_invoice_tax_required/README.rst index ddf3c3336..9ef588456 100644 --- a/account_invoice_tax_required/README.rst +++ b/account_invoice_tax_required/README.rst @@ -12,7 +12,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 -`here `_. +`here `_. Credits