Перейти к содержимому
Меню
Чтобы взаимодействовать с сообществом, необходимо зарегистрироваться.
Этот вопрос был отмечен
2 Ответы
6031 Представления

In a One2many field I added a button to navigate to a relation module. I found out how to clear the breadcrumb, but cannot get the menu_id to change.


    def open_one2many_line(self):

        context = self.env.context

        return {

            'type': 'ir.actions.act_window',

            'views': [[False, "form"]],

            'target': 'main',

            'res_model': self._name,

            'res_id': context.get('default_active_id'),

            'menu_id': "90"

        }


I tried adding menu_id into the return value of my action function. It had no effect.

Аватар
Отменить
Лучший ответ

Hi, 
If you have a O2M with a button in each line. When you click on that buton the record's form view should be displayed, then you only have to add this exemple: 

def open_one2many_line(self):
   self.ensure_one()
   return {
        'name': _('Something'),
        'view_type': 'form',
        'view_mode': 'form',
       'view_id': xml_id of your view, 
        'res_model': self._name,
        'context': self._context,
       'type': 'ir.actions.act_window',
       'nodestroy': True,
       'target': 'current',
       'res_id': self.id,

        }

You don't need a menu as the view types are linked to the action, not to menu.


Hopethis helps. upvote if it does.

Regards.

Аватар
Отменить
Related Posts Ответы Просмотры Активность
1
янв. 25
1857
0
июл. 24
5430
5
июн. 16
6805
1
дек. 22
8515
0
янв. 18
4584