Odoo Help

Welcome!

This community 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.

0

VAT validation or removal of CC validation

By
andrei
on 8/26/14, 4:22 PM 2,435 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.

1
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 

https://github.com/odoo-romania

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

 

0
andrei
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.

Regards,

Andrei

 

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
0

Bole

--Bole--
2385
| 5 4 6
Zagreb | Karlovac, Croatia
--Bole--

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

Bole
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
        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

Your Answer

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

This community is for professionals and enthusiasts of our products and services. Read Guidelines

Question tools

3 follower(s)

Stats

Asked: 8/26/14, 4:22 PM
Seen: 2435 times
Last updated: 3/16/15, 8:10 AM