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

I'm trying to add a computed field from the UI (x_my_field) to the model sale.order whose value is computed based on 2 other fields, let's say field1 from the model sale.order.line and field2 from the model mrp.bom.line : 

x_my_field = sale_order_line.field1 * mrp_bom_line.field2 

But i can't figure out how to add the correct dependencies !!! to make it work.

All fields are of type float.

Any advice or help !



Аватар
Відмінити
Найкраща відповідь

Are you editing odoo base? Editing odoo base is not recommended.

I would recommend creating another module that depends on mrp and sale (define it on the manifest). 

https://www.odoo.com/forum/help-1/getting-started-with-editing-community-source-code-182202

https://www.odoo.com/documentation/master/developer/tutorials/backend.html

Then you can inherit 'sale.order' and change it as you see fit.

Hope that helps.

Аватар
Відмінити
Автор

Thank you, but i just want to add this field from the UI

I don't have much experience on the UI part. What you are saying may not be possible, as you are accessing a field from another module that does not depend on the previous field module (if that makes any sense: you are binding 'mrp' to 'sales', even tho it was not designed this way).
Hope someone can clarify you if that can work or not.

PD: You can try creating a module using studio, and make the field there, and then just create the views... Not sure if that would work either.

Related Posts Відповіді Переглядів Дія
1
трав. 22
2688
2
вер. 22
8583
1
черв. 25
14950
3
квіт. 25
4960
Compute Fields Вирішено
2
лип. 24
1953