Skip to Content
Menu
This question has been flagged
5 Replies
13026 Views

Hi ,

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?

Thank you.

Avatar
Discard
Best Answer

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 

https://github.com/odoo-romania

checking directly on mfinante.ro (openapi.ro) with checks regarding VAT on Payment on anaf.ro sites.

 

Avatar
Discard
Best Answer

How can I check out the validation of CC VAT NUMBER in odoo 11? since I try what they indicate and it does not work.

Avatar
Discard
Author Best Answer

Hi Mihai,

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.

Regards,

Andrei

 

Avatar
Discard

You have to input with RO in front and vat_subjected field gives you the payer of VAT, on reports you can set like this to print 'RO' only if it's vat payer: [[ o.partner_id.vat_subjected and o.partner_id.vat or o.partner_id.vat[2:] ]].

Best Answer

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
        if user_company.vat_check_vies:
            check_func = self.vies_vat_check
        else:
            check_func = self.simple_vat_check
        for partner in self.browse(cr, uid, ids, context=context):
            if not partner.vat:
                continue

#ADD THIS

            if partner.country_id.code and partner.vat.startswith(partner.country_id.code):

                vat_country, vat_number = self._split_vat(partner.vat)
            elif partner.country_id.code:
                vat_number = partner.vat
                vat_country = partner.country_id.code
            else: #if no country code ->
                # just raise error that country is required?
                pass
            if not check_func(cr, uid, vat_country, vat_number, context=context):
                return False
        return True

 

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

Avatar
Discard