Browse Source

July 02: [FIX] Bug Fixed 'product_detail_search'

pull/320/head
RisvanaCybro 10 months ago
parent
commit
350526bc90
  1. 8
      product_detail_search/doc/RELEASE_NOTES.md
  2. 12
      product_detail_search/models/product_template.py

8
product_detail_search/doc/RELEASE_NOTES.md

@ -1,6 +1,12 @@
## Module <product_detail_search>
#### 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

12
product_detail_search/models/product_template.py

@ -19,7 +19,7 @@
# If not, see <http://www.gnu.org/licenses/>.
#
#############################################################################
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:

Loading…
Cancel
Save