Don't allow empty vat_number if vat_country is set for issue1468

This commit is contained in:
Cédric Krier
2010-04-01 12:56:56 +02:00
parent 1f6c729bc9
commit 88c784b599
2 changed files with 6 additions and 2 deletions
+1
View File
@@ -1,3 +1,4 @@
* Don't allow empty vat_number if vat_country is set
* Use model singleton to define which party sequence to use
* Improve search_rec_name of category to take care of separator
+5 -2
View File
@@ -34,7 +34,10 @@ class Party(ModelSQL, ModelView):
code_length = fields.Integer('Code Length', select=1, readonly=True)
lang = fields.Many2One("ir.lang", 'Language', states=STATES)
vat_number = fields.Char('VAT Number', help="Value Added Tax number",
states=STATES)
states={
'readonly': Not(Bool(Eval('active'))),
'required': Bool(Eval('vat_country')),
})
vat_country = fields.Selection(VAT_COUNTRIES, 'VAT Country', states=STATES,
help="Setting VAT country will enable validation of the VAT number.",
translate=False)
@@ -206,7 +209,7 @@ class Party(ModelSQL, ModelView):
for party in self.browse(cursor, user, ids):
vat_number = party.vat_number
if not (vat_number and party.vat_country):
if not party.vat_country:
continue
if not getattr(vatnumber, 'check_vat_' + \