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

Can the 'SPB' printout be deleted under certain conditions?

For example, the 'SPB' printout will not appear if the stock_picking state is 'done'

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

Hi, 


By using fields_view_get() function, you can hide the menu based on the condition.

class StockPicking(models.Model):

_inherit = 'stock.picking'

@api.model
def fields_view_get(self, view_id=None, view_type='form', toolbar=False,
submenu=False):
res = super(StockPicking, self).fields_view_get(
view_id=view_id, view_type=view_type, toolbar=toolbar,
submenu=submenu)
#
#
#Add your condition
#
if ((view_type in ['tree', 'form']) and
res.get('toolbar') and res['toolbar'].get('print')):
res['toolbar'].get('print', []).clear()
return res

You can hide your specific menu from the toolbar by adding the appropriate condition


Hope it helps.

Ảnh đại diện
Huỷ bỏ
Bài viết liên quan Trả lời Lượt xem Hoạt động
1
thg 5 25
1052
1
thg 11 24
19264
0
thg 9 24
1360
1
thg 6 24
1700
1
thg 5 24
1872