forked from acsone/account-financial-tools
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathpartner.py
25 lines (21 loc) · 955 Bytes
/
partner.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
# -*- coding: utf-8 -*-
# © 2013-2016 Akretion (Alexis de Lattre <[email protected]>)
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
from openerp import models, api, _
class ResPartner(models.Model):
_inherit = 'res.partner'
@api.onchange('property_account_position')
def fiscal_position_change(self):
"""Warning if the fiscal position requires a VAT number and the
partner doesn't have one yet"""
fp = self.property_account_position
if fp.customer_must_have_vat and self.customer and not self.vat:
return {
'warning': {
'title': _('Missing VAT number:'),
'message': _(
"You have set the fiscal position '%s' "
"that require the customer to have a VAT number, "
"but the VAT number is missing.") % fp.name
}
}