oca-ocb-pos/odoo-bringout-oca-ocb-pos_restaurant/pos_restaurant/models/pos_session.py
Ernad Husremovic 3ca647e428 19.0 vanilla
2026-03-09 09:29:53 +01:00

35 lines
1.3 KiB
Python

# -*- coding: utf-8 -*-
# Part of Odoo. See LICENSE file for full copyright and licensing details.
from odoo import models, api
import json
class PosSession(models.Model):
_inherit = 'pos.session'
@api.model
def _load_pos_data_models(self, config):
data = super()._load_pos_data_models(config)
if self.config_id.module_pos_restaurant:
data += ['restaurant.floor', 'restaurant.table', 'restaurant.order.course']
return data
@api.model
def _set_last_order_preparation_change(self, order_ids):
for order_id in order_ids:
order = self.env['pos.order'].browse(order_id)
last_order_preparation_change = {
'lines': {},
'generalCustomerNote': '',
}
for orderline in order['lines']:
last_order_preparation_change['lines'][orderline.uuid + " - "] = {
"uuid": orderline.uuid,
"name": orderline.full_product_name,
"note": "",
"product_id": orderline.product_id.id,
"quantity": orderline.qty,
"attribute_value_ids": orderline.attribute_value_ids.ids,
}
order.write({'last_order_preparation_change': json.dumps(last_order_preparation_change)})