[FIX] account_payment: supplier invoice on more then one payment oder
The field move_line_id in payment.order.form only shows account move lines that still have
an amount to pay. This was lost during 333e83f
.
This commit is contained in:
parent
01f2c5c9d2
commit
05908a0fac
|
@ -27,9 +27,12 @@ class account_move_line(osv.osv):
|
|||
_inherit = "account.move.line"
|
||||
|
||||
# delegate to parent, used for local fields.function redefinition
|
||||
def _amount_residual(self, cr, uid, ids, field_names, args, context=None):
|
||||
return super(account_move_line, self)._amount_residual(
|
||||
cr, uid, ids, field_names, args, context=context)
|
||||
def _amount_to_pay(self, cr, uid, ids, field_names, args, context=None):
|
||||
return {
|
||||
id: value['amount_residual']
|
||||
for id, value in self._amount_residual(cr, uid, ids, field_names, args,
|
||||
context=context).items()
|
||||
}
|
||||
|
||||
def _to_pay_search(self, cr, uid, obj, name, args, context=None):
|
||||
if not args:
|
||||
|
@ -95,7 +98,7 @@ class account_move_line(osv.osv):
|
|||
return line2bank
|
||||
|
||||
_columns = {
|
||||
'amount_to_pay': fields.function(_amount_residual,
|
||||
'amount_to_pay': fields.function(_amount_to_pay,
|
||||
type='float', string='Amount to pay', fnct_search=_to_pay_search),
|
||||
}
|
||||
|
||||
|
|
|
@ -60,6 +60,10 @@
|
|||
assert invoice.partner_id == payment_line.partner_id, "Partner is not correct."
|
||||
assert invoice.date_due == payment_line.ml_maturity_date, "Due date is not correct."
|
||||
assert invoice.amount_total == payment_line.amount, "Payment amount is not correct."
|
||||
assert payment_line.move_line_id.amount_to_pay > 0, "Move line paid"
|
||||
assert len(self.pool("account.move.line").search(cr, uid,
|
||||
[('amount_to_pay', '>', 0), ('id', '=', payment_line.move_line_id.id)])) == 0, \
|
||||
"No payment order found for this move line"
|
||||
-
|
||||
After making all payments, I finish the payment order.
|
||||
-
|
||||
|
|
Loading…
Reference in New Issue