Odoo Help

0

Search products from the sale order [Bug?]

By
Mind And Go
on 1/17/14, 5:05 AM 1,099 views

Hy,

I'm trying to make a filter from sale.order on products . I succeed in working with fields.related :

'product_ids':fields.related("order_line","product_id",type="one2many",relation="product.product",string="Produits",store=False),

Unfortunately, when I try to duplicate, I have this issue : (http://pastebin.com/sWypdH37)

File "/home/florent/DEV/Serveurs/openerp-7.0-series/server/openerp/osv/fields.py", line 1223, in <genexpr>
res = dict((id, value and map(int, value) or []) for id, value in res.iteritems())

TypeError: argument 2 to map() must support iteration

Could you tell me if it could be considered as a bug? Is there a better way to get all the sale.orders that have a specific product inside?

regards

0
Leonardo Pistone
On 1/17/14, 5:38 AM

Hi,

When you say you succeed in working... you mean the field works as expected? Have you tried to show it in the view and see if the products show up as expected?

If not, you could try setting the field as many2many instead of one2many.

As another, more general option, if you don't manage with the related field, you could add in the sale order a function field with a fnct_search, and show it in the search view. As an example, see the field search_all_attributes in lot.py, lp:openerp-product-attributes/6.1/production_lot_custom_attributes.

Hy Leonardo, yes I succeed in filtering on the products. The problem is only when I duplicate. I'll try in many2many and let you know. BTW, thanks for the fast answer

Mind & Go, Mind And Go
on 1/17/14, 5:49 AM

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

0 follower(s)

Stats

Asked: 1/17/14, 5:05 AM
Seen: 1099 times
Last updated: 3/16/15, 8:10 AM