From a92fdb1c62335ee317f16d0169dd73f76dfa849f Mon Sep 17 00:00:00 2001 From: Cybrosys Technologies Date: Thu, 21 Nov 2024 13:43:59 +0530 Subject: [PATCH] Nov 21: [FIX] Bug Fixed 'product_multi_uom_pos' --- product_multi_uom_pos/__manifest__.py | 4 ++-- product_multi_uom_pos/doc/RELEASE_NOTES.md | 7 ++++++- .../models/product_template.py | 15 ++++++++++---- .../static/src/js/Orderline.js | 5 ++++- product_multi_uom_pos/static/src/js/models.js | 20 +++++++++---------- .../static/src/xml/Orderline.xml | 7 +++---- .../views/product_template_views.xml | 14 +++++-------- 7 files changed, 41 insertions(+), 31 deletions(-) diff --git a/product_multi_uom_pos/__manifest__.py b/product_multi_uom_pos/__manifest__.py index 5bc1ac5c9..17ff8eeab 100644 --- a/product_multi_uom_pos/__manifest__.py +++ b/product_multi_uom_pos/__manifest__.py @@ -21,7 +21,7 @@ ############################################################################# { 'name': "POS Product Multiple UOM", - 'version': '16.0.1.0.0', + 'version': '16.0.1.1.1', 'category': 'Point of Sale', 'summary': """A module to manage multiple UoM in POS""", 'description': """This app allows you to change UoM of product in POS.""", @@ -29,7 +29,7 @@ 'company': 'Cybrosys Techno Solutions', 'maintainer': 'Cybrosys Techno Solutions', 'website': "https://www.cybrosys.com", - 'depends': ['base', 'point_of_sale'], + 'depends': ['base', 'point_of_sale', 'uom'], 'data': [ 'security/ir.model.access.csv', diff --git a/product_multi_uom_pos/doc/RELEASE_NOTES.md b/product_multi_uom_pos/doc/RELEASE_NOTES.md index 1635492f3..4fd9ea445 100644 --- a/product_multi_uom_pos/doc/RELEASE_NOTES.md +++ b/product_multi_uom_pos/doc/RELEASE_NOTES.md @@ -14,4 +14,9 @@ #### 11.09.2024 #### Version 16.0.1.0.0 #### FIX -- Added UOM in Sales details report. \ No newline at end of file +- Added UOM in Sales details report. + +#### 21.11.2024 +#### Version 16.0.1.1.1 +#### FIX +- The price calculation has been updated. Previously, the unit of measure (UOM) price was determined based on the price specified for the UOM. Now, it is calculated based on the product's base price. \ No newline at end of file diff --git a/product_multi_uom_pos/models/product_template.py b/product_multi_uom_pos/models/product_template.py index 5bb4e4aa8..cd3e1357d 100644 --- a/product_multi_uom_pos/models/product_template.py +++ b/product_multi_uom_pos/models/product_template.py @@ -27,14 +27,21 @@ class ProductTemplate(models.Model): of measure""" _inherit = 'product.template' + product_uom_category_id = fields.Many2one(related='uom_id.category_id') + pos_multi_uom_ids = fields.Many2many('uom.uom', 'product_template_id', + string="POS Multiple UoM", + domain="[('category_id', '=', product_uom_category_id)]", + help='These UoM can be selected from ' + 'PoS') + multi_uom = fields.Boolean(compute='_compute_multi_uom', string='Multi UoM', help='A boolean field to show the one2many field' 'POS Multiple UoM if the Multi UoM option' ' is enabled in Configuration settings') - pos_multi_uom_ids = fields.One2many('pos.multi.uom', 'product_template_id', - string="POS Multiple UoM", - help='These UoM can be selected from ' - 'PoS') + # pos_multi_uom_ids = fields.One2many('pos.multi.uom', 'product_template_id', + # string="POS Multiple UoM", + # help='These UoM can be selected from ' + # 'PoS') def _compute_multi_uom(self): """ diff --git a/product_multi_uom_pos/static/src/js/Orderline.js b/product_multi_uom_pos/static/src/js/Orderline.js index 859875df0..edda0909a 100644 --- a/product_multi_uom_pos/static/src/js/Orderline.js +++ b/product_multi_uom_pos/static/src/js/Orderline.js @@ -12,7 +12,10 @@ odoo.define('product_multi_uom_pos.multi_uom_pos', function(require) { // Retrieve the available unit of measure options based on the product's multi_uom_ids getUom() { - const filteredData = this.props.line.pos.pos_multi_uom.filter(obj => this.props.line.product.pos_multi_uom_ids.includes(obj.id)); + console.log(this) + console.log("this",this.props.line.product.pos_multi_uom_ids) + const filteredData = this.props.line.pos.units.filter(obj => this.props.line.product.pos_multi_uom_ids.includes(obj.id)) + console.log("filtereddata",filteredData) return filteredData } diff --git a/product_multi_uom_pos/static/src/js/models.js b/product_multi_uom_pos/static/src/js/models.js index d81f7c43e..9fa3b4051 100644 --- a/product_multi_uom_pos/static/src/js/models.js +++ b/product_multi_uom_pos/static/src/js/models.js @@ -31,17 +31,17 @@ const ProductUom = (Orderline) => class ProductUom extends Orderline { // Override the get_unit method to get selected UoM from POS get_unit() { - if (this.product_uom_id){ - var unit_id = this.product_uom_id[0]; - if(!unit_id){ - return undefined; + if (this.product_uom_id){ + var unit_id = this.product_uom_id[0]; + if(!unit_id){ + return undefined; + } + if(!this.pos){ + return undefined; + } + return this.pos.units_by_id[unit_id]; } - if(!this.pos){ - return undefined; - } - return this.pos.units_by_id[unit_id]; - } - return this.product.get_unit(); + return this.product.get_unit(); } } Registries.Model.extend(Orderline, ProductUom); diff --git a/product_multi_uom_pos/static/src/xml/Orderline.xml b/product_multi_uom_pos/static/src/xml/Orderline.xml index 600033308..ca190c52a 100644 --- a/product_multi_uom_pos/static/src/xml/Orderline.xml +++ b/product_multi_uom_pos/static/src/xml/Orderline.xml @@ -10,11 +10,10 @@ diff --git a/product_multi_uom_pos/views/product_template_views.xml b/product_multi_uom_pos/views/product_template_views.xml index 24b0fd15a..44e22549c 100644 --- a/product_multi_uom_pos/views/product_template_views.xml +++ b/product_multi_uom_pos/views/product_template_views.xml @@ -2,19 +2,15 @@ - product.template.view.form.inherit.product.multi.uom.pos + + product.template.view.form.inherit.product.multi.uom.pos + product.template - - - - - - - - + +