mirror of
https://github.com/OCA/knowledge.git
synced 2025-12-22 21:32:18 -06:00
[FIX] PEP8 errors in Odoo code only
This commit is contained in:
@@ -22,6 +22,7 @@
|
||||
from openerp import SUPERUSER_ID
|
||||
from openerp.osv import fields, osv
|
||||
|
||||
|
||||
class document_page_create_menu(osv.osv_memory):
|
||||
""" Create Menu """
|
||||
_name = "document.page.create.menu"
|
||||
@@ -29,13 +30,17 @@ class document_page_create_menu(osv.osv_memory):
|
||||
|
||||
_columns = {
|
||||
'menu_name': fields.char('Menu Name', size=256, required=True),
|
||||
'menu_parent_id': fields.many2one('ir.ui.menu', 'Parent Menu', required=True),
|
||||
'menu_parent_id': fields.many2one('ir.ui.menu', 'Parent Menu',
|
||||
required=True),
|
||||
}
|
||||
|
||||
def default_get(self, cr, uid, fields, context=None):
|
||||
if context is None:
|
||||
context = {}
|
||||
res = super(document_page_create_menu,self).default_get(cr, uid, fields, context=context)
|
||||
res = super(document_page_create_menu, self).default_get(cr, uid,
|
||||
fields,
|
||||
context=
|
||||
context)
|
||||
page_id = context.get('active_id')
|
||||
obj_page = self.pool.get('document.page')
|
||||
page = obj_page.browse(cr, uid, page_id, context=context)
|
||||
@@ -46,7 +51,6 @@ class document_page_create_menu(osv.osv_memory):
|
||||
if context is None:
|
||||
context = {}
|
||||
obj_page = self.pool.get('document.page')
|
||||
obj_view = self.pool.get('ir.ui.view')
|
||||
obj_menu = self.pool.get('ir.ui.menu')
|
||||
obj_action = self.pool.get('ir.actions.act_window')
|
||||
page_id = context.get('active_id', False)
|
||||
@@ -71,14 +75,15 @@ class document_page_create_menu(osv.osv_memory):
|
||||
value['res_id'] = page.id
|
||||
|
||||
action_id = obj_action.create(cr, SUPERUSER_ID, value)
|
||||
# only the super user is allowed to create menu due to security rules on ir.values
|
||||
# only the super user is allowed to create menu due to security rules
|
||||
# on ir.values
|
||||
menu_id = obj_menu.create(cr, SUPERUSER_ID, {
|
||||
'name': data.menu_name,
|
||||
'parent_id':data.menu_parent_id.id,
|
||||
'icon': 'STOCK_DIALOG_QUESTION',
|
||||
'action': 'ir.actions.act_window,'+ str(action_id),
|
||||
}, context)
|
||||
obj_page.write(cr, uid, [page_id], {'menu_id':menu_id})
|
||||
'name': data.menu_name,
|
||||
'parent_id': data.menu_parent_id.id,
|
||||
'icon': 'STOCK_DIALOG_QUESTION',
|
||||
'action': 'ir.actions.act_window,' + str(action_id),
|
||||
}, context)
|
||||
obj_page.write(cr, uid, [page_id], {'menu_id': menu_id})
|
||||
return {
|
||||
'type': 'ir.actions.client',
|
||||
'tag': 'reload',
|
||||
|
||||
Reference in New Issue
Block a user