Bỏ qua để đến Nội dung
Menu
Câu hỏi này đã bị gắn cờ
2 Trả lời
5620 Lượt xem

Hi,

I would like to disable VAT number validation when creating new customers using the API. For some reason, when I try to create a customer with a non-validated VAT number, I always get this type of error:

The VAT number [GB565689899] for partner [PauUK2 PauUK2] does not seem to be valid.
Note: the expected format is GB123456782 or XI123456782

Is there a way to disable VAT validation? Please note that this is not VIES validation. We have disabled VIES validation in the invoice section.


Thanks for your help

Ảnh đại diện
Huỷ bỏ
Câu trả lời hay nhất

If anyone stumbles upon the same issue, you can (at least in V17) create Partners with "no_vat_validation" context, as in the following example:

self = self.with_context(no_vat_validation=True)


Ảnh đại diện
Huỷ bỏ
Câu trả lời hay nhất

Updated

from odoo.addons.base_vat.models.res_partner import ResPartner 


class ResPartnerExtension(models.Model):
_inherit = 'res.partner'

@api.constrains('vat', 'country_id')
def check_vat_extended(self):
return True

ResPartner.check_vat = check_vat_extended

Ảnh đại diện
Huỷ bỏ
Bài viết liên quan Trả lời Lượt xem Hoạt động
1
thg 8 25
332
1
thg 8 25
609
2
thg 7 25
3061
3
thg 7 25
761
1
thg 6 25
2274