mirror of
https://github.com/OCA/bank-payment.git
synced 2025-02-02 10:37:31 +02:00
[IMP] improve selection of customer credit notes to pay
This commit is contained in:
@@ -45,9 +45,22 @@ class PaymentOrderCreate(models.TransientModel):
|
||||
@api.model
|
||||
def extend_payment_order_domain(self, payment_order, domain):
|
||||
if payment_order.payment_order_type == 'payment':
|
||||
domain += [('account_id.type', 'in', ('payable', 'receivable')),
|
||||
('credit', '>', 0)]
|
||||
return True
|
||||
# For payables, propose all unreconciled credit lines,
|
||||
# including partially reconciled ones.
|
||||
# If they are partially reconciled with a supplier refund,
|
||||
# the residual will be added to the payment order.
|
||||
#
|
||||
# For receivables, propose all unreconciled credit lines.
|
||||
# (ie customer refunds): they can be refunded with a payment.
|
||||
# Do not propose partially reconciled credit lines,
|
||||
# as they are deducted from a customer invoice, and
|
||||
# will not be refunded with a payment.
|
||||
domain += [('credit', '>', 0),
|
||||
'|',
|
||||
('account_id.type', '=', 'payable'),
|
||||
'&',
|
||||
('account_id.type', '=', 'receivable'),
|
||||
('reconcile_partial_id', '=', False)]
|
||||
|
||||
@api.model
|
||||
def filter_lines(self, lines):
|
||||
|
||||
Reference in New Issue
Block a user