Skip to Content
Menu
This question has been flagged
1 Reply
2056 Views

Dear All


Good day. We have the below case. your help is urgently needed:


Enterprise subscription, Odoo 11/12. On the order screen, we have "no of PACKS" field, and we have "KG/PACK" field.

We need to calculate PACK * KG/PACK and put the result in the "ORDERED QUANTITY" filed which is a system field.


My questions are:

1. Can this be done using Studio without Python?

2. If not, Can this be done using Python?

3. we are on a demo instance, and sometimes when we need to open the code, we can not. WIll this limitation be removed when the customer subscribes officially?


thank you in advance.


Great day

Avatar
Discard
Best Answer

Hi Ahmad

1. To keep it in regular Odoo, you could add an automated action on the update/creation of a sale.order.line record. The main issue here is that it will not update as you type in the numbers, only once the record is saved.

for rec in records:
    if rec.<pack field> and rec.<kg/pack field>:
        rec.product_uom_qty = rec.<pack field> * rec.<kg/pack field>

2. An actual module would be the better way to make this change, allowing an onchange to be added so it updates immediately.

3. The code is always available through the git repository: https://github.com/odoo/odoo 

Cheers,

Jake Robinson

Avatar
Discard