Skip to content
Snippets Groups Projects
Commit c1105efe authored by Quentin De Paoli's avatar Quentin De Paoli
Browse files

[IMP] base_vat: added a button on the partner form view to directly check the...

[IMP] base_vat: added a button on the partner form view to directly check the VAT. This will be useful for VAT numbers that are correct for a given period only

bzr revid: qdp-launchpad@openerp.com-20120208152647-b6xr5rq6kdpk4sxq
parent bad6cde8
No related branches found
No related tags found
No related merge requests found
......@@ -104,6 +104,11 @@ class res_partner(osv.osv):
# country code or empty VAT number), so we fall back to the simple check.
return self.simple_vat_check(cr, uid, country_code, vat_number, context=context)
def button_check_vat(self, cr, uid, ids, context=None):
if not self.check_vat(cr, uid, ids, context=context):
msg = self._construct_constraint_msg(cr, uid, ids, context=context)
raise osv.except_osv(_('Error'), msg)
def check_vat(self, cr, uid, ids, context=None):
user_company = self.pool.get('res.users').browse(cr, uid, uid).company_id
if user_company.vat_check_vies:
......@@ -112,7 +117,6 @@ class res_partner(osv.osv):
else:
# quick and partial off-line checksum validation
check_func = self.simple_vat_check
for partner in self.browse(cr, uid, ids, context=context):
if not partner.vat:
continue
......
......@@ -9,7 +9,8 @@
<field name="arch" type="xml">
<field name="property_account_payable" position="after">
<group colspan="2" col="6">
<field name="vat" on_change="vat_change(vat)" colspan="4" />
<field name="vat" on_change="vat_change(vat)"/>
<button name="button_check_vat" string="Check VAT" type="object" icon="gtk-execute"/>
<field name="vat_subjected" colspan="1" groups="base.group_extended" />
</group>
</field>
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment