Odoo Help

Welcome!

This community is for beginners and experts willing to share their Odoo knowledge. It's not a forum to discuss ideas, but a knowledge base of questions and their answers.

0

XML RPC - Pay Invoice

By
Jesse Rye
on 3/2/16, 6:07 PM 416 views

Is there anyway to pay an invoice using the XML RPC such as with exec_workflow()?

Dear ,

Thank you for emailing Cotton Babies. Our customer service system has received your email. Your ticket number is XQM-55694-261. Please reference this ticket number if you contact Cotton Babies about this issue.

If the issue you emailed about is time sensitive (address change, shipping upgrades, payment updates, order cancellations), please make note of the ticket number above and then give us a call at 1-888-332-2243.

Our customer service team is available to respond to customer messages on normal business days, 9am - 5pm CST.  We are occasionally closed for holidays.  Our goal is to respond to customer emails within one business day.

Just emailing for help with a return? Returns are easy! More information and instructions for processing a return can be found here:

http://www.cottonbabies.com/info.php#returns

Our Cloth Diapering Basics may have answers to many of your questions:
http://www.cottonbabies.com/clothdiapers.php

We know your time is extremely valuable, thank you for writing us, we will get back to you as soon as we possibly can.

Kindest regards,


Cotton Babies Customer Service Team
contactus@cottonbabies.com
1-888-332-2243
on 5/9/16, 5:09 PM
3

Axel Mendoza

--Axel Mendoza--
10308
| 7 7 8
Camaguey, Cuba
--Axel Mendoza--

DevOps - Full stack - Software Architect - Developer - Technology Integrator

I could help you to develop anything and solve complex problems based on technologies, integrations and tricky stuffs mostly in Python with OpenERP/Odoo, Zato, Django and many others frameworks programming languages and technologies.

I offers consulting services to anyone with an unanswered questions or needs for customizations. Think about it, maybe it's better to have an expert to solve your issues and projects than having a full time employee trying to understand what to do an how

Reach me at aekroft@gmail.com

Axel Mendoza
On 3/2/16, 6:28 PM

This is how I do it in Zato ESB using their integration with Odoo, you could take it as an example or a seudo-code but it's working ok and contains all the steps, obviously you need to adapt it because the following code is not complete:

invoice_pool = zoe.get_model('account.invoice')

voucher_pool = zoe.get_model('account.voucher')

journal_pool = zoe.get_model('account.journal')

partner_pool = zoe.get_model('res.partner')

invoice_info = invoice_pool.read([int(vals.get('id_invoice'))], ['partner_id', 'name', 'company_id', 'currency_id', 'type', 'state'])

if invoice_info:

invoice_info = invoice_info[0]

if invoice_info['state'] != 'open':

self.report_error("The invoice with code %s is not validated"% vals.get('id_invoice'))

return

else:

self.report_error("Invoice not found with id %s"% vals.get('id_invoice'))

return

partner_info = partner_pool.read([invoice_info['partner_id'][0]], ['is_company', 'parent_id'])[0]

while not partner_info['is_company'] and partner_info['parent_id']:

partner_info = partner_pool.read([invoice_info['parent_id'][0]], ['is_company', 'parent_id'])[0]

journal_id = journal_pool.search([('code', '=', vals.get('journal_code'))])

if not journal_id:

self.report_error("There is no journal asociated with this code: %s"%(vals.get('journal_code')))

return

result = voucher_pool.onchange_journal([],journal_id[0], [], False, partner_info['id'], False, float(vals.get('amount_payment')), 'receipt', invoice_info['company_id'][0], context={'invoice_id': invoice_info['id']})

voucher_vals = result['value']

voucher_vals.update({

'type': 'receipt',

'date': vals.get('fecha'),

'amount': float(vals.get('amount_payment')),

'partner_id': partner_info['id'],

'reference': invoice_info['name'],

'company_id': invoice_info['company_id'][0],

'journal_id': journal_id[0],

})

line_cr_ids = voucher_vals.pop('line_cr_ids')

voucher_vals['line_cr_ids'] = [(0,0,cr) for cr in line_cr_ids]

voucher_id = voucher_pool.create(voucher_vals)

ctx = {

'payment_expected_currency': invoice_info['currency_id'][0],

'close_after_process': True,

'invoice_type': invoice_info['type'],

'invoice_id': invoice_info['id'],

'type': 'receipt',

}

voucher_pool.button_proforma_voucher([voucher_id], context=ctx)

voucher_ids[invoice_info['id']] = voucher_id

You just need to change it to xmlrpclib if you use it, like this search example:

uid = oerp_common.authenticate(db, 'admin', password, {})

oerp_models = xmlrpclib.ServerProxy('{}/xmlrpc/2/object'.format(url))ids = oerp_models.execute_kw(db, uid, password,'ir.module.module', 'search',[[['name', '=', module]]])s

Hope this helps

0
Jesse Rye
On 3/13/16, 9:45 PM

Thanks. I'll give this methodology a try.

Your Answer

Please try to give a substantial answer. If you wanted to comment on the question or answer, just use the commenting tool. Please remember that you can always revise your answers - no need to answer the same question twice. Also, please don't forget to vote - it really helps to select the best questions and answers!

About This Community

This community is for professionals and enthusiasts of our products and services. Read Guidelines

Question tools

1 follower(s)

Stats

Asked: 3/2/16, 6:07 PM
Seen: 416 times
Last updated: 3/13/16, 9:45 PM