Skip to content

Commit

Permalink
[FIX] Add invoice on created payment transactions
Browse files Browse the repository at this point in the history
Also pass the invoice to the transaction reference computation mecanism
so that it reflects the invoice's number.
  • Loading branch information
fcayre committed Jul 2, 2022
1 parent 1e97142 commit a671093
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion contract_payment_auto/models/contract.py
Original file line number Diff line number Diff line change
Expand Up @@ -142,11 +142,14 @@ def _get_tx_vals(self, invoice, token):
""" Return values for creation of a payment.transaction for invoice. """
amount_due = invoice.residual
partner = token.partner_id
reference = self.env['payment.transaction']._compute_reference()
reference = self.env['payment.transaction']._compute_reference({
"invoice_ids": invoice.ids,
})
return {
'reference': '%s' % reference,
'acquirer_id': token.acquirer_id.id,
'payment_token_id': token.id,
'invoice_ids': [(4, invoice.id)],
'amount': amount_due,
'state': 'draft',
'currency_id': invoice.currency_id.id,
Expand Down

0 comments on commit a671093

Please sign in to comment.