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

Hello,

When i click on Inventory module, i've got all warehouses displayed.

I want a default filter to display only stock.picking.type whose warehouse_id = the default warehouse (property_warehouse_id) of the current user

I tried to add the following filter in the search view but it doesn't work

filter string="Mon Entrepôt" name="my_warehouse" domain="[('warehouse_id', '=', user.property_warehouse_id.id)]"


I tried to change user with uid, to add .id at the end or not, but nothing works

Is anybody has an idea ?

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

It is possible to do this in Odoo Studio?

  1. Creating the custom field (ManyToMany)
  2. How has to be the domain? 

​I try with [('stock.picking.type.warehouse_id.x_studio_warehouse_users.id', '=' , user_id.id)] and does not work.


Cheers

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

You need to add custom fields(res.users) on the stock picking type and I’ve already implemented them for me. I will share the details with you for review. You can try it on your side, I hope this will be helpful.

// PYTHON CODE

// Search View Code

// Action Context Pass Value

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

Hi Vincent, 

I am also met with the same challenge as per your question. 

May I know whether you have found a solution for this?

Thank you.

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