You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

20 lines
783 B

  1. from odoo import models, _
  2. from odoo.exceptions import ValidationError
  3. class PosSession(models.Model):
  4. _inherit = 'pos.session'
  5. def action_pos_session_close(self):
  6. for rec in self:
  7. if (
  8. rec.picking_count
  9. and not rec.config_id.allow_session_closing_with_stock_errors
  10. ):
  11. raise ValidationError(_(
  12. "It's not possible to close the session %s because it has "
  13. "%i picking error(s).\nPlease resolve them or enable "
  14. "'Allow closing sessions with stock errors' in "
  15. "PoS Configuration: %s.") % (
  16. rec.name, rec.picking_count, rec.config_id.name))
  17. return super().action_pos_session_close()