From bda8f3fb7f675957b7e0b1245a21196c11b47865 Mon Sep 17 00:00:00 2001 From: Antony Lesuisse Date: Fri, 10 Aug 2012 02:09:08 +0200 Subject: [PATCH] page mostly ok bzr revid: al@openerp.com-20120810000908-ujg81v4mgm22glem --- addons/document_page/__openerp__.py | 35 +++--- addons/document_page/document_page.py | 30 +++-- addons/document_page/document_page_demo.xml | 18 +-- .../document_page/document_page_sequence.xml | 16 --- addons/document_page/document_page_view.xml | 112 +++++++----------- .../security/document_page_security.xml | 4 - .../security/ir.model.access.csv | 4 - .../wizard/document_page_create_menu.py | 83 ++----------- .../wizard/document_page_create_menu_view.xml | 11 +- .../wizard/document_page_show_diff.py | 18 +-- .../wizard/document_page_show_diff_view.xml | 27 ++--- 11 files changed, 111 insertions(+), 247 deletions(-) delete mode 100644 addons/document_page/document_page_sequence.xml diff --git a/addons/document_page/__openerp__.py b/addons/document_page/__openerp__.py index 80e236f3c63..bff40744805 100644 --- a/addons/document_page/__openerp__.py +++ b/addons/document_page/__openerp__.py @@ -24,34 +24,37 @@ 'version': '1.0.1', 'category': 'Knowledge Management', 'description': """ -The base module to manage documents(document_page). -========================================== - -Keep track of Wiki groups, pages, and history. +Pages +===== +Web pages """, - 'author': ['OpenERP SA', 'Axelor'], - 'website': 'http://openerp.com', - 'depends': ['knowledge','document','crm'], - 'web_depends': ['widget_document_page'], + 'author': ['OpenERP SA'], + 'website': 'http://www.openerp.com/', + 'depends': ['knowledge'], 'init_xml': [], 'update_xml': [ 'wizard/document_page_create_menu_view.xml', 'wizard/document_page_show_diff_view.xml', 'document_page_view.xml', - 'document_page_sequence.xml', 'security/document_page_security.xml', - 'security/ir.model.access.csv' + 'security/ir.model.access.csv', + ], + 'demo_xml': [ + 'document_page_demo.xml' + ], + 'test': [ + 'test/document_page_test00.yml' ], - - 'demo_xml': ['document_page_demo.xml'], - 'test': ['test/document_page_test00.yml'], 'installable': True, 'auto_install': False, 'certificate': '0086363630317', - 'web': True, 'images': [], - 'js': ['static/src/lib/wiky/wiky.js', 'static/src/js/document_page.js'], + 'js': [ + 'static/src/lib/wiky/wiky.js', + 'static/src/js/document_page.js' + ], 'css' : [ - "static/src/css/document_page.css"], + "static/src/css/document_page.css" + ], } # vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: diff --git a/addons/document_page/document_page.py b/addons/document_page/document_page.py index 3aca1820361..e05f371b425 100644 --- a/addons/document_page/document_page.py +++ b/addons/document_page/document_page.py @@ -25,42 +25,41 @@ import difflib import tools class document_page(osv.osv): - _inherit = "document.page" + _name = "document.page" _description = "Document Page" _order = 'name' def _get_page_index(self, cr, uid, page): - index == [] + index = [] for subpage in page.child_ids: index += ["
  • "+ self._get_page_index(cr, uid, subpage) +"
  • "] if index: - index = "" + r = "" else: - index = page.title + r = 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 parent.type == "index": + if page.type == "index": content = self._get_page_index(cr, uid, page) else: content = page.content - res[page.id] = { - 'display_content': content - } + res[page.id] = content return res _columns = { 'name': fields.char('Title', required=True), - 'type':fields.selection([('content','Content Page'), ('index','Index Page')], 'Type', help="Page type"), + 'type':fields.selection([('content','Content'), ('index','Section')], 'Type', help="Page type"), - 'parent_id': fields.many2one('document.page', 'Section'), + 'parent_id': fields.many2one('document.page', 'Section', domain=[('type','=','index')]), 'child_ids': fields.one2many('document.page', 'parent_id', 'Children'), 'content': fields.text("Content"), 'display_content': fields.function(_get_display_content, string='Displayed Content', type='text'), - 'history_ids': fields.one2many('document.page.history', 'document_id', 'History'), + 'history_ids': fields.one2many('document.page.history', 'page_id', 'History'), 'menu_id': fields.many2one('ir.ui.menu', "Menu", readonly=True), 'create_date': fields.datetime("Created on", select=True, readonly=True), @@ -78,7 +77,7 @@ class document_page(osv.osv): parent = self.browse(cr, uid, parent_id, context=context) if parent.type == "content": res['value'] = { - 'content': parent.content_template, + 'content': parent.content, } return res @@ -93,12 +92,12 @@ class document_page(osv.osv): history.create(cr, uid, res) def create(self, cr, uid, vals, context=None): - page_id = super(document_page2, self).create(cr, uid, vals, context) + page_id = super(document_page, self).create(cr, uid, vals, context) self.create_history(cr, uid, [page_id], vals, context) - return document_id + return page_id def write(self, cr, uid, ids, vals, context=None): - result = super(document_page2, self).write(cr, uid, ids, vals, context) + result = super(document_page, self).write(cr, uid, ids, vals, context) self.create_history(cr, uid, ids, vals, context) return result @@ -130,5 +129,4 @@ class document_page_history(osv.osv): diff = difflib.HtmlDiff() return diff.make_file(line1, line2, "Revision-%s" % (v1), "Revision-%s" % (v2), context=False) - # vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: diff --git a/addons/document_page/document_page_demo.xml b/addons/document_page/document_page_demo.xml index 90f56f86d63..8d7b4cc4eb4 100644 --- a/addons/document_page/document_page_demo.xml +++ b/addons/document_page/document_page_demo.xml @@ -4,12 +4,9 @@ - OpenERP 6.1. Functional Demo - 0 6 - Initial Page ==OpenERP 6.1. Functional Demo== The news is out, OpenERP's latest version 6.1. is here. @@ -30,11 +27,9 @@ We have also put together a functional demo that presents 6.1. Watch this video - + Personalise Dashboards - 0 7 - Initial Page ==Personalise your OpenERP dashboards== You like OpenERP, but feel like you want to personalise it more? Now, OpenERP goes a step further and lets you customize your dashboard. How? you will ask. Thanks to a new feature that allows you to customize your dashboard by adding new boards of any search view. @@ -64,13 +59,10 @@ Of course, you are free to delete what you don't need or like, but just in case - + Touchscreen Point of Sale - 0 - 8 - Initial Page - ==The new OpenERP touchscreen Point of Sale== - + ==The new OpenERP touchscreen Point of Sale== + The brand new OpenERP touchscreen point of sale available with 6.1 allows you to manage your shop sales very easily. It's fully web based so that you don't have to install or deploy any software and all the sales shops can be easily consolidated. It works in connected and disconnected modes so that you can continue to sell if you lose your internet connection. @@ -102,4 +94,4 @@ The POS application is so simple and accessible to use that your shop or restaur - \ No newline at end of file + diff --git a/addons/document_page/document_page_sequence.xml b/addons/document_page/document_page_sequence.xml deleted file mode 100644 index 1305ccd5678..00000000000 --- a/addons/document_page/document_page_sequence.xml +++ /dev/null @@ -1,16 +0,0 @@ - - - - - Document Page - document.page - - - Document Page sequence - document.page - 1 - 1 - - - - diff --git a/addons/document_page/document_page_view.xml b/addons/document_page/document_page_view.xml index 023dab44013..3b019e471f5 100644 --- a/addons/document_page/document_page_view.xml +++ b/addons/document_page/document_page_view.xml @@ -20,7 +20,7 @@ - + document.page.list document.page tree @@ -34,65 +34,57 @@ - + document.page.form document.page form
    - -
    -
    +
    +
    +
    + + + + + + + + + + +
    - + document.page.search document.page search - - - - - - + - - - - + + + - - - Document Pages + + + Pages document.page form tree,form @@ -100,7 +92,7 @@ Create web pages - + @@ -110,9 +102,8 @@ - - - + + @@ -123,50 +114,29 @@ form
    - - +
    - - All Page Histories + Page history document.page.history form tree,form - + - - - - tree_but_open - document.page.type - Search a Page - - - diff --git a/addons/document_page/security/document_page_security.xml b/addons/document_page/security/document_page_security.xml index ca9d34ae99c..6d85d054469 100644 --- a/addons/document_page/security/document_page_security.xml +++ b/addons/document_page/security/document_page_security.xml @@ -1,12 +1,8 @@ - - User - - diff --git a/addons/document_page/security/ir.model.access.csv b/addons/document_page/security/ir.model.access.csv index 167abd19ede..13f0479ff53 100644 --- a/addons/document_page/security/ir.model.access.csv +++ b/addons/document_page/security/ir.model.access.csv @@ -1,8 +1,4 @@ id,name,model_id:id,group_id:id,perm_read,perm_write,perm_create,perm_unlink document_page_all,document.page,model_document_page,,1,0,0,0 -document_page_type_all,document.page.type,model_document_page_type,,1,0,0,0 document_page,document.page,model_document_page,base.group_user,1,1,1,1 -document_page_type,document.page.type,model_document_page_type,base.group_system,1,1,1,1 document_page_history,document.page.history,model_document_page_history,base.group_user,1,0,1,0 -access_document_page_sale_manager,document.page.manager,model_document_page,base.group_sale_manager,1,1,1,1 -document_page_user,document.page user,model_document_page,base.group_document_user,1,1,1,1 diff --git a/addons/document_page/wizard/document_page_create_menu.py b/addons/document_page/wizard/document_page_create_menu.py index 9a351e0fe61..f35107511bf 100644 --- a/addons/document_page/wizard/document_page_create_menu.py +++ b/addons/document_page/wizard/document_page_create_menu.py @@ -27,77 +27,18 @@ class document_page_create_menu(osv.osv_memory): _description = "Wizard Create Menu" _columns = { - 'menu_name': fields.char('Menu Name', size=256, select=True, required=True), 'menu_parent_id': fields.many2one('ir.ui.menu', 'Parent Menu', required=True), } - def wiki_menu_create(self, cr, uid, ids, context=None): - - """ Create Menu On the base of Group id and Action id - @param cr: the current row, from the database cursor, - @param uid: the current user’s ID for security checks, - @param ids: List of create menu’s IDs - - """ - if context is None: - context = {} - obj_wiki_group = self.pool.get('document.page.type') - 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') - group_id = context.get('active_id', False) - if not group_id: - return {} - - datas = self.browse(cr, uid, ids, context=context) - data = False - if datas: - data = datas[0] - if not data: - return {} - value = { - 'name': 'Document Page', - 'view_type': 'form', - 'view_mode': 'form,tree', - 'res_model': 'document.page', - 'view_id': False, - 'type': 'ir.actions.act_window', - 'nodestroy': True, - } - group = obj_wiki_group.browse(cr, uid, group_id, context=context) - value['domain'] = "[('group_id','=',%d)]" % (group.id) - if group.method == 'page': - value['res_id'] = group.home.id - elif group.method == 'list': - value['view_type'] = 'form' - value['view_mode'] = 'tree,form' - elif group.method == 'tree': - view_id = obj_view.search(cr, uid, [('name', '=', 'document.page.tree.children')]) - value['view_id'] = view_id - value['domain'] = [('group_id', '=', group.id), ('parent_id', '=', False)] - value['view_type'] = 'tree' - - action_id = obj_action.create(cr, uid, value) - - menu_id = obj_menu.create(cr, uid, { - '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_wiki_group.write(cr, uid, [group_id], {'menu_id':menu_id}) - return {'type': 'ir.actions.act_window_close'} - def document_page_menu_create(self, cr, uid, ids, context=None): - if context is None: context = {} - obj_document_group = self.pool.get('document.page') + 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') - group_id = context.get('active_id', False) - if not group_id: + page_id = context.get('active_id', False) + if not page_id: return {} datas = self.browse(cr, uid, ids, context=context) @@ -106,30 +47,28 @@ class document_page_create_menu(osv.osv_memory): data = datas[0] if not data: return {} - value = { + value = { 'name': 'Document Page', 'view_type': 'form', 'view_mode': 'form,tree', 'res_model': 'document.page', 'view_id': False, 'type': 'ir.actions.act_window', + 'target': 'inline', 'nodestroy': True, } - group = obj_document_group.browse(cr, uid, group_id, context=context) - value['domain'] = "[('parent_id','=',%d)]" % (group.id) - value['res_id'] = group.id + 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': data.menu_name, + 'name': page.name, 'parent_id':data.menu_parent_id.id, 'icon': 'STOCK_DIALOG_QUESTION', 'action': 'ir.actions.act_window,'+ str(action_id), }, context) - obj_document_group.write(cr, uid, [group_id], {'menu_id':menu_id}) - return {'type': 'ir.actions.act_window_close'} - - -document_page_create_menu() + obj_page.write(cr, uid, [page_id], {'menu_id':menu_id}) + return {'type': 'ir.actions.act_window_close'} # vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: 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 a9af396d91f..5e2b0e56dab 100644 --- a/addons/document_page/wizard/document_page_create_menu_view.xml +++ b/addons/document_page/wizard/document_page_create_menu_view.xml @@ -1,17 +1,14 @@ - - - + Create Menu document.page.create.menu form
    - - +