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.

30 lines
904 B

  1. # -*- coding: utf-8 -*-
  2. # Copyright 2019 Jacques-Etienne Baudoux (BCIM sprl) <je@bcim.be>
  3. # License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
  4. from openerp import api, models
  5. class PosOrder(models.Model):
  6. _inherit = "pos.order"
  7. @api.multi
  8. def test_paid(self):
  9. """A Point of Sale is paid when the sum
  10. @return: True
  11. """
  12. for order in self:
  13. if order.lines and not order.amount_total:
  14. return True
  15. if not order.lines:
  16. return False
  17. if not order.statement_ids:
  18. return False
  19. amount = abs(order.amount_total-order.amount_paid)
  20. if any(order.statement_ids.mapped('journal_id.round_payment')):
  21. test = 0.021
  22. else:
  23. test = 0.009
  24. if amount >= test:
  25. return False
  26. return True