Odoo Help

0

How can I add taxes to invoice lines using API (xmlrpc)?

By
Cole
on 4/30/15, 9:39 AM 1,517 views

Hello, I'm trying to create invoices via API: first i create a record in account_invoice with:

invoice_id = sock.execute(dbname, uid, pwd, 'account.invoice', 'create', invoice)

then I create the lines I need in account_invoice_lines:

sock.execute(dbname, uid, pwd, 'account.invoice.line', 'create', invoice_line)

It's all working well until now, but checking the invoices i noticed that I need to add taxes in every line, so I decided to create a new record for every line in account_invoice_line_tax but when I run this:

sock.execute(dbname,uid,pwd, 'account.invoice.line.tax', 'create', account_invoice_line_tax)

It gives me this error:

Object account.invoice.line.tax doesn't exist: ''>

I assume that account.invoice.line.tax can't be treated like a model, so how can I add taxes to invoice lines using API?

Or there's a better way for insert invoices?

Any help or tips are appreciated.

1

Hi,

you need to give one field when you create new invoice line that is as like under. It will added taxes into your invoice lines.

invoice_line.update( { 'invoice_line_tax_id' : [ (6, 0 , [tax_ids] ) ] }) # here you need search tax_ids which you want to apply. Normally all taxes are comes from product. You can also get all taxes by calling of the on_change of product.

After set of the above field you will get that tax into invoice lines. 

About This Community

This platform 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.

Register

Odoo Training Center

Access to our E-learning platform and experience all Odoo Apps through learning videos, exercises and Quizz.

Test it now

Question tools

2 follower(s)

Stats

Asked: 4/30/15, 9:39 AM
Seen: 1517 times
Last updated: 5/4/15, 3:01 AM