customaddons-kedaikipas58/custom_preparation_display/models/customposorder.py

30 lines
1.2 KiB
Python

from odoo import api, fields, models
class CustomPosOrder(models.Model):
_inherit = 'pos.order'
def _process_saved_order(self, draft):
# Call the original logic
res = super()._process_saved_order(draft)
for order in self:
pos_config = self.env['pos.config']
displays = self.env['pos_preparation_display.display'].search([])
# displays = pos_config.pos_preparation_display.display_ids
for display in displays:
#self.env['pos_preparation_display.display']._send_load_orders_message()
self.env['bus.bus']._sendone(f'preparation_display-{self.access_token}', 'load_orders', {
'preparation_display_id': display.id,
'sound': True
})
return res
# def _process_saved_order(self, draft):
# self.ensure_one()
# order_id = super()._process_saved_order(draft)
# self.send_table_count_notification(self.table_id)
# self.env['bus.bus']._sendone(f'preparation_display-{self.access_token}', 'load_orders', {
# 'preparation_display_id': self.id,
# 'sound': True
# })
# return order_id