콘텐츠로 건너뛰기
메뉴
커뮤니티에 참여하려면 회원 가입을 하시기 바랍니다.
신고된 질문입니다
1 회신
3858 화면

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.

관련 게시물 답글 화면 활동
1
5월 22
2794
2
9월 22
8715
1
6월 25
15383
3
4월 25
5556
Compute Fields 해결 완료
2
7월 24
2589