Skip to content

Commit df08052

Browse files
committed
Merge PR #721 into 17.0
Signed-off-by pedrobaeza
2 parents ab13cc4 + 4cb7e30 commit df08052

File tree

3 files changed

+3
-4
lines changed

3 files changed

+3
-4
lines changed

product_multi_barcode/models/product_barcode.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ class ProductBarcode(models.Model):
1616
name = fields.Char(
1717
string="Barcode",
1818
required=True,
19+
index="trigram",
1920
)
2021
sequence = fields.Integer(
2122
default=0,

product_multi_barcode/models/product_product.py

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ class ProductProduct(models.Model):
1414
comodel_name="product.barcode",
1515
inverse_name="product_id",
1616
string="Barcodes",
17+
auto_join=True,
1718
)
1819
barcode = fields.Char(
1920
string="Main barcode",
@@ -60,11 +61,8 @@ def _search(self, domain, *args, **kwargs):
6061
def _get_barcode_domain(self, sub_domain, domain):
6162
barcode_operator = sub_domain[1]
6263
barcode_value = sub_domain[2]
63-
barcodes = self.env["product.barcode"].search(
64-
[("name", barcode_operator, barcode_value)]
65-
)
6664
domain = [
67-
("barcode_ids", "in", barcodes.ids)
65+
("barcode_ids.name", barcode_operator, barcode_value)
6866
if x[0] == "barcode" and x[2] == barcode_value
6967
else x
7068
for x in domain
78 KB
Loading

0 commit comments

Comments
 (0)