Skip to Content
Меню
Вам необхідно зареєструватися, щоб взаємодіяти зі спільнотою.
Це запитання позначене
1 Відповісти
6861 Переглядів

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

Related Posts Відповіді Переглядів Дія
2
груд. 24
21121
0
вер. 24
1017
3
серп. 24
2105
0
лют. 24
1431
0
лют. 24
993