[FIX] pos_restaurant: exclude archived floors in get_tables_order_count
Before this commit, archiving a restaurant floor caused an error when opening a PoS restaurant session. This issue originated from the `get_tables_order_count` function, which executed a search based on `restaurant.table`. Since archiving a floor does not automatically archive its tables, the function returned information for archived floors, leading to errors. With this commit, we introduce an additional search to first identify active floors in a PoS config. This refined search is then used to filter tables, ensuring that only tables from active floors are considered. opw-3619830 closes odoo/odoo#145052 X-original-commit: b3ec68c4091276566db32f13346d4440128e42a9 Signed-off-by: Joseph Caburnay (jcb) <jcb@odoo.com> Signed-off-by: Pedram Bi Ria (pebr) <pebr@odoo.com>
This commit is contained in:
@@ -19,7 +19,8 @@ class PosConfig(models.Model):
|
||||
|
||||
def get_tables_order_count_and_printing_changes(self):
|
||||
self.ensure_one()
|
||||
tables = self.env['restaurant.table'].search([('floor_id.pos_config_ids', '=', self.id)])
|
||||
floors = self.env['restaurant.floor'].search([('pos_config_ids', '=', self.id)])
|
||||
tables = self.env['restaurant.table'].search([('floor_id', 'in', floors.ids)])
|
||||
domain = [('state', '=', 'draft'), ('table_id', 'in', tables.ids)]
|
||||
|
||||
order_stats = self.env['pos.order']._read_group(domain, ['table_id'], ['__count'])
|
||||
|
||||
Reference in New Issue
Block a user