跳至內容
選單
此問題已被標幟
4912 瀏覽次數

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

頭像
捨棄
相關帖文 回覆 瀏覽次數 活動
3
9月 21
7159
0
6月 18
3662
0
3月 15
4430
0
3月 15
5537
1
3月 15
8779