[IMP] share: add option to name the sharing access + improve button names

bzr revid: odo@openerp.com-20110601081049-ern1g43gg6l267yd
This commit is contained in:
Olivier Dony 2011-06-01 10:10:49 +02:00
parent e0653a5b53
commit 01861bd44e
2 changed files with 14 additions and 2 deletions

View File

@ -88,6 +88,13 @@ class share_create(osv.osv_memory):
result.append(('groups','Existing groups of users'))
return result
"""Override of create() to auto-compute the action name"""
def create(self, cr, uid, values, context=None):
if 'action_id' in values and not 'name' in values:
action = self.pool.get('ir.actions.actions').browse(cr, uid, values['action_id'], context=context)
values['name'] = action.name
return super(share_create,self).create(cr, uid, values, context=context)
_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."),
@ -100,6 +107,7 @@ class share_create(osv.osv_memory):
'access_mode': fields.selection([('readwrite','Read & Write'),('readonly','Read-only')],'Access Mode'),
'result_line_ids': fields.one2many('share.wizard.result.line', 'share_wizard_id', 'Summary', readonly=True),
'share_root_url': fields.char('Generic Share Access URL', size=512, readonly=True, tooltip='Main access page for users that are granted shared access'),
'name': fields.char('Title', size=64, required=True, help="Title for the shared view, to be displayed as the name of the shortcut in the user's menu"),
# used to display a warning message at first step
'has_user_email': fields.function(_has_email, string='Has email', method=True, type="boolean"),
@ -210,7 +218,7 @@ class share_create(osv.osv_memory):
def _shared_action_def(self, cr, uid, wizard_data, context=None):
return {
'name': (_('%s (Shared)') % wizard_data.action_id.name)[:64],
'name': wizard_data.name,
'domain': '[]',
'context': self._cleanup_action_context(wizard_data.action_id.context, uid),
'res_model': wizard_data.action_id.res_model,

View File

@ -51,6 +51,10 @@
</tree>
</field>
</group>
<separator colspan="4" string="Name the new shared view:"/>
<group colspan="4">
<field name="name"/>
</group>
<separator colspan="4" string="Select the desired shared access mode:"/>
<group colspan="4">
<field name="access_mode"/>
@ -62,7 +66,7 @@
<separator colspan="4"/>
<group colspan="4">
<button special="cancel" string="Cancel" icon='gtk-cancel'/>
<button name="go_step_2" string="Confirm" colspan="1" type="object" icon="gtk-go-forward"/>
<button name="go_step_2" string="Share" colspan="1" type="object" icon="gtk-go-forward"/>
</group>
</form>
</field>