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
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)])