This question has been flagged

Can i use ORM methods like create or write to edit fields like a one2many or a reference one? How would i access them?

Let's say i want to create a function that when called creates a new menu, but the menu must have referenced action that is made up of a selection field wich then becomes a many2one, right? How would i call this many2one? Should i set first the selection with create then edit the many2one with write?

 Menu.create(cr, uid, {'name':menu_name, 'parent_id': parent_id[0],
                                        'icon': 'STOCK_JUSTIFY_FILL',
                                        'sequence': 2,
                                        'action': '[ir.actions.act_window]'} , context=None)
new_menu_ids = Menu.search(cr, uid, [('name','=','menu_name')], limit=1, context=None)
Menu.write(cr, uid, new_menu_ids[0], {'action':action_wanted.id}, context=None)

Thanks

Avatar
Discard