|
|
@ -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 |
|
|
|