تخطي للذهاب إلى المحتوى
القائمة
لقد تم الإبلاغ عن هذا السؤال
1744 أدوات العرض

Hi, I need to show only the types that have the warehouse of the user logged, in the stock summary (stock.picking.type)


Therefore I made an ir.actions.server that calls python code to filter and it works fine, showing only the expected types


ir.actions.server



Show own stock picking type


ir.actions.server
kanban
code
action = model.x_open_own_stock_picking_type()



Python function

@api.model
def x_open_own_stock_picking_type(self):
if not self.env.user.has_group('stock.group_stock_manager'):
records = self.env['stock.picking.type'].search([('warehouse_id', '=', self.env.user.property_warehouse_id.id)])
else:
records = self.env['stock.picking.type'].search([])

action = self.env['ir.actions.act_window']._for_xml_id('stock.stock_picking_type_action')

action['domain'] = [('id', 'in', records.ids)]

return action


Expected result





But when I reload the page from the browser, the domain does not work and it shows all again





Can someone help me please


الصورة الرمزية
إهمال
المنشورات ذات الصلة الردود أدوات العرض النشاط
1
نوفمبر 23
6
2
أغسطس 24
4174
2
يناير 24
2055
1
نوفمبر 23
2249
5
أكتوبر 22
13857