Skip to Content
Меню
Вам необхідно зареєструватися, щоб взаємодіяти зі спільнотою.
Це запитання позначене
1 Відповісти
604 Переглядів

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

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

Аватар
Відмінити
Найкраща відповідь

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.

Аватар
Відмінити
Related Posts Відповіді Переглядів Дія
1
трав. 25
754
1
лист. 24
18737
0
вер. 24
1108
1
черв. 24
1448
1
трав. 24
1670