diff --git a/product_alternative_code/__manifest__.py b/product_alternative_code/__manifest__.py
index 2b5afdf2..64218fd1 100644
--- a/product_alternative_code/__manifest__.py
+++ b/product_alternative_code/__manifest__.py
@@ -2,13 +2,14 @@
# License LGPL-3.0 or later (http://www.gnu.org/licenses/lgpl).
{
"name": "Product Alternative Code",
- "version": "16.0.1.0.0",
+ "version": "16.0.1.1.0",
"author": "Quartile Limited",
"website": "https://www.quartile.co",
"category": "Product",
"license": "LGPL-3",
"depends": ["product"],
"data": [
+ "views/product_product_views.xml",
"views/product_template_views.xml",
],
"installable": True,
diff --git a/product_alternative_code/models/product_template.py b/product_alternative_code/models/product_template.py
index ed9435d7..61c37d04 100644
--- a/product_alternative_code/models/product_template.py
+++ b/product_alternative_code/models/product_template.py
@@ -8,3 +8,22 @@ class ProductTemplate(models.Model):
_inherit = "product.template"
alt_code = fields.Char("Alternative Code", help="Alternative product code.")
+
+ def name_get(self):
+ res = super().name_get()
+ name_list = []
+ for rec in res:
+ product = self.browse(rec[0])
+ alt_code = product.alt_code
+ if not alt_code:
+ name_list.append(rec)
+ continue
+ name = rec[1]
+ if not product.default_code:
+ name = "[" + alt_code + "] " + name
+ name_list.append((rec[0], name))
+ continue
+ pos = name.find("]")
+ name = name[:pos] + "/" + alt_code + name[pos:]
+ name_list.append((rec[0], name))
+ return name_list
diff --git a/product_alternative_code/views/product_product_views.xml b/product_alternative_code/views/product_product_views.xml
new file mode 100644
index 00000000..c7f8cdb8
--- /dev/null
+++ b/product_alternative_code/views/product_product_views.xml
@@ -0,0 +1,39 @@
+
+
+
+ product.product.tree
+ product.product
+
+
+
+
+
+
+
+
+ product.product.form
+ product.product
+
+
+
+
+
+
+
+
+ product.product.search
+ product.product
+
+
+
+ [
+ '|', '|', '|',
+ ('default_code', 'ilike', self),
+ ('name', 'ilike', self),
+ ('barcode', 'ilike', self),
+ ('alt_code', 'ilike', self),
+ ]
+
+
+
+
diff --git a/product_alternative_code/views/product_template_views.xml b/product_alternative_code/views/product_template_views.xml
index 2a955ec5..12bb89f3 100644
--- a/product_alternative_code/views/product_template_views.xml
+++ b/product_alternative_code/views/product_template_views.xml
@@ -20,4 +20,21 @@
+
+ product.template.search
+ product.template
+
+
+
+ [
+ '|', '|', '|', '|',
+ ('default_code', 'ilike', self),
+ ('product_variant_ids.default_code', 'ilike', self),
+ ('name', 'ilike', self),
+ ('barcode', 'ilike', self),
+ ('alt_code', 'ilike', self),
+ ]
+
+
+