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.

27 lines
944 B

  1. # Copyright (C) 2016-Today: La Louve (<http://www.lalouve.net/>)
  2. # Copyright (C) 2019-Today: Druidoo (<https://www.druidoo.io>)
  3. # @author: Sylvain LE GAL (https://twitter.com/legalsylvain)
  4. # License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
  5. from odoo import models, api, _
  6. from odoo.exceptions import UserError
  7. class PosMakePayment(models.TransientModel):
  8. _inherit = 'pos.make.payment'
  9. @api.multi
  10. def check(self):
  11. # Load current order
  12. order_obj = self.env['pos.order']
  13. order = order_obj.browse(self.env.context.get('active_id', False))
  14. # Check if control is required
  15. if not order.partner_id\
  16. and order.session_id.config_id.require_customer != 'no':
  17. raise UserError(_(
  18. "An anonymous order cannot be confirmed.\n"
  19. "Please select a customer for this order."))
  20. return super(PosMakePayment, self).check()