Thibault Delavallée (OpenERP) has proposed merging 
lp:~openerp-dev/openobject-addons/trunk-openchatter-3-5-portal-share-tde into 
lp:~openerp-dev/openobject-addons/trunk-openchatter-3-5-tde.

Requested reviews:
  OpenERP R&D Team (openerp-dev)

For more details, see:
https://code.launchpad.net/~openerp-dev/openobject-addons/trunk-openchatter-3-5-portal-share-tde/+merge/118716
-- 
https://code.launchpad.net/~openerp-dev/openobject-addons/trunk-openchatter-3-5-portal-share-tde/+merge/118716
Your team OpenERP R&D Team is requested to review the proposed merge of 
lp:~openerp-dev/openobject-addons/trunk-openchatter-3-5-portal-share-tde into 
lp:~openerp-dev/openobject-addons/trunk-openchatter-3-5-tde.
=== modified file 'portal/wizard/share_wizard.py'
--- portal/wizard/share_wizard.py	2012-06-29 13:51:35 +0000
+++ portal/wizard/share_wizard.py	2012-08-08 11:29:20 +0000
@@ -45,6 +45,7 @@
     }
 
     def is_portal_manager(self, cr, uid, context=None):
+        # FIXME: NOT USED ?
         return self.has_group(cr, uid, module='portal', group_xml_id='group_portal_manager', context=context)
 
     def _check_preconditions(self, cr, uid, wizard_data, context=None):

=== modified file 'share/wizard/share_wizard.py'
--- share/wizard/share_wizard.py	2012-07-17 07:58:45 +0000
+++ share/wizard/share_wizard.py	2012-08-08 11:29:20 +0000
@@ -71,9 +71,15 @@
     def has_share(self, cr, uid, context=None):
         return self.has_group(cr, uid, module='share', group_xml_id='group_share_user', context=context)
 
+    def has_email(self, cr, uid, context=None):
+        return bool(self.pool.get('res.users').browse(cr, uid, uid, context=context).user_email)
+
     def _user_type_selection(self, cr, uid, context=None):
         """Selection values may be easily overridden/extended via inheritance"""
-        return [('embedded', 'Direct link or embed code'), ('emails','Emails'), ]
+        return [    ('embedded', 'Direct link or embed code'),
+                    ('emails','Emails'),
+                    ('existing', 'Users you already shared with'),
+                    ('groups','Existing Groups (e.g Portal Groups)')]
 
     """Override of create() to auto-compute the action name"""
     def create(self, cr, uid, values, context=None):
@@ -159,27 +165,31 @@
 
     _columns = {
         'action_id': fields.many2one('ir.actions.act_window', 'Action to share', required=True,
-                help="The action that opens the screen containing the data you wish to share."),
+            help="The action that opens the screen containing the data you wish to share."),
         'view_type': fields.char('Current View Type', size=32, required=True),
         'domain': fields.char('Domain', size=256, help="Optional domain for further data filtering"),
-        'user_type': fields.selection(lambda s, *a, **k: s._user_type_selection(*a, **k),'Sharing method', required=True,
-                     help="Select the type of user(s) you would like to share data with."),
+        'user_type': fields.selection(lambda s, *a, **k: s._user_type_selection(*a, **k), 'Sharing method', required=True,
+            help="Select the type of user(s) you would like to share data with."),
+        'invite': fields.boolean('Invite users to OpenSocial record'),
         'new_users': fields.text("Emails"),
         'email_1': fields.char('New user email', size=64),
         'email_2': fields.char('New user email', size=64),
         'email_3': fields.char('New user email', size=64),
-        'invite': fields.boolean('Invite users to OpenSocial record'),
+        'user_ids': fields.many2many('res.users', 'share_wizard_res_user_rel',
+            'share_id', 'user_id', 'Existing users', domain=[('share', '=', True)]),
+        'group_ids': fields.many2many('res.groups', 'share_wizard_res_group_rel',
+            'share_id', 'group_id', 'Existing groups', domain=[('share', '=', False)]),
         'access_mode': fields.selection([('readonly','Can view'),('readwrite','Can edit')],'Access Mode', required=True,
-                                        help="Access rights to be granted on the shared documents."),
+            help="Access rights to be granted on the shared documents."),
         'result_line_ids': fields.one2many('share.wizard.result.line', 'share_wizard_id', 'Summary', readonly=True),
         'share_root_url': fields.function(_share_root_url, string='Share Access URL', type='char', size=512, readonly=True,
-                                help='Main access page for users that are granted shared access'),
+            help='Main access page for users that are granted shared access'),
         'name': fields.char('Share Title', size=64, required=True, help="Title for the share (displayed to users as menu and shortcut name)"),
         'record_name': fields.char('Record name', size=128, help="Name of the shared record, if sharing a precise record"),
         'message': fields.text("Personal Message", help="An optional personal message, to be included in the email notification."),
         'embed_code': fields.function(_embed_code, type='text', string='Code',
             help="Embed this code in your documents to provide a link to the "\
-                  "shared document."),
+                 "shared document."),
         'embed_option_title': fields.boolean('Display title'),
         'embed_option_search': fields.boolean('Display search view'),
         'embed_url': fields.function(_embed_url, string='Share URL', type='char', size=512, readonly=True),
@@ -195,10 +205,9 @@
         'embed_option_search': True,
     }
 
-    def has_email(self, cr, uid, context=None):
-        return bool(self.pool.get('res.users').browse(cr, uid, uid, context=context).user_email)
-
     def go_step_1(self, cr, uid, ids, context=None):
+        """ Step0: give an action and an optional domain. Step1: give the method
+            and details of share. """
         wizard_data = self.browse(cr,uid,ids,context)[0]
         if wizard_data.user_type == 'emails' and not self.has_email(cr, uid, context=context):
             raise osv.except_osv(_('No email address configured'),
@@ -661,8 +670,11 @@
                      context=context)
         if wizard_data.user_type == 'emails':
             self._assert((wizard_data.new_users or wizard_data.email_1 or wizard_data.email_2 or wizard_data.email_3),
-                     _('Please indicate the emails of the persons to share with, one per line'),
-                     context=context)
+                _('Please indicate the emails of the persons to share with, one per line'), context=context)
+        elif wizard_data.user_type == 'existing':
+            self._assert(wizard_data.user_ids, _('Please select at least one user to share with'), context=context)
+        elif wizard_data.user_type == 'groups':
+            self._assert(wizard_data.group_ids, _('Please select at least one group to share with'), context=context)
 
     def _create_share_users_group(self, cr, uid, wizard_data, context=None):
         """Creates the appropriate share group and share users, and populates

_______________________________________________
Mailing list: https://launchpad.net/~openerp-dev-gtk
Post to     : [email protected]
Unsubscribe : https://launchpad.net/~openerp-dev-gtk
More help   : https://help.launchpad.net/ListHelp

Reply via email to