Zum Inhalt springen
Menü
Sie müssen registriert sein, um mit der Community zu interagieren.
Diese Frage wurde gekennzeichnet
2 Antworten
6440 Ansichten

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.

Avatar
Verwerfen
Beste Antwort

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.

Avatar
Verwerfen
Verknüpfte Beiträge Antworten Ansichten Aktivität
1
Jan. 25
2561
0
Juli 24
5677
5
Juni 16
7058
1
Dez. 22
8850
0
Jan. 18
4802