Skip to content

Commit 4d80d30

Browse files
committed
[FIX] base: disable same vat warning when using single-char vat
In order to ease the process of setting vats for some users, it was decided to allow to use a vat number of a single character ('/' for example) without checking it. This allows to differentiate between partners for which we did not set VAT yet, and partners exempted from VAT/without a number. The VAT check was recently adapted to handle this use case, but the "same vat" warning was forgotten in the process. This additional change will disable the "same vat" warning that appears when two partners share the same VAT number if that vat number is only a single character, aligning the behavior of the warning to the changes done in the vat check itself. closes odoo#113650 Signed-off-by: Florian Gilbert (flg) <flg@odoo.com>
1 parent ec59555 commit 4d80d30

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

odoo/addons/base/models/res_partner.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -381,7 +381,9 @@ def _compute_same_vat_partner_id(self):
381381
domain += [('company_id', 'in', [False, partner.company_id.id])]
382382
if partner_id:
383383
domain += [('id', '!=', partner_id), '!', ('id', 'child_of', partner_id)]
384-
partner.same_vat_partner_id = bool(partner.vat) and not partner.parent_id and Partner.search(domain, limit=1)
384+
# For VAT number being only one character, we will skip the check just like the regular check_vat
385+
should_check_vat = partner.vat and len(partner.vat) != 1
386+
partner.same_vat_partner_id = should_check_vat and not partner.parent_id and Partner.search(domain, limit=1)
385387
# check company_registry
386388
domain = [
387389
('company_registry', '=', partner.company_registry),

0 commit comments

Comments
 (0)