Hello, I have this function where i create a payment:
def action_order_paid(self):
self.write({'paid': True})
for record in self:
delivery_payment = self.env['account.payment'].create({
'amount': self.delivery_total,
'date': fields.Date.context_today(self),
'currency_id': self.currency_id.id,
'payment_type': 'inbound',
'partner_type': 'customer',
'journal_id': 6,
'partner_id':self.partner_id.id,
})
delivery_payment.action_post()
i want to link this payment with an invoice, can anyone help me with that?
Thanks!