Odoo Help


1 Answer
Julian Hammer
24‏/6‏/2014 11:07 ص

I found out that you need to use the onchange functions:

# Load default values
>>> oerp.execute('pos.order.line', 'default_get',
... ["product_id","price_unit","price_subtotal","price_subtotal_incl","qty","discount"])
{'discount': 0.0, 'qty': 1}

# Recalculate price if pricelist was already "asked" order price was manualy
# changed
# onchange_qty(ids, product, discount, qty, price_unit)
>>> oerp.execute('pos.order.line', 'onchange_qty', [], 700, False, 1, 23)
{'value': {'price_subtotal': 23.0, 'price_subtotal_incl': 23.0}}

# Recalculate price based on pricelist
# onchange_product_id(ids, pricelist, product_id, qty=0, partner_id=False) [calcs price]
>>> oerp.execute('pos.order.line', 'onchange_product_id', [], 1, 700, 23)
{'value': {'price_subtotal': 1.3800000000000001,
  'price_subtotal_incl': 1.3800000000000001,
  'price_unit': 0.06}}

Ask a Question
Keep Informed
1 follower(s)
About This Community

This platform is for beginners and experts willing to share their Odoo knowledge. It's not a forum to discuss ideas, but a knowledge base of questions and their answers.

Odoo Training Center

Access to our eLearning platform and experience all Odoo Apps through learning videos, use cases and quizzes.

Test it now