Browse Source

Mar 15 [UPDT] : Updated 'product_multi_uom_pos'

pull/278/merge
AjmalCybro 1 year ago
parent
commit
47c52d6e1c
  1. 5
      product_multi_uom_pos/doc/RELEASE_NOTES.md
  2. 31
      product_multi_uom_pos/models/pos_order_line.py
  3. 1
      product_multi_uom_pos/static/src/js/Orderline.js
  4. 4
      product_multi_uom_pos/static/src/xml/Orderline.xml

5
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.

31
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

1
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;

4
product_multi_uom_pos/static/src/xml/Orderline.xml

@ -11,7 +11,9 @@
<t t-foreach="getUom()" t-as="item" t-key="item.id">
<option id="select_uom" class="select_uom"
t-att-value="[item.price,item.uom_id[0],item.uom_id[1]]">
<div><span>$ <t t-esc="item.price"/> per
<div><span>
<t t-esc="this.props.line.product.pos.currency.symbol"/>
<t t-esc="item.price"/> per
<t t-esc="item.uom_id[1]"/></span></div>
</option>
</t>

Loading…
Cancel
Save