|
|
@ -25,6 +25,15 @@ class kitchen_screen_dashboard extends Component { |
|
|
|
ready_count:[], |
|
|
|
lines:[] |
|
|
|
}); |
|
|
|
this.orm.call("pos.session", "search_read", [[ |
|
|
|
["state", "=", "opened"] // Get only open sessions
|
|
|
|
]]).then(function(sessions) { |
|
|
|
if (sessions.length > 0) { |
|
|
|
self.state.session_ids = sessions.map(session => session.id); // Store session IDs in state
|
|
|
|
} else { |
|
|
|
self.state.session_ids = [] |
|
|
|
} |
|
|
|
}); |
|
|
|
|
|
|
|
var session_shop_id; |
|
|
|
// //if refreshing the page then the last passed context (shop id)
|
|
|
@ -38,7 +47,7 @@ class kitchen_screen_dashboard extends Component { |
|
|
|
this.shop_id = parseInt(session_shop_id, 10);; |
|
|
|
} |
|
|
|
self.orm.call("pos.order", "get_details", ["", self.shop_id,""]).then(function(result) { |
|
|
|
self.state.order_details = result['orders'] |
|
|
|
self.state.order_details = result['orders'].filter(order => order.session_id && self.state.session_ids.includes(order.session_id[0])); |
|
|
|
self.state.lines = result['order_lines'] |
|
|
|
self.state.shop_id=self.shop_id |
|
|
|
self.state.draft_count=self.state.order_details.filter((order) => order.order_status=='draft' && order.config_id[0]==self.state.shop_id).length |
|
|
@ -52,8 +61,7 @@ class kitchen_screen_dashboard extends Component { |
|
|
|
var self=this |
|
|
|
if(message.message == "pos_order_created" && message.res_model == "pos.order"){ |
|
|
|
self.orm.call("pos.order", "get_details", ["", self.shop_id,""]).then(function(result) { |
|
|
|
console.log('orm call result', result) |
|
|
|
self.state.order_details = result['orders'] |
|
|
|
self.state.order_details = result['orders'].filter(order => order.session_id && self.state.session_ids.includes(order.session_id[0])); |
|
|
|
self.state.lines = result['order_lines'] |
|
|
|
self.state.shop_id=self.shop_id |
|
|
|
self.state.draft_count=self.state.order_details.filter((order) => order.order_status=='draft' && order.config_id[0]==self.state.shop_id).length |
|
|
|