Skip ke Konten
Menu
Pertanyaan ini telah diberikan tanda
1 Balas
3250 Tampilan

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

Avatar
Buang
Jawaban Terbai

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.

Avatar
Buang
Penulis

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