[IMP] pos_restaurant: archive shop when restaurant

When restaurant is installed the demo shop is archived if no session has been
made.

closes odoo/odoo#144135

Signed-off-by: Joseph Caburnay (jcb) <jcb@odoo.com>
This commit is contained in:
Loukas Wets (lowe)
2023-12-07 10:07:55 +00:00
parent fbd9de0232
commit ef59f6d448
@@ -135,6 +135,14 @@ class PosConfig(models.Model):
self._set_tips_after_payment_if_country_custom()
self._link_same_non_cash_payment_methods_if_exists('point_of_sale.pos_config_main')
self._ensure_cash_payment_method('MRCSH', _('Cash Restaurant'))
self._archive_shop()
def _archive_shop(self):
shop = self.env.ref('point_of_sale.pos_config_main', raise_if_not_found=False)
if shop:
session_count = self.env['pos.session'].search_count([('config_id', '=', shop.id)])
if session_count == 0:
shop.update({'active': False})
def _setup_default_floor(self, pos_config):
if not pos_config.floor_ids: