diff --git a/product_multi_uom_pos/doc/RELEASE_NOTES.md b/product_multi_uom_pos/doc/RELEASE_NOTES.md index e56942037..861bdcf2e 100644 --- a/product_multi_uom_pos/doc/RELEASE_NOTES.md +++ b/product_multi_uom_pos/doc/RELEASE_NOTES.md @@ -4,3 +4,8 @@ #### Version 16.0.1.0.0 #### ADD - Initial commit for POS Product Multiple UOM + +#### 20.02.2024 +#### Version 16.0.1.0.0 +#### FIX +- Fixed UOM saving issue when POS tables switched. \ No newline at end of file diff --git a/product_multi_uom_pos/models/pos_order_line.py b/product_multi_uom_pos/models/pos_order_line.py index 8aade3e7d..a9fa34829 100644 --- a/product_multi_uom_pos/models/pos_order_line.py +++ b/product_multi_uom_pos/models/pos_order_line.py @@ -39,3 +39,34 @@ class PosOrderLine(models.Model): if values.get('product_uom_id'): values['uom_id'] = values['product_uom_id'] return super(PosOrderLine, self).create(values) + + +class PosOrder(models.Model): + """ + Model representing Point of Sale orders, inherits from 'pos.order'. + This class extends functionality related to order lines. + """ + _inherit = 'pos.order' + + def _get_fields_for_order_line(self): + """ + Get the fields required for the order line. + Returns: + list: A list of fields required for the order line. + """ + fields = super(PosOrder, self)._get_fields_for_order_line() + fields.extend(['product_uom_id']) + return fields + + def _prepare_order_line(self, order_line): + """ + Prepare the order line data before processing. + Args: + order_line (dict): The dictionary representing the order line data. + Returns: + dict: The modified order line dictionary with necessary adjustments. + """ + order_line = super()._prepare_order_line(order_line) + if order_line["product_uom_id"]: + order_line["product_uom_id"] = order_line["product_uom_id"][0] + return order_line diff --git a/product_multi_uom_pos/static/src/js/Orderline.js b/product_multi_uom_pos/static/src/js/Orderline.js index b03f5f421..859875df0 100644 --- a/product_multi_uom_pos/static/src/js/Orderline.js +++ b/product_multi_uom_pos/static/src/js/Orderline.js @@ -35,7 +35,6 @@ odoo.define('product_multi_uom_pos.multi_uom_pos', function(require) { // Reset the unit of measure to the default uom_id of the product resetUom(ev) { var lineId = this.props.line.id - console.log(this) this.el.querySelector('#change_uom').disabled = false; this.el.querySelector('#select_uom').value = 'change_uom'; this.el.querySelector('#change_uom').disabled = true; diff --git a/product_multi_uom_pos/static/src/xml/Orderline.xml b/product_multi_uom_pos/static/src/xml/Orderline.xml index 6fbf3710a..600033308 100644 --- a/product_multi_uom_pos/static/src/xml/Orderline.xml +++ b/product_multi_uom_pos/static/src/xml/Orderline.xml @@ -11,7 +11,9 @@