[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
This commit is contained in:
@@ -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>
|
||||
|
||||
Reference in New Issue
Block a user