diff --git a/addons/document_page/document_page.py b/addons/document_page/document_page.py
index ffcfc07d5ea..486835aeab0 100644
--- a/addons/document_page/document_page.py
+++ b/addons/document_page/document_page.py
@@ -36,13 +36,13 @@ class document_page(osv.osv):
if index:
r = "
"
else:
- r = page.name
+ r = '%s'%(page.id,page.name)
return r
def _get_display_content(self, cr, uid, ids, name, args, context=None):
res = {}
for page in self.browse(cr, uid, ids, context=context):
- if page.type == "index":
+ if page.type == "category":
content = self._get_page_index(cr, uid, page)
else:
content = page.content
@@ -51,9 +51,9 @@ class document_page(osv.osv):
_columns = {
'name': fields.char('Title', required=True),
- 'type':fields.selection([('content','Content'), ('index','Section')], 'Type', help="Page type"),
+ 'type':fields.selection([('content','Content'), ('category','Category')], 'Type', help="Page type"),
- 'parent_id': fields.many2one('document.page', 'Section', domain=[('type','=','index')]),
+ 'parent_id': fields.many2one('document.page', 'Category', domain=[('type','=','category')]),
'child_ids': fields.one2many('document.page', 'parent_id', 'Children'),
'content': fields.text("Content"),
@@ -75,7 +75,7 @@ class document_page(osv.osv):
res = {}
if parent_id and not content:
parent = self.browse(cr, uid, parent_id, context=context)
- if parent.type == "index":
+ if parent.type == "category":
res['value'] = {
'content': parent.content,
}
diff --git a/addons/document_page/document_page_view.xml b/addons/document_page/document_page_view.xml
index 3cfd3b9665b..53ae52818a8 100644
--- a/addons/document_page/document_page_view.xml
+++ b/addons/document_page/document_page_view.xml
@@ -40,18 +40,14 @@
form
@@ -87,16 +83,29 @@
+
+ Category
+ document.page
+ [('type','=','category')]
+ {'default_type': 'category'}
+ form
+ tree,form
+
+
+
+
Pages
document.page
+ [('type','=','content')]
+ {'default_type': 'content'}
form
tree,form
Create web pages
-
+
@@ -134,13 +143,22 @@
form
tree,form
-
-
+
+
diff --git a/addons/document_page/wizard/document_page_create_menu.py b/addons/document_page/wizard/document_page_create_menu.py
index f35107511bf..591cc845a93 100644
--- a/addons/document_page/wizard/document_page_create_menu.py
+++ b/addons/document_page/wizard/document_page_create_menu.py
@@ -27,9 +27,20 @@ class document_page_create_menu(osv.osv_memory):
_description = "Wizard Create Menu"
_columns = {
+ 'menu_name': fields.char('Menu Name', size=256, 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)
+ page_id = context.get('active_id')
+ obj_page = self.pool.get('document.page')
+ page = obj_page.browse(cr, uid, page_id, context=context)
+ res['menu_name'] = page.name
+ return res
+
def document_page_menu_create(self, cr, uid, ids, context=None):
if context is None:
context = {}
@@ -38,8 +49,7 @@ class document_page_create_menu(osv.osv_memory):
obj_menu = self.pool.get('ir.ui.menu')
obj_action = self.pool.get('ir.actions.act_window')
page_id = context.get('active_id', False)
- if not page_id:
- return {}
+ page = obj_page.browse(cr, uid, page_id, context=context)
datas = self.browse(cr, uid, ids, context=context)
data = False
@@ -57,13 +67,12 @@ class document_page_create_menu(osv.osv_memory):
'target': 'inline',
'nodestroy': True,
}
- page = obj_page.browse(cr, uid, page_id, context=context)
value['domain'] = "[('parent_id','=',%d)]" % (page.id)
value['res_id'] = page.id
action_id = obj_action.create(cr, uid, value)
menu_id = obj_menu.create(cr, uid, {
- 'name': page.name,
+ 'name': data.menu_name,
'parent_id':data.menu_parent_id.id,
'icon': 'STOCK_DIALOG_QUESTION',
'action': 'ir.actions.act_window,'+ str(action_id),
diff --git a/addons/document_page/wizard/document_page_create_menu_view.xml b/addons/document_page/wizard/document_page_create_menu_view.xml
index 5e2b0e56dab..6d689dfe41d 100644
--- a/addons/document_page/wizard/document_page_create_menu_view.xml
+++ b/addons/document_page/wizard/document_page_create_menu_view.xml
@@ -9,6 +9,7 @@