I've created a function (tests OK in python) that checks validity of Croatian VAT number and i can't make it work in openErp. I've created a module base_vat_cro with next files and content:
__init__.py import base_vat_cro __terp__.py { 'name': 'base_vat_cro', 'version': '1.0', 'category': 'Generic Modules/Base', 'description': """Check the validity of Croatian VAT Number.""", 'author': 'Infokom d.o.o.', 'depends': ['base', 'account', 'base_vat'], 'update_xml': [], 'installable': True, 'active': False, } base_vat_cro.py from osv import osv from osv import fields import string from tools.func import partial class res_partner(osv.osv): _inherit = 'res.partner' def check_vat_hr(self, vat): ''' Check Croatia VAT number. ''' try: int(vat) except: return False y = 0 for i in range(10): y = vat[i] if i == 0: y = y + 10 else: y = y + z y = y % 10 if y == 0: y = 10 y = y * 2 z = y % 11 kontrola = 11 - z if kontrola == 10: kontrola = 0 if kontola == vat[10]: return True else: return False Please tell me what am I doing wrong. I know that this function will be added to base_vat module in the future so it'll work by default, but I want to know how to add some code that works with existing modules/forms. -------------------- m2f -------------------- -- http://www.openobject.com/forum/viewtopic.php?p=57069#57069 -------------------- m2f -------------------- _______________________________________________ Tinyerp-users mailing list http://tiny.be/mailman2/listinfo/tinyerp-users
