From 350526bc90f1cfd90a3e675d5847707f46e1b086 Mon Sep 17 00:00:00 2001 From: RisvanaCybro Date: Tue, 2 Jul 2024 20:46:35 +0530 Subject: [PATCH] July 02: [FIX] Bug Fixed 'product_detail_search' --- product_detail_search/doc/RELEASE_NOTES.md | 8 +++++++- product_detail_search/models/product_template.py | 12 +++++++++++- 2 files changed, 18 insertions(+), 2 deletions(-) diff --git a/product_detail_search/doc/RELEASE_NOTES.md b/product_detail_search/doc/RELEASE_NOTES.md index 94a6b72ea..8dfdf0d4e 100755 --- a/product_detail_search/doc/RELEASE_NOTES.md +++ b/product_detail_search/doc/RELEASE_NOTES.md @@ -1,6 +1,12 @@ ## Module -#### 20.09.2023 +#### 01.06.2024 #### Version 16.0.1.0.0 #### ADD - Initial commit for Find Products in Pos and Stock using Barcode + +### 01.07.2024 +### Version 16.0.1.0.1 +### ADD + +- Product Type Bug Fix \ No newline at end of file diff --git a/product_detail_search/models/product_template.py b/product_detail_search/models/product_template.py index b15ebf936..2d32424fa 100755 --- a/product_detail_search/models/product_template.py +++ b/product_detail_search/models/product_template.py @@ -19,7 +19,7 @@ # If not, see . # ############################################################################# -from odoo import models +from odoo import models,_ class ProductTemplate(models.Model): @@ -27,12 +27,18 @@ class ProductTemplate(models.Model): method""" _inherit = 'product.template' + def get_selection_label(self, object, field_name, field_value): + return _(dict( + self.env[object].fields_get(allfields=[field_name])[field_name][ + 'selection'])[field_value]) + def product_detail_search(self, barcode): """Find the details for the product When the barcode Scan is Detected""" product = self.env['product.product'].search( [('barcode', '=', barcode)]) if product: + product_type = self.get_selection_label('product.product','detailed_type',product.detailed_type) product_details = product.read() specification = [color.strip() for color in product_details[0]['display_name'].split("(")[ @@ -47,6 +53,10 @@ class ProductTemplate(models.Model): else: extra_details.update({'tax_amount': 'No tax', 'specification': specification}) + if product_type: + extra_details.update({'detailed_type': product_type}) + else: + extra_details.update({'detailed_type': False}) product_details[0].update(extra_details) return product_details else: