Bỏ qua để đến Nội dung
Menu
Câu hỏi này đã bị gắn cờ
2 Trả lời
12761 Lượt xem

I have created a custom computed field that I would like to filter and group in the list view.

To achieve that, I know that it should be `stored`, which requires one or more fields in `dependencies`.

My custom field is to be displayed in the Sales Orders model but I would like the field to be updated when there is a state change in Stock Picking.

I tried typing in `stock.picking.state` but it doesn't recognize `stock`.

Ảnh đại diện
Huỷ bỏ

Thanks but it's not working, unfortunately :)

Through the Odoo UI it's not possible to compute a field based on another field!  

I have to go through an automated action to update this field!

Câu trả lời hay nhất

Hi,

you can use 'picking_ids.state' on dependence

@api.depends('picking_ids.state')
def _your_function(self):


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

Thank you! I will try it. The main thing is that since I'm new to Odoo and its model structure, I don't know the available model object keys (e.g. picking_ids).

Is there a chart or documentation on the anatomy of Odoo models? (I know the source code itself is a great place to check, but it takes time).

You can check all fields of respective models by searching on

settings > Technical Settings > models

you can search you model is there , and get all fields and respective details of each field

Câu trả lời hay nhất

Try, using the relation field in dependencies. You can try creating a related field and use it in dependencies. S create a related field that has the state.


https://www.odoo.com/documentation/12.0/reference/orm.html#fields

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

That's a good idea! Thank you.

No problem

Bài viết liên quan Trả lời Lượt xem Hoạt động
0
thg 7 22
2441
3
thg 3 21
14609
0
thg 10 17
4117
1
thg 6 25
5070
3
thg 7 20
11705