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

I am currently running Odoo v13 Community Edition and I am trying to create new fields.

These fields I am creating are inside the purchase.order.line model. These fields are computed but for me to do that I need to get a field called "currency_rate" from the purchase.order model.

I tried to add this before the function:

@api.depends("purchase.order.currency_rate")

but it did not work.

Then I also tried to get the field by using the following 2 methods

x_unit_price = ... * self.super.currency_rate

and

x_unit_price = ... * super.currency_rate

and both did not work

Does anyone know what can I do to get the field?

PS the currency rate field is different between each Purchase Order

I need help please :)

Thank you in advance

아바타
취소
베스트 답변

Hi,

There is a related Many2one field order_id of purchase.order in the model purchase.order.line.So you can get any field of the corresponding purchase order by referring order_id.

If you want to get a field from the purchase.order model in the method which is defined in the purchase.order.line please follow the given steps.

custom_field = self.order_id.custom_field

Regards

아바타
취소
관련 게시물 답글 화면 활동
2
10월 20
3114
1
10월 20
4497
0
5월 22
2756
0
7월 24
2059
1
9월 21
7268