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.

28 lines
1017 B

  1. # coding: utf-8
  2. # Copyright (C) 2013 - Today: GRAP (http://www.grap.coop)
  3. # @author: Julien WESTE
  4. # @author: Sylvain LE GAL (https://twitter.com/legalsylvain)
  5. # License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
  6. from openerp import api, models
  7. class AccountVoucher(models.Model):
  8. _inherit = 'account.voucher'
  9. # Override section
  10. @api.multi
  11. def recompute_voucher_lines(
  12. self, partner_id, journal_id, price, currency_id, ttype, date):
  13. move_line_obj = self.env['account.move.line']
  14. res = super(AccountVoucher, self).recompute_voucher_lines(
  15. partner_id, journal_id, price, currency_id, ttype, date)
  16. for voucher_type in ['line_dr_ids', 'line_cr_ids']:
  17. for voucher_line in res['value'][voucher_type]:
  18. move_line = move_line_obj.browse(voucher_line['move_line_id'])
  19. if move_line.invoice.pos_pending_payment:
  20. res['value'][voucher_type].remove(voucher_line)
  21. return res