Only display a warning when the partner is a customer.

I promise, it's my last commit on this merge proposal :)
This commit is contained in:
Alexis de Lattre
2013-10-24 18:18:25 +02:00
committed by Raphaël Valyi
parent 1c3b69c497
commit c4197015b8
3 changed files with 4 additions and 4 deletions

View File

@@ -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 <alexis.delattre@akretion.com> for any help or question about this module.
""",

View File

@@ -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']:

View File

@@ -16,7 +16,7 @@
<field name="inherit_id" ref="account.view_partner_property_form" />
<field name="arch" type="xml">
<field name="property_account_position" position="attributes">
<attribute name="on_change">fiscal_position_change(property_account_position, vat)</attribute>
<attribute name="on_change">fiscal_position_change(property_account_position, vat, customer)</attribute>
</field>
</field>
</record>