mirror of
https://github.com/OCA/account-financial-tools.git
synced 2025-02-02 12:47:26 +02:00
[ADD] account_invoice_tax_required
This commit is contained in:
36
account_invoice_tax_required/README.rst
Normal file
36
account_invoice_tax_required/README.rst
Normal file
@@ -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 <https://github.com/OCA/account-financial-tools/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 <vincent.renaville@camptocamp.com>
|
||||
|
||||
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.
|
||||
20
account_invoice_tax_required/__init__.py
Normal file
20
account_invoice_tax_required/__init__.py
Normal file
@@ -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 <http://www.gnu.org/licenses/>.
|
||||
#
|
||||
##############################################################################
|
||||
from . import models
|
||||
31
account_invoice_tax_required/__openerp__.py
Normal file
31
account_invoice_tax_required/__openerp__.py
Normal file
@@ -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 <http://www.gnu.org/licenses/>.
|
||||
#
|
||||
##############################################################################
|
||||
{
|
||||
'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,
|
||||
}
|
||||
@@ -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 ""
|
||||
|
||||
34
account_invoice_tax_required/i18n/fr.po
Normal file
34
account_invoice_tax_required/i18n/fr.po
Normal file
@@ -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"
|
||||
|
||||
20
account_invoice_tax_required/models/__init__.py
Normal file
20
account_invoice_tax_required/models/__init__.py
Normal file
@@ -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 <http://www.gnu.org/licenses/>.
|
||||
#
|
||||
##############################################################################
|
||||
from . import account_invoice
|
||||
47
account_invoice_tax_required/models/account_invoice.py
Normal file
47
account_invoice_tax_required/models/account_invoice.py
Normal file
@@ -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 <http://www.gnu.org/licenses/>.
|
||||
#
|
||||
##############################################################################
|
||||
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
|
||||
42
account_invoice_tax_required/views/account_invoice_view.xml
Normal file
42
account_invoice_tax_required/views/account_invoice_view.xml
Normal file
@@ -0,0 +1,42 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<openerp>
|
||||
<data>
|
||||
|
||||
<!-- ###############################################
|
||||
INVOICE INHERITANCE
|
||||
############################################### -->
|
||||
|
||||
<!-- ## Suppliers ## -->
|
||||
<record id="invoice_supplier_company_currency_form" model="ir.ui.view">
|
||||
<field name="name">Account invoice supplier (form) - add company currency</field>
|
||||
<field name="model">account.invoice</field>
|
||||
<field name="inherit_id" ref="account.invoice_supplier_form"/>
|
||||
<field name="arch" type="xml">
|
||||
<xpath expr="//field[@name='period_id']/.." position="after">
|
||||
<group string="Amounts in company currency">
|
||||
<field name="cc_amount_untaxed"/>
|
||||
<field name="cc_amount_tax"/>
|
||||
<field name="cc_amount_total"/>
|
||||
</group>
|
||||
</xpath>
|
||||
</field>
|
||||
</record>
|
||||
|
||||
<!-- ## Customers ## -->
|
||||
<record id="invoice_company_currency_form" model="ir.ui.view">
|
||||
<field name="name">Account invoice (form) - add company currency</field>
|
||||
<field name="model">account.invoice</field>
|
||||
<field name="inherit_id" ref="account.invoice_form"/>
|
||||
<field name="arch" type="xml">
|
||||
<xpath expr="//field[@name='move_id']/.." position="after">
|
||||
<group string="Amounts in company currency">
|
||||
<field name="cc_amount_untaxed"/>
|
||||
<field name="cc_amount_tax"/>
|
||||
<field name="cc_amount_total"/>
|
||||
</group>
|
||||
</xpath>
|
||||
</field>
|
||||
</record>
|
||||
|
||||
</data>
|
||||
</openerp>
|
||||
Reference in New Issue
Block a user