Odoo Help


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.


Understanding many2many field and API create method

on 5/25/16, 8:58 AM 290 views

I want to programaically add pos_order with lines and everything. I have came very far, but now I'm stuck on this issue. How would I pass tax information to pos_order_line. The model has a field called tax_ids, so my first assumption was to just put  tax_ids=[tax_id], but that gets ignored.

After searching many internets, I found out that I need to do something like that:

'tax_ids':[[0, 0, {tax_id}]]

With this I'm getting some xmlrpclib.py error that I don't understand:

File "/usr/lib/python2.7/xmlrpclib.py", line 647, in __dump raise TypeError, "cannot marshal %s objects" % type(value) TypeError: cannot marshal <type 'set'> objects

I'm sorry for spamming the forum, but I cannot help myself with this guy's question, although it looks the same:


I added the comment, but I don't think that question will ever get to the top again, so that's why I'm posting a new one.

This is my actual code that creates an order:

vals = {
'session_id': sid,
'lines': []
for line in myord['lines']:
vals['lines'].append([0, 0, #I also don't understand why these zeros are here :(
'product_id': line['product_id'],
'price_unit': flaot(line['TotalWTax']),
'discount': float(line['DiscountPercent'],
'tax_ids': [[0,0, {line['Tax_id']}]], #This causes my script to crash
'qty': line['Quantity']


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)


Asked: 5/25/16, 8:58 AM
Seen: 290 times
Last updated: 5/25/16, 11:01 AM