page mostly ok
bzr revid: al@openerp.com-20120810000908-ujg81v4mgm22glem
This commit is contained in:
parent
6097630099
commit
bda8f3fb7f
|
@ -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:
|
||||
|
|
|
@ -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 += ["<li>"+ self._get_page_index(cr, uid, subpage) +"</li>"]
|
||||
if index:
|
||||
index = "<ul>" + "".join(index) + "</ul>"
|
||||
r = "<ul>" + "".join(index) + "</ul>"
|
||||
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:
|
||||
|
|
|
@ -4,12 +4,9 @@
|
|||
<record id="base.user_demo" model="res.users">
|
||||
<field eval="[(4, ref('base.group_sale_salesman')),(4, ref('base.group_document_user'))]" name="groups_id"/>
|
||||
</record>
|
||||
|
||||
<record id="document_google_docs" model="document.page">
|
||||
<field name="name">OpenERP 6.1. Functional Demo</field>
|
||||
<field name="minor_edit">0</field>
|
||||
<field name="index">6</field>
|
||||
<field name="summary">Initial Page</field>
|
||||
<field name="content">==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
|
|||
</field>
|
||||
</record>
|
||||
|
||||
<record id="document_dashboards" model="document.page">
|
||||
<record id="document_dashboards" model="document.page">
|
||||
<field name="name">Personalise Dashboards</field>
|
||||
<field name="minor_edit">0</field>
|
||||
<field name="index">7</field>
|
||||
<field name="summary">Initial Page</field>
|
||||
<field name="content">==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
|
|||
</field>
|
||||
</record>
|
||||
|
||||
<record id="document_pos" model="document.page">
|
||||
<record id="document_pos" model="document.page">
|
||||
<field name="name">Touchscreen Point of Sale</field>
|
||||
<field name="minor_edit">0</field>
|
||||
<field name="index">8</field>
|
||||
<field name="summary">Initial Page</field>
|
||||
<field name="content">==The new OpenERP touchscreen Point of Sale==
|
||||
|
||||
<field name="content">==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
|
|||
</record>
|
||||
|
||||
</data>
|
||||
</openerp>
|
||||
</openerp>
|
||||
|
|
|
@ -1,16 +0,0 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<openerp>
|
||||
<data noupdate="1">
|
||||
<record id="seq_type_doc_page" model="ir.sequence.type">
|
||||
<field name="name">Document Page</field>
|
||||
<field name="code">document.page</field>
|
||||
</record>
|
||||
<record id="seq_doc_page" model="ir.sequence">
|
||||
<field name="name">Document Page sequence</field>
|
||||
<field name="code">document.page</field>
|
||||
<field name="number_next">1</field>
|
||||
<field name="number_increment">1</field>
|
||||
</record>
|
||||
|
||||
</data>
|
||||
</openerp>
|
|
@ -20,7 +20,7 @@
|
|||
</field>
|
||||
</record>
|
||||
<!-- wiki list view -->
|
||||
<record model="ir.ui.view" id="view_wiki_tree">
|
||||
<record id="view_wiki_tree" model="ir.ui.view">
|
||||
<field name="name">document.page.list</field>
|
||||
<field name="model">document.page</field>
|
||||
<field name="type">tree</field>
|
||||
|
@ -34,65 +34,57 @@
|
|||
</field>
|
||||
</record>
|
||||
<!-- wiki Form view -->
|
||||
<record model="ir.ui.view" id="view_wiki_form">
|
||||
<record id="view_wiki_form" model="ir.ui.view">
|
||||
<field name="name">document.page.form</field>
|
||||
<field name="model">document.page</field>
|
||||
<field name="type">form</field>
|
||||
<field name="arch" type="xml">
|
||||
<form string="Document Page" version="7.0">
|
||||
<sheet string="Document Page">
|
||||
<div class="oe_right oe_button_box">
|
||||
<button name="%(document_page.action_wiki_create_menu)d" string="Create Menu" type="action" class="oe_edit_only"/>
|
||||
</div>
|
||||
<div class="oe_right oe_button_box">
|
||||
<button name="%(document_page.action_wiki_create_menu)d" string="Create Menu" type="action" class="oe_edit_only"/>
|
||||
<button name="%(document_page.action_wiki_create_menu)d" string="History" type="action" class="oe_edit_only"/>
|
||||
</div>
|
||||
<div class="oe_title">
|
||||
<label for="name" class="oe_edit_only"/>
|
||||
<h1><field name="name" select="1" /></h1>
|
||||
<label for="type" class="oe_edit_only"/>
|
||||
<field name="type" class="oe_edit_only"/>
|
||||
<label for="parent_id" />
|
||||
<field name="parent_id" on_change="onchange_parent_id(parent_id,content)" string="Topic" />
|
||||
<notebook colspan="4" >
|
||||
<page string="Content">
|
||||
<field name="display_content" attrs="{'invisible':[('type','=','normal')]}"/>
|
||||
<field name="content" placeholder="e.g. Once upon a time..." class="oe_edit_only" attrs="{'invisible':[('type','=','index')]}"/>
|
||||
</page>
|
||||
<page string="History" groups="base.group_no_one" >
|
||||
<field name="history_ids" nolabel="1"/>
|
||||
<separator colspan="4" string="Modification Information"/>
|
||||
<label for="write_date" readonly="1"/>
|
||||
<field name="write_date"/>
|
||||
</page>
|
||||
</notebook>
|
||||
</sheet>
|
||||
</div>
|
||||
<group class="oe_edit_only">
|
||||
<group>
|
||||
<field name="parent_id" on_change="onchange_parent_id(parent_id,content)" string="Section"/>
|
||||
<field name="type"/>
|
||||
</group>
|
||||
<group>
|
||||
<field name="write_uid" groups="base.group_no_one"/>
|
||||
<field name="write_date" groups="base.group_no_one"/>
|
||||
</group>
|
||||
</group>
|
||||
<label for="content" class="oe_edit_only" string="Template" attrs="{'invisible':[('type','=','content')]}"/>
|
||||
<field name="content" placeholder="e.g. Once upon a time..." class="oe_edit_only"/>
|
||||
<field name="display_content" widget="html"/>
|
||||
</form>
|
||||
</field>
|
||||
</record>
|
||||
<!-- wiki Search view -->
|
||||
<!-- page Search view -->
|
||||
<record id="view_wiki_filter" model="ir.ui.view">
|
||||
<field name="name">document.page.search</field>
|
||||
<field name="model">document.page</field>
|
||||
<field name="type">search</field>
|
||||
<field name="arch" type="xml">
|
||||
<search string="Document Page">
|
||||
<field name="name" filter_domain="['|', '|', ('name','ilike',self), ('content','ilike',self)]" string="Document Page"/>
|
||||
<separator orientation="vertical"/>
|
||||
<field name="write_date" groups="base.group_no_one"/>
|
||||
<separator orientation="vertical"/>
|
||||
<filter icon="terp-gtk-jump-to-ltr" string="Need Review" domain="[('review','=',True)]"/>
|
||||
<separator orientation="vertical"/>
|
||||
<field name="name" string="Content" filter_domain="['|', '|', ('name','ilike',self), ('content','ilike',self)]"/>
|
||||
<field name="write_uid"/>
|
||||
<field name="parent_id"/>
|
||||
<newline/>
|
||||
<group expand="0" string="Group By...">
|
||||
<filter icon="terp-folder-blue" string="Document Type" domain="[]" context="{'group_by':'parent_id'}"/>
|
||||
<filter icon="terp-personal" string="Author" domain="[]" context="{'group_by':'create_uid'}"/>
|
||||
<filter icon="terp-personal+" string="Last Contributor" domain="[]" context="{'group_by':'write_uid'}"/>
|
||||
<filter string="Document Type" domain="[]" context="{'group_by':'parent_id'}"/>
|
||||
<filter string="Author" domain="[]" context="{'group_by':'create_uid'}"/>
|
||||
<filter string="Last Contributor" domain="[]" context="{'group_by':'write_uid'}"/>
|
||||
</group>
|
||||
</search>
|
||||
</field>
|
||||
</record>
|
||||
<!-- search page for wiki -->
|
||||
<record model="ir.actions.act_window" id="action_wiki">
|
||||
<field name="name">Document Pages</field>
|
||||
<!-- page action -->
|
||||
<record id="action_page" model="ir.actions.act_window">
|
||||
<field name="name">Pages</field>
|
||||
<field name="res_model">document.page</field>
|
||||
<field name="view_type">form</field>
|
||||
<field name="view_mode">tree,form</field>
|
||||
|
@ -100,7 +92,7 @@
|
|||
<field name="search_view_id" ref="view_wiki_filter"/>
|
||||
<field name="help">Create web pages</field>
|
||||
</record>
|
||||
<menuitem parent="menu_wiki" id="menu_page" name="Document Pages" action="action_page"/>
|
||||
<menuitem parent="menu_wiki" id="menu_page" name="Pages" action="action_page"/>
|
||||
|
||||
<!-- History Tree view -->
|
||||
<record model="ir.ui.view" id="view_wiki_history_tree">
|
||||
|
@ -110,9 +102,8 @@
|
|||
<field name="arch" type="xml">
|
||||
<tree string="Document History">
|
||||
<field name="create_date"/>
|
||||
<field name="write_uid"/>
|
||||
<field name="minor_edit" groups="base.group_no_one"/>
|
||||
<field name="summary"/>
|
||||
<field name="create_uid"/>
|
||||
<field name="page_id"/>
|
||||
</tree>
|
||||
</field>
|
||||
</record>
|
||||
|
@ -123,50 +114,29 @@
|
|||
<field name="type">form</field>
|
||||
<field name="arch" type="xml">
|
||||
<form string="Document Page History" version="7.0">
|
||||
<sheet>
|
||||
<label for="document_id" class="oe_edit_only"/>
|
||||
<h1><field name="document_id" select="1" /></h1>
|
||||
<label for="summary" class="oe_edit_only"/>
|
||||
<field name="summary" colspan="4" />
|
||||
<label for="content" class="oe_edit_only"/>
|
||||
<field name="content" colspan="4" nolabel="1" widget="text_wiki" onchange="onchange_content(content)"/>
|
||||
<label for="create_date" class="oe_edit_only"/>
|
||||
<field name="create_date" readonly="1"/>
|
||||
<label for="minor_edit" class="oe_edit_only" groups="base.group_no_one"/>
|
||||
<field name="minor_edit" groups="base.group_no_one"/>
|
||||
</sheet>
|
||||
<label for="page_id" class="oe_edit_only"/>
|
||||
<h1><field name="page_id" select="1" /></h1>
|
||||
<label for="create_date" class="oe_edit_only"/>
|
||||
<field name="create_date" readonly="1"/>
|
||||
<label for="content" class="oe_edit_only"/>
|
||||
<field name="content" colspan="4"/>
|
||||
</form>
|
||||
</field>
|
||||
</record>
|
||||
|
||||
<!-- History Action -->
|
||||
<record model="ir.actions.act_window" id="action_history">
|
||||
<field name="name">All Page Histories</field>
|
||||
<field name="name">Page history</field>
|
||||
<field name="res_model">document.page.history</field>
|
||||
<field name="view_type">form</field>
|
||||
<field name="view_mode">tree,form</field>
|
||||
</record>
|
||||
|
||||
<menuitem parent="menu_wiki" id="menu_page_history" name="Pages history" action="action_history" groups="base.group_no_one"/>
|
||||
<act_window
|
||||
context="{'search_default_document_id': [active_id], 'default_document_id': active_id}"
|
||||
id="act_wiki_wiki_history"
|
||||
context="{'search_default_page_id': [active_id], 'default_page_id': active_id}"
|
||||
name="Page History"
|
||||
res_model="document.page.history"
|
||||
src_model="document.page"/>
|
||||
|
||||
<act_window
|
||||
context="{'search_default_parent_id': [active_id], 'default_parent_id': active_id}"
|
||||
id="act_wiki_group_open"
|
||||
name="Search Page"
|
||||
res_model="document.page"
|
||||
src_model="document.page.type"/>
|
||||
|
||||
<record id="ir_open_wiki_pages" model="ir.values">
|
||||
<field name="key2">tree_but_open</field>
|
||||
<field name="model">document.page.type</field>
|
||||
<field name="name">Search a Page</field>
|
||||
<field eval="'ir.actions.wizard,%d'%action_view_wiki_wiki_page_open" name="value"/>
|
||||
</record>
|
||||
|
||||
</data>
|
||||
</openerp>
|
||||
|
|
|
@ -1,12 +1,8 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<openerp>
|
||||
<data noupdate="0">
|
||||
|
||||
<record id="base.group_document_user" model="res.groups">
|
||||
<field name="name">User</field>
|
||||
<field name="category_id" ref="base.module_category_knowledge_management"/>
|
||||
<field name="users" eval="[(4, ref('base.user_root'))]"/>
|
||||
</record>
|
||||
|
||||
</data>
|
||||
</openerp>
|
||||
|
|
|
@ -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
|
||||
|
|
|
|
@ -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:
|
||||
|
|
|
@ -1,17 +1,14 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<openerp>
|
||||
<data>
|
||||
|
||||
<!-- Create Menu From view -->
|
||||
|
||||
<!-- Create Menu From view -->
|
||||
<record id="view_wiki_create_menu" model="ir.ui.view">
|
||||
<field name="name">Create Menu</field>
|
||||
<field name="model">document.page.create.menu</field>
|
||||
<field name="type">form</field>
|
||||
<field name="arch" type="xml">
|
||||
<form string="Create Menu" version="7.0">
|
||||
<group string="Menu Information">
|
||||
<field name="menu_name" />
|
||||
<group string="Menu Information">
|
||||
<field name="menu_parent_id" />
|
||||
</group>
|
||||
<footer>
|
||||
|
@ -22,9 +19,7 @@
|
|||
</form>
|
||||
</field>
|
||||
</record>
|
||||
|
||||
<!-- Create Menu Action -->
|
||||
|
||||
<!-- Create Menu Action -->
|
||||
<record id="action_wiki_create_menu" model="ir.actions.act_window">
|
||||
<field name="name">Create Menu</field>
|
||||
<field name="type">ir.actions.act_window</field>
|
||||
|
|
|
@ -29,10 +29,6 @@ class showdiff(osv.osv_memory):
|
|||
_name = 'wizard.document.page.history.show_diff'
|
||||
|
||||
def get_diff(self, cr, uid, context=None):
|
||||
|
||||
""" @param cr: the current row, from the database cursor,
|
||||
@param uid: the current user’s ID for security checks,
|
||||
"""
|
||||
if context is None:
|
||||
context = {}
|
||||
history = self.pool.get('document.page.history')
|
||||
|
@ -41,29 +37,25 @@ class showdiff(osv.osv_memory):
|
|||
diff = ""
|
||||
if len(ids) == 2:
|
||||
if ids[0] > ids[1]:
|
||||
diff = base64.encodestring(history.getDiff(cr, uid, ids[1], ids[0]))
|
||||
diff = history.getDiff(cr, uid, ids[1], ids[0])
|
||||
else:
|
||||
diff = base64.encodestring(history.getDiff(cr, uid, ids[0], ids[1]))
|
||||
diff = history.getDiff(cr, uid, ids[0], ids[1])
|
||||
|
||||
elif len(ids) == 1:
|
||||
old = history.browse(cr, uid, ids[0])
|
||||
nids = history.search(cr, uid, [('document_id', '=', old.document_id.id)])
|
||||
nids.sort()
|
||||
diff = base64.encodestring(history.getDiff(cr, uid, ids[0], nids[-1]))
|
||||
diff = history.getDiff(cr, uid, ids[0], nids[-1])
|
||||
else:
|
||||
raise osv.except_osv(_('Warning!'), _('You need to select minimum one or maximum two history revisions!'))
|
||||
|
||||
|
||||
return diff
|
||||
|
||||
_columns = {
|
||||
'file_path':fields.binary('Diff', readonly=True),
|
||||
'diff': fields.text('Diff', readonly=True),
|
||||
}
|
||||
|
||||
_defaults = {
|
||||
'file_path': get_diff
|
||||
'diff': get_diff
|
||||
}
|
||||
|
||||
showdiff()
|
||||
|
||||
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
|
||||
|
|
|
@ -2,25 +2,21 @@
|
|||
<openerp>
|
||||
<data>
|
||||
|
||||
<!-- Create Index Form view -->
|
||||
|
||||
<!-- Create Index Form view -->
|
||||
<record id="view_wiki_show_diff" model="ir.ui.view">
|
||||
<field name="name">Show Difference</field>
|
||||
<field name="model">wizard.document.page.history.show_diff</field>
|
||||
<field name="type">form</field>
|
||||
<field name="arch" type="xml">
|
||||
<form string="Difference" version="7.0">
|
||||
<separator string="Notes"/>
|
||||
<field name="file_path" width="300"/>
|
||||
<field name="diff"/>
|
||||
<footer>
|
||||
<button string="Cancel" class="oe_link" special="cancel" />
|
||||
</footer>
|
||||
</form>
|
||||
</field>
|
||||
</record>
|
||||
|
||||
<!-- Create Index Action -->
|
||||
|
||||
<!-- Create Index Action -->
|
||||
<record id="action_view_wiki_show_diff" model="ir.actions.act_window">
|
||||
<field name="name">Difference</field>
|
||||
<field name="type">ir.actions.act_window</field>
|
||||
|
@ -29,13 +25,16 @@
|
|||
<field name="view_mode">form</field>
|
||||
<field name="target">new</field>
|
||||
</record>
|
||||
|
||||
<!-- Create Index Action Window -->
|
||||
|
||||
<act_window id="action_view_wiki_show_diff_values"
|
||||
key2="client_action_multi" name="Difference"
|
||||
res_model="wizard.document.page.history.show_diff" src_model="document.page.history"
|
||||
view_mode="form" target="new" view_type="form" />
|
||||
<!-- Create Index Action Window -->
|
||||
<act_window
|
||||
id="action_view_wiki_show_diff_values"
|
||||
key2="client_action_multi"
|
||||
name="Difference"
|
||||
res_model="wizard.document.page.history.show_diff"
|
||||
src_model="document.page.history"
|
||||
view_mode="form"
|
||||
target="new"
|
||||
view_type="form"/>
|
||||
|
||||
</data>
|
||||
</openerp>
|
||||
|
|
Loading…
Reference in New Issue