Skip to Content
Menu
This question has been flagged
3 Replies
5729 Views

Hi,

I am creating Android app for Odoo, but got a problem about creating and registering payment for an invoice via XML-RPC. Basically, I am stuck on creating payment for that invoice. I don't know how it work.

Could you guys help me give an example about this?

Thank a lot.


Avatar
Discard

you really haven't explained anything... so it's impossible to help you. https://en.wikipedia.org/wiki/XML-RPC. when you connect to the odoo xml-rpc server you need to call the execute(odoo_dbname, uid, odoo_user_pwd, 'res.partner', 'search', [('parent_id', '=', 1)])

Best Answer

I did something similar to yours lately and here is what I did:


@api.one
def resolve_payment(self):
company_id = self.company_id
journal_id = self.env['account.journal'].search([('type', 'in', ['bank', 'cash'])], limit=1)
payment_method_ids = self.journal_id.inbound_payment_method_ids or self.journal_id.outbound_payment_method_ids
payment_id = self.env['account.payment'].with_context(active_ids=[self.id], active_model='account.invoice').create({
'amount': self.residual,
'journal_id': journal_id.id,
'payment_method_id': payment_method_ids and payment_method_ids[0].id
})
payment_id.action_validate_invoice_payment()
return payment_id.id
I added this code in account.invoice model
I called this method after calling action_invoice_open method


Avatar
Discard
Best Answer

please help... i'm stuck in here tooo

Avatar
Discard
Related Posts Replies Views Activity
0
Nov 18
2284
1
Mar 23
2976
1
Oct 22
9460
7
Jan 22
16145
1
Jan 24
13237