diff --git a/account_fiscal_position_vat_check/__openerp__.py b/account_fiscal_position_vat_check/__openerp__.py index 6b010f9da..a0a66ccc2 100644 --- a/account_fiscal_position_vat_check/__openerp__.py +++ b/account_fiscal_position_vat_check/__openerp__.py @@ -35,7 +35,7 @@ This module adds an option **Customer must have VAT** on fiscal positions. When In the European Union (EU), when an EU company sends an invoice to another EU company in another country, it can invoice without VAT (most of the time) but the VAT number of the customer must be displayed on the invoice. -This module also displays a warning when a user sets a fiscal position with the option **Customer must have VAT** on a partner and this partner doesn't have a VAT number in OpenERP yet. +This module also displays a warning when a user sets a fiscal position with the option **Customer must have VAT** on a customer and this customer doesn't have a VAT number in OpenERP yet. Please contact Alexis de Lattre from Akretion for any help or question about this module. """, diff --git a/account_fiscal_position_vat_check/partner.py b/account_fiscal_position_vat_check/partner.py index 4b0716522..c3daa2dff 100644 --- a/account_fiscal_position_vat_check/partner.py +++ b/account_fiscal_position_vat_check/partner.py @@ -27,10 +27,10 @@ from openerp.tools.translate import _ class res_partner(orm.Model): _inherit = 'res.partner' - def fiscal_position_change(self, cr, uid, ids, account_position, vat): + def fiscal_position_change(self, cr, uid, ids, account_position, vat, customer): '''Warning is the fiscal position requires a vat number and the partner doesn't have one yet''' - if account_position and not vat: + if account_position and customer and not vat: fp = self.pool['account.fiscal.position'].read( cr, uid, account_position, ['customer_must_have_vat', 'name']) if fp['customer_must_have_vat']: diff --git a/account_fiscal_position_vat_check/partner_view.xml b/account_fiscal_position_vat_check/partner_view.xml index 773aa9ee7..c7b6abee7 100644 --- a/account_fiscal_position_vat_check/partner_view.xml +++ b/account_fiscal_position_vat_check/partner_view.xml @@ -16,7 +16,7 @@ - fiscal_position_change(property_account_position, vat) + fiscal_position_change(property_account_position, vat, customer)