Skip to content
Snippets Groups Projects
Commit ad15fa33 authored by Olivier Dony's avatar Olivier Dony
Browse files

[IMP] share: much more complete implementation of share wizard, pending some...

[IMP] share: much more complete implementation of share wizard, pending some improvements + web widget creation

bzr revid: odo@openerp.com-20101017051319-p4xi0epaqmgvwdmr
parent 8d662b49
No related branches found
No related tags found
No related merge requests found
......@@ -18,5 +18,6 @@
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#
##############################################################################
import share
import res_users
import wizard
......@@ -21,24 +21,34 @@
{
"name" : "Share Management",
"name" : "Sharing Tools",
"version" : "1.1",
"depends" : ["base"],
"author" : "OpenERP SA",
"category": 'Generic Modules',
"description": """The goal is to implement a generic sharing mechanism, where user of OpenERP
can share data from OpenERP to their colleagues, customers, or friends.
The system will work by creating new users and groups on the fly, and by
combining the appropriate access rights and ir.rules to ensure that the /shared
users/ will only have access to the correct data.
"description": """
This module adds generic sharing tools to your current OpenERP database,
and specifically a 'share' button that is available in the Web client to
share any kind of OpenERP data with colleagues, customers, friends, etc.
The system will work by creating new users and groups on the fly, and by
combining the appropriate access rights and ir.rules to ensure that the
shared users only have access to the data that has been shared with them.
This is extremely useful for collaborative work, knowledge sharing,
synchronization with other companies, etc.
""",
'website': 'http://www.openerp.com',
'init_xml': [],
'update_xml': [
'data': [
'security/share_security.xml',
'security/ir.model.access.csv',
'share_view.xml',
'res_users_view.xml',
'wizard/share_wizard_view.xml'
],
],
'installable': True,
'active': False,
}
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
......@@ -18,12 +18,14 @@
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#
##############################################################################
from osv import fields, osv, orm
from osv import fields, osv
class res_groups(osv.osv):
_name = "res.groups"
_inherit = 'res.groups'
_columns = {
'share': fields.boolean('Share')
'share': fields.boolean('Share Group', groups='share.group_share', readonly=True,
help="Group created to set access rights for sharing data with some users.")
}
res_groups()
......@@ -31,6 +33,7 @@ class res_users(osv.osv):
_name = 'res.users'
_inherit = 'res.users'
_columns = {
'share': fields.boolean('Share')
'share': fields.boolean('Share User', groups='share.group_share', readonly=True,
help="External user with limited access, created only for the purpose of sharing data.")
}
res_users()
<?xml version="1.0" encoding="utf-8"?>
<openerp>
<data>
<record model="ir.ui.view" id="res_users_search_sharing">
<field name="name">res.users.search.share</field>
<field name="model">res.users</field>
<field name="type">search</field>
<field name="inherit_id" ref="base.view_users_search"/>
<field name="arch" type="xml">
<xpath expr="/search/field[@name='company_ids']" position="after">
<field name="share">
<filter name="no_share" string="Regular users only (no share user)" icon="terp-partner"
domain="[('share','=',False)]"/>
</field>
</xpath>
</field>
</record>
<record model="ir.actions.act_window" id="base.action_res_users">
<field name="context">{'search_default_no_share': 1}</field>
</record>
<record model="ir.ui.view" id="res_groups_search_sharing">
<field name="name">res.groups.search.share</field>
<field name="model">res.groups</field>
<field name="type">search</field>
<field name="priority" eval="8"/>
<field name="arch" type="xml">
<search string="Groups">
<field name="name"/>
<field name="share">
<filter name="no_share" string="Regular groups only (no share groups" icon="terp-partner"
domain="[('share','=',False)]"/>
</field>
</search>
</field>
</record>
<record model="ir.actions.act_window" id="base.action_res_groups">
<field name="context">{'search_default_no_share': 1}</field>
</record>
</data>
</openerp>
\ No newline at end of file
"id","name","model_id:id","group_id:id","perm_read","perm_write","perm_create","perm_unlink"
"access_share_wizard_user","access_share_wizard_user","model_share_wizard","share.group_share_user",1,1,1,1
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<openerp>
<data noupdate="1">
<record id="group_share_user" model="res.groups">
<field name="name">Sharing / User</field>
</record>
</data>
</openerp>
......@@ -6,7 +6,7 @@
<field name="model">res.groups</field>
<field name="type">form</field>
<field name="inherit_id" ref="base.view_groups_form"/>
<field name="arch" type="xml">
<field name="arch" type="xml">
<field name="name" position="after">
<field name="share"/>
</field>
......@@ -17,7 +17,7 @@
<field name="model">res.users</field>
<field name="type">form</field>
<field name="inherit_id" ref="base.view_users_form"/>
<field name="arch" type="xml">
<field name="arch" type="xml">
<field name="password" position="after">
<field name="share"/>
</field>
......
......@@ -20,3 +20,4 @@
##############################################################################
import share_wizard
This diff is collapsed.
<?xml version="1.0" encoding="utf-8"?>
<openerp>
<data>
<data>
<record id="share_step0_form" model="ir.ui.view">
<record id="share_step0_form" model="ir.ui.view">
<field name="name">share.step0.form</field>
<field name="model">share.create</field>
<field name="model">share.wizard</field>
<field name="type">form</field>
<field name="arch" type="xml">
<form string="Share">
<separator colspan="4" string="Step 1: Chose the action and the additional domain"/>
<field name="action_id"/>
<field name="domain"/>
<separator colspan="4"/>
<group col="2" colspan="4">
<button special="cancel" string="Cancel" icon='gtk-cancel'/>
<button name="do_step_1" string="Next" colspan="1" type="object" icon="gtk-go-forward"/>
</group>
</form>
<form string="Share wizard: step 0">
<separator colspan="4"
string="Please select the action that opens the screen containing the data you want to share."/>
<field name="action_id" colspan="4"/>
<separator colspan="4"
string="Optionally, you may specify an additional domain restriction that will be applied to the shared data."/>
<field name="domain"/>
<separator colspan="4"/>
<group colspan="4">
<button special="cancel" string="Cancel" icon='gtk-cancel'/>
<button name="go_step_1" string="Next" colspan="1" type="object" icon="gtk-go-forward"/>
</group>
</form>
</field>
</record>
<record id="share_step1_form" model="ir.ui.view">
<field name="name">share.step1.form</field>
<field name="model">share.create</field>
<field name="model">share.wizard</field>
<field name="type">form</field>
<field name="arch" type="xml">
<form string="Share">
<separator colspan="4" string="Step 2: Chose the User type"/>
<field name="user_type"/>
<newline/>
<group colspan="4" attrs="{'invisible':[('user_type','!=','existing')]}">
<separator colspan="4" string="Exising Users"/>
<field colspan="4" nolabel="1" name="user_ids" domain="[('share_user','=',True)]"/>
</group>
<group colspan="4" attrs="{'invisible':[('user_type','!=','new')]}">
<separator colspan="4" string="New Users"/>
<field colspan="4" nolabel="1" name="new_user"/>
</group>
<separator colspan="4"/>
<group col="3" colspan="4">
<button special="cancel" string="Cancel" icon='gtk-cancel'/>
<button name="do_step_2" string="Next" colspan="1" type="object" icon="gtk-go-forward"/>
</group>
</form>
<form string="Share wizard: step 1">
<separator colspan="4" string="Who would you want to share this data with?"/>
<field name="user_type"/>
<group colspan="4" attrs="{'invisible':[('user_type','!=','existing')]}">
<separator colspan="4" string="Existing External Users"/>
<field colspan="4" nolabel="1" name="user_ids" mode="tree">
<tree editable="bottom" string="">
<field name="user_id"/>
</tree>
</field>
</group>
<group colspan="4" attrs="{'invisible':[('user_type','!=','new')]}">
<separator colspan="4" string="New Users (please provide one e-mail address per line below)"/>
<field colspan="4" nolabel="1" name="new_users"/>
</group>
<separator colspan="4" string="Select the desired shared access mode:"/>
<group colspan="4">
<field name="access_mode"/>
</group>
<separator colspan="4"/>
<group colspan="4">
<button special="cancel" string="Cancel" icon='gtk-cancel'/>
<button name="go_step_2" string="Finish" colspan="1" type="object" icon="gtk-go-forward"/>
</group>
</form>
</field>
</record>
<record id="share_step2_form" model="ir.ui.view">
<field name="name">share.step2.form</field>
<field name="model">share.create</field>
<field name="model">share.wizard</field>
<field name="type">form</field>
<field name="arch" type="xml">
<form string="Share">
<separator colspan="4" string="Step 3: Chose Access Mode"/>
<group colspan="4">
<field name="access_mode"/>
</group>
<separator colspan="4"/>
<group col="3" colspan="4">
<button special="cancel" string="Cancel" icon='gtk-cancel'/>
<button name="do_step_3" string="Next" colspan="1" type="object" icon="gtk-go-forward"/>
</group>
</form>
<form string="Share wizard: step 2">
<separator colspan="4" string="Congratulations, you have successfully setup a new shared access!"/>
<label colspan="4" string="Here is a summary of the access points you have just created:"/>
<field name="result_line_ids" nolabel="1" colspan="4" mode="tree">
<tree string="Summary">
<field name="login"/>
<field name="password"/>
<field name="share_url"/>
</tree>
<form string="Access info">
<field name="login"/>
<field name="password"/>
<field name="share_url" colspan="4"/>
</form>
</field>
<field colspan="4" name="share_root_url"/>
<separator colspan="4"/>
<group colspan="4">
<button special="cancel" string="Close" icon='gtk-ok'/>
<button name="send_emails" string="Send Email Notification(s)" colspan="1" type="object" icon="gtk-go-forward"/>
</group>
</form>
</field>
</record>
<record id="action_share_wizard" model="ir.actions.act_window">
<field name="name">Share Access Rules</field>
<!-- action for manual launch from menuitem. context may contain:
- 'action_id' (id of action)
- 'domain' (string expression for full domain to apply as sent to server,
with dynamic data like 'uid' replaced by actual value (i.e. after eval)!)
- 'share_root_url' : URL for direct access to share page (may include %(login) and %(password) placeholders)
-->
<record id="action_share_wizard" model="ir.actions.act_window">
<field name="name">Share Wizard</field>
<field name="type">ir.actions.act_window</field>
<field name="res_model">share.create</field>
<field name="res_model">share.wizard</field>
<field name="view_type">form</field>
<field name="view_mode">form</field>
<field name="view_id" ref="share_step0_form"/>
<field name="view_id" ref="share_step0_form"/>
<field name="target">new</field>
</record>
<menuitem action="action_share_wizard" id="menu_action_share_wizard" parent="base.menu_security"/>
<record id="share_result_form" model="ir.ui.view">
<field name="name">share.result.form</field>
<field name="model">share.result</field>
<field name="type">form</field>
<field name="arch" type="xml">
<form string="Share">
<separator colspan="4" string="Step 4: Share Users Detail"/>
<field name="users" colspan="4" nolabel="1"/>
<separator colspan="4"/>
<group col="2" colspan="4">
<button special="cancel" string="Cancel" icon='gtk-cancel'/>
<button name="do_send_email" string="Send Email" type="object" icon="gtk-apply"/>
</group>
</form>
</field>
</record>
<!-- action for direct launch from client widget with context providing:
- 'action_id' (id of action)
- 'domain' (string expression for full domain to apply as sent to server,
with dynamic data like 'uid' replaced by actual value (i.e. after eval)!)
- 'share_root_url' : URL for direct access to share page (may include %(login) and %(password) placeholders)
-->
<record id="action_share_wizard_step1" model="ir.actions.act_window">
<field name="name">Share Wizard</field>
<field name="type">ir.actions.act_window</field>
<field name="res_model">share.wizard</field>
<field name="view_type">form</field>
<field name="view_mode">form</field>
<field name="view_id" ref="share_step1_form"/>
<field name="target">new</field>
</record>
<!-- temporarily under Low-Level-Actions -->
<menuitem action="action_share_wizard" id="menu_action_share_wizard" parent="base.next_id_4" groups="group_share_user" icon="terp-rating-rated"/>
</data>
</data>
</openerp>
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment