Reputation: 21
I'm trying to create a payment related to an invoice via XML RPC (Odoo11) and I can't figure how. Can you give me an example of a payment insertion via XML RPC ? Which method should I call & with what arguments ?
Thanks !
Upvotes: 1
Views: 619
Reputation: 21
After a long search I found how to do it. I put you here the solution if it can help someone in the future
def create_payment(odoo, vals, invoice_id):
"""
Create payment line
:param odoo: odoo client
:param vals: amount, pay_date
:param invoice_id: id of invoice
:return:
"""
mod = odoo.env['account.payment']
id = mod.create(vals)
mod.browse(id).invoice_ids = [invoice_id]
mod.browse(id).post()
I also put the code to create a full invoice under odoo 11 with payment. here
Upvotes: 1