İçereği Atla
Menü
Bu soru işaretlendi
1 Cevapla
6791 Görünümler

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) 
Avatar
Vazgeç
En İyi Yanıt

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

Avatar
Vazgeç
Üretici

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

İlgili Gönderiler Cevaplar Görünümler Aktivite
2
Ara 24
21037
0
Eyl 24
983
3
Ağu 24
2047
0
Şub 24
1344
0
Şub 24
957