跳至内容
菜单
此问题已终结

i modified the _cart_update function of website_sale to update the field price_unit of sale.order.line. But if i write to the sale.order.line the functional fields of the sale.order.line like price_subtotal are not updated after write?!?

sol_obj = self.pool.get('sale.order.line') 
sol_obj.write(cr, SUPERUSER_ID, [line_id], {'price_unit': 10, }, context=context) 
形象
丢弃
最佳答案

def _website_product_id_change(self, cr, uid, ids, order_id, product_id, qty=0, line_id=None, context=None):

    context = context or
    res = super(sale_order, self)._website_product_id_change(cr, uid, ids, order_id, product_id, qty=qty, line_id=line_id, context=context)

    res.update({'price_unit': 10})

    return res

形象
丢弃
编写者

Thank you very much for the solution - it works. But i really don't get it why?!? i know that _website_product_id_change is used to set the values for writes later on - but why cant i update a sales order line later ?!? Would be really really nice to get a tip why this works but changing sale.order.line later in the process dont.

perhaps not totally correct but : with onchange you are using the current cache of view (you write not in database) then fields function is updated if it depends of field you change, if you write directly in database cache is not changed and function field not too. bye

相关帖文 回复 查看 活动
2
12月 24
21080
0
9月 24
1007
3
8月 24
2092
0
2月 24
1407
0
2月 24
986