diff --git a/account_fiscal_position_vat_check/README.rst b/account_fiscal_position_vat_check/README.rst index 94027d459..c73fffc5c 100644 --- a/account_fiscal_position_vat_check/README.rst +++ b/account_fiscal_position_vat_check/README.rst @@ -31,7 +31,7 @@ on a customer that doesn't have a VAT number yet. .. 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/8.0 + :target: https://runbot.odoo-community.org/runbot/92/9.0 Bug Tracker =========== @@ -48,6 +48,7 @@ Contributors ------------ * Alexis de Lattre +* Vicent Cubells Maintainer ---------- diff --git a/account_fiscal_position_vat_check/__init__.py b/account_fiscal_position_vat_check/__init__.py index d8b42d60d..0b1a40e26 100644 --- a/account_fiscal_position_vat_check/__init__.py +++ b/account_fiscal_position_vat_check/__init__.py @@ -1,4 +1,6 @@ # -*- coding: utf-8 -*- +# © 2013-2016 Akretion (Alexis de Lattre ) +# © 2016 Tecnativa - Vicent Cubells +# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). -from . import account_invoice -from . import partner +from . import models diff --git a/account_fiscal_position_vat_check/__openerp__.py b/account_fiscal_position_vat_check/__openerp__.py index 9d2facda0..0d233a17e 100644 --- a/account_fiscal_position_vat_check/__openerp__.py +++ b/account_fiscal_position_vat_check/__openerp__.py @@ -1,18 +1,21 @@ # -*- coding: utf-8 -*- # © 2013-2016 Akretion (Alexis de Lattre ) +# © 2016 Tecnativa - Vicent Cubells # License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). { 'name': 'Account Fiscal Position VAT Check', - 'version': '8.0.0.1.2', + 'version': '9.0.1.0.0', 'category': 'Accounting & Finance', 'license': 'AGPL-3', 'summary': 'Check VAT on invoice validation', - 'author': "Akretion,Odoo Community Association (OCA)", + 'author': "Akretion, " + "Tecnativa," + "Odoo Community Association (OCA)", 'website': 'http://www.akretion.com', 'depends': ['account', 'base_vat'], 'data': [ - 'account_fiscal_position_view.xml', + 'views/account_fiscal_position_view.xml', ], - 'installable': False, + 'installable': True, } diff --git a/account_fiscal_position_vat_check/account_fiscal_position_view.xml b/account_fiscal_position_vat_check/account_fiscal_position_view.xml deleted file mode 100644 index 353612407..000000000 --- a/account_fiscal_position_vat_check/account_fiscal_position_view.xml +++ /dev/null @@ -1,36 +0,0 @@ - - - - - - - - - - customer.must.have.vat.fiscal_position_form - account.fiscal.position - - - - - - - - - - - customer.must.have.vat.fiscal_position_tree - account.fiscal.position - - - - - - - - - - diff --git a/account_fiscal_position_vat_check/models/__init__.py b/account_fiscal_position_vat_check/models/__init__.py new file mode 100644 index 000000000..9fee7488e --- /dev/null +++ b/account_fiscal_position_vat_check/models/__init__.py @@ -0,0 +1,7 @@ +# -*- coding: utf-8 -*- +# © 2013-2016 Akretion (Alexis de Lattre ) +# © 2016 Tecnativa - Vicent Cubells +# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). + +from . import account_invoice +from . import partner diff --git a/account_fiscal_position_vat_check/account_invoice.py b/account_fiscal_position_vat_check/models/account_invoice.py similarity index 83% rename from account_fiscal_position_vat_check/account_invoice.py rename to account_fiscal_position_vat_check/models/account_invoice.py index 78cb4d058..a44f7b821 100644 --- a/account_fiscal_position_vat_check/account_invoice.py +++ b/account_fiscal_position_vat_check/models/account_invoice.py @@ -1,5 +1,6 @@ # -*- coding: utf-8 -*- # © 2013-2016 Akretion (Alexis de Lattre ) +# © 2016 Tecnativa - Vicent Cubells # License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). from openerp import models, fields, api, _ @@ -20,13 +21,14 @@ class AccountInvoice(models.Model): @api.multi def action_move_create(self): - '''Check that the customer has VAT set - if required by the fiscal position''' + """Check that the customer has VAT set + if required by the fiscal position""" + for invoice in self: if ( invoice.type in ('out_invoice', 'out_refund') and - invoice.fiscal_position and - invoice.fiscal_position.customer_must_have_vat and + invoice.fiscal_position_id and + invoice.fiscal_position_id.customer_must_have_vat and not invoice.partner_id.vat): if invoice.type == 'out_invoice': type_label = _('a Customer Invoice') @@ -41,6 +43,6 @@ class AccountInvoice(models.Model): "have a VAT number in OpenERP." "Please add the VAT number of this Customer in Odoo " " and try to validate again.") - % (type_label, invoice.fiscal_position.name, + % (type_label, invoice.fiscal_position_id.name, invoice.partner_id.name)) return super(AccountInvoice, self).action_move_create() diff --git a/account_fiscal_position_vat_check/partner.py b/account_fiscal_position_vat_check/models/partner.py similarity index 96% rename from account_fiscal_position_vat_check/partner.py rename to account_fiscal_position_vat_check/models/partner.py index c9a96eee3..6bc8c1c99 100644 --- a/account_fiscal_position_vat_check/partner.py +++ b/account_fiscal_position_vat_check/models/partner.py @@ -1,5 +1,6 @@ # -*- coding: utf-8 -*- # © 2013-2016 Akretion (Alexis de Lattre ) +# © 2016 Tecnativa - Vicent Cubells # License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). from openerp import models, api, _ diff --git a/account_fiscal_position_vat_check/views/account_fiscal_position_view.xml b/account_fiscal_position_vat_check/views/account_fiscal_position_view.xml new file mode 100644 index 000000000..8bcd4919a --- /dev/null +++ b/account_fiscal_position_vat_check/views/account_fiscal_position_view.xml @@ -0,0 +1,32 @@ + + + + + + + + customer.must.have.vat.fiscal_position_form + account.fiscal.position + + + + + + + + + + customer.must.have.vat.fiscal_position_tree + account.fiscal.position + + + + + + + + +