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

Search products from the sale order [Bug?]

By
Mind And Go
on 1/17/14, 5:05 AM 918 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

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

0 follower(s)

Stats

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