Odoo Help


VAT validation or removal of CC validation

on 8/26/14, 4:22 PM 4,217 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.

Fekete Mihai
On 8/27/14, 1:03 AM

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.


On 2/15/18, 4:07 PM

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.

On 8/27/14, 2:33 AM

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.




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:] ]].

Fekete Mihai
on 8/27/14, 2:53 AM



| 5 4 6
Zagreb | Karlovac, Croatia

there is only 10 kind of people the ones that understand binary ... and others

On 9/3/14, 6:45 PM

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
            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)
            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?
            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

About This Community

This platform is for beginners and experts willing to share their Odoo knowledge. It's not a forum to discuss ideas, but a knowledge base of questions and their answers.


Odoo Training Center

Access to our E-learning platform and experience all Odoo Apps through learning videos, exercises and Quizz.

Test it now

Question tools

3 follower(s)


Asked: 8/26/14, 4:22 PM
Seen: 4217 times
Last updated: 2/15/18, 4:07 PM