Can someone help me write in base_vat.psy a def check_vat_ro(self, vat) for Romania. I don't need a verification of lenght for the VAT but to be able to write the VAT without the country code. Here there are 2 types of companies: ones that have RO in the VAT id to pay the taxes and startup ones that don't have RO in the country code.
I've tried to update the _ref_vat = but no luck. Can someone help me?
Another solution would be to remove this def simple_vat_check(self, cr, uid, country_code, vat_number, context=None): ! what to comment out?
You don't need to rewrite, in fact Odoo (Openerp) is managing the VAT with country code..you can leave the RO in front, instead you have the vat_subjected field which is giving you the VAT payer. The validation is working OK but must be changed in an additional module because is checking on vies site, where you have only the registered companies for Export VAT Number...in shorten future will be post to
checking directly on mfinante.ro (openapi.ro) with checks regarding VAT on Payment on anaf.ro sites.
I understand that, and I saw that the validation is ok. The problem is that in the company profile you can't set a VAT ID (CUI) without a RO in front. The company is registered as a non payer of VAT so no RO in front of the VAT ID (CUI).
How do I remove the CC validation? I checked the vatnumber.py in the python package but it looks ok and don't think the CC validation is done there.
rewrite method in addon module : base_vat/base_vat.py
def check_vat(self, cr, uid, ids, context=None):
user_company = self.pool.get('res.users').browse(cr, uid, uid).company_id
check_func = self.vies_vat_check
check_func = self.simple_vat_check
for partner in self.browse(cr, uid, ids, context=context):
if not partner.vat:
if partner.country_id.code and partner.vat.startswith(partner.country_id.code):
vat_country, vat_number = self._split_vat(partner.vat)
vat_number = partner.vat
vat_country = partner.country_id.code
else: #if no country code ->
# just raise error that country is required?
if not check_func(cr, uid, vat_country, vat_number, context=context):
If you want to put in in separate module, make it dependant on base_vat, and include (simply rewrite in new module)
constraint definition in order to call this function
_constraints = [(check_vat, _construct_constraint_msg, ["vat"])]
hope it helps
Please try to give a substantial answer. If you wanted to comment on the question or answer, just use the commenting tool. Please remember that you can always revise your answers - no need to answer the same question twice. Also, please don't forget to vote - it really helps to select the best questions and answers!
About This Community
|Asked: 8/26/14, 4:22 PM|
|Seen: 2209 times|
|Last updated: 3/16/15, 8:10 AM|