I need a lot of many (product_product_ids) populated based on the search result. For example, I have a search button defined in the wizard window (search_test):
<group>
<field name="quantity"/>
<field name="product_product_ids"/>
</group>
<footer>
<button name="search_test" type="object" string="Search" class="oe_highlight"/>
or
<button string="Cancell" class="oe_link" special="cancel"/>
</footer>
In the wizard model, I defined these fields and functions:
class sale_order_add_balerce(models.TransientModel):
_name = 'sale.order.add_balerce'
_description = 'Sale order add balerce'
_columns = {
'product_product_ids': fields.many2many('product.product', string='Products'),
'quantity' : fields.float('Quantity', default='1.0')
}
def search_test(self, cr, uid, ids, context=None):
if context is None:
context = {}
product_obj=self.pool.get('product.product')
product_ids_list = product_obj.search(cr, uid, [], context=context)
print product_ids_list
self.write(cr, uid, ids, {'product_product_ids': (6, 0, [product_ids_list])})
return {
'res_model': 'product.product',
'type':'ir.ui.view',
'context': context,
'res_id': ids[0]
}
In line
self.write(cr, uid, ids, {'product_product_ids': (6, 0, [product_ids_list])})
I am trying to update a lot of many fields after the search process, but nothing happens and I see no errors. I also tried with these options:
self.write(cr, uid, ids, {'product_product_ids': (0, 0, [product_ids_list])})
self.create(cr, uid,{'product_product_ids': (6, 0, [product_ids_list])})
self.create(cr, uid, ids, {'product_product_ids': (0, 0, [product_ids_list])})
However, I still do not fill out my many many fields (I do not see any changes in the view).
Does anyone have a suggestion?