diff --git a/addons/point_of_sale/i18n/point_of_sale.pot b/addons/point_of_sale/i18n/point_of_sale.pot index 14f672223cf..68059381036 100644 --- a/addons/point_of_sale/i18n/point_of_sale.pot +++ b/addons/point_of_sale/i18n/point_of_sale.pot @@ -4387,6 +4387,20 @@ msgstr "" msgid "Slash" msgstr "" +#. module: point_of_sale +#: model:product.product,name:point_of_sale.small_shelf +#: model:product.template,name:point_of_sale.small_shelf_product_template +msgid "Small Shelf" +msgstr "" + +#. module: point_of_sale +#: code:addons/point_of_sale/models/pos_session.py:0 +#, python-format +msgid "" +"Some Cash Registers are already posted. Please reset them to new in order to close the session.\n" +"Cash Registers: %r" +msgstr "" + #. module: point_of_sale #. openerp-web #: code:addons/point_of_sale/static/src/js/Chrome.js:0 diff --git a/addons/point_of_sale/models/pos_session.py b/addons/point_of_sale/models/pos_session.py index 9c57550480f..af1b7ba1fa8 100644 --- a/addons/point_of_sale/models/pos_session.py +++ b/addons/point_of_sale/models/pos_session.py @@ -177,6 +177,13 @@ class PosSession(models.Model): if (company.period_lock_date and start_date <= company.period_lock_date) or (company.fiscalyear_lock_date and start_date <= company.fiscalyear_lock_date): raise ValidationError(_("You cannot create a session before the accounting lock date.")) + def _check_bank_statement_state(self): + for session in self: + closed_statement_ids = session.statement_ids.filtered(lambda x: x.state != "open") + if closed_statement_ids: + raise UserError(_("Some Cash Registers are already posted. Please reset them to new in order to close the session.\n" + "Cash Registers: %r", list(statement.name for statement in closed_statement_ids))) + @api.model def create(self, values): config_id = values.get('config_id') or self.env.context.get('default_config_id') @@ -277,6 +284,7 @@ class PosSession(models.Model): # Session without cash payment method will not have a cash register. # However, there could be other payment methods, thus, session still # needs to be validated. + self._check_bank_statement_state() if not self.cash_register_id: return self._validate_session(balancing_account, amount_to_balance)