From 3f54c1c7556c5d06759bf5ec74dd83872f0d24d2 Mon Sep 17 00:00:00 2001 From: "Djamel (otd)" Date: Thu, 4 Mar 2021 16:05:40 +0000 Subject: [FIX] base: fix the customer search by vat number Steps to follow to reproduce the bug: -Go to sales -Add a vat number with a '-' like: "123456789-5" to any customer -Create a new SO -Search the customer by entering their VAT number Problem : When the VAT number contains the character '-' you cannot find the customer with his VAT number. The problem is the same if the vat number contains a '.' Because, the "_name_search" method before creating the query to search clients by VAT number, removes all the special characters from user input Solution : Do not remove the characters '-' and '.' from the user input for the customer search by vat number. opw-2457692 closes odoo/odoo#67277 Signed-off-by: Anh Thao PHAM --- odoo/addons/base/models/res_partner.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'odoo') diff --git a/odoo/addons/base/models/res_partner.py b/odoo/addons/base/models/res_partner.py index 601a9af7ed6..1d148785a70 100644 --- a/odoo/addons/base/models/res_partner.py +++ b/odoo/addons/base/models/res_partner.py @@ -793,7 +793,7 @@ class Partner(models.Model): vat=unaccent('res_partner.vat'),) where_clause_params += [search_name]*3 # for email / display_name, reference - where_clause_params += [re.sub('[^a-zA-Z0-9]+', '', search_name) or None] # for vat + where_clause_params += [re.sub('[^a-zA-Z0-9\-\.]+', '', search_name) or None] # for vat where_clause_params += [search_name] # for order by if limit: query += ' limit %s' -- cgit v1.2.3