Bỏ qua để đến Nội dung
Menu
Câu hỏi này đã bị gắn cờ

I am currently running Odoo v13 Community Edition and I am finding a few problems I need help with.

So I am trying to use the env('purchase.order').search() method to find a specific purchase order. I am using this function in the purchase.order.line model.

The specific purchase order record I need is the record that the order line is in. I do not know how do I get that record. I specifically want a field inside the purchase order model called "currency_rate". There is only 1 currency_rate value per purchase order but the values can differ from one purchase order to another. The currency_rate field has the label "Currency Rate".


Can anyone help me please?

Thank you in advance

Ảnh đại diện
Huỷ bỏ
Câu trả lời hay nhất

Hi,

If you are inside the purchase.order.line model and if you need to get a field value from the purchase.order model, you can get it like this, self.order_id.currency_rate , where self is expected to be the object of purchase.order.line model and order_id is a many2one field connecting to purchase.order model.


Thanks

Ảnh đại diện
Huỷ bỏ
Tác giả

Thank you soo much man it worked!

Bài viết liên quan Trả lời Lượt xem Hoạt động
2
thg 10 20
2950
1
thg 1 23
6016
2
thg 11 22
3065
1
thg 9 21
6993
0
thg 1 24
1975