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

How to popluate many2many field from another many2many fields? [Closed]

By
Anirudh Lou
on 8/11/15, 5:52 AM 342 views

The Question has been closed for reason: not relevant or out dated

by
Anirudh Lou
on 08/21/2015 23:59:38

After a lot of trial i still no chance of getting it correctly. The problem is this:

In class crm_lead i have this definition:

    'tax_id' : fields.many2many('account.tax',....)

In sale_order_line class there is also a definition that has many2many in account_tax same with the above.

There is a method that get all tax_id in crm_lead and put it into sale_order_line. I tried this kind of code:

...
_logger.info("\n\t\t\tTax %s"%(str(sale_order.lead_id.tax_id)))
tax_id = [tax.id for tax in self.pool.get('account.tax').browse(cr,uid,sale_order.lead_id.tax_id,context=context)]
#tax_id = [sale_order.lead_id['tax_id'][0]])]
line = {
'order_id' : sale_order.id,
'product_id' : sale_order.lead_id.product_id.id,
'product_uom_qty' : 1,
'product_uos_qty' : 1,
'price_unit' : sale_order.lead_id.product_id.list_price,
'name' : sale_order.lead_id.product_id.id,
'tax_id' : sale_order.lead_id.tax_id,
'discount' : sale_order.lead_id.discount_rate,
}
self.pool.get('sale.order.line').create(cr,uid,line,context=context)
...

How ever when i try to view my sale_order_line the tax_id has no value. What mistake did i committed?

By the way my logger output something like this:


2015-08-11 08:39:59,534 29607 INFO machine_problem51


Hello World!!!
Testing code 1 2 3 ...:
Tax [browse_record(account.tax, 7)]


Any help is much appreciated

About This Community

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

Question tools

1 follower(s)

Stats

Asked: 8/11/15, 5:52 AM
Seen: 342 times
Last updated: 8/21/15, 11:59 PM