diff options
Diffstat (limited to 'addons/event')
| -rw-r--r-- | addons/event/event.py | 9 | ||||
| -rw-r--r-- | addons/event/event_view.xml | 1 | ||||
| -rw-r--r-- | addons/event/security/event_security.xml | 32 |
3 files changed, 31 insertions, 11 deletions
diff --git a/addons/event/event.py b/addons/event/event.py index eb18afd747c..3c04f5c1baa 100644 --- a/addons/event/event.py +++ b/addons/event/event.py @@ -172,6 +172,12 @@ class event_event(osv.osv): continue return res + def _get_visibility_selection(self, cr, uid, context=None): + return [('public', 'All Users'), + ('employees', 'Employees Only')] + # Lambda indirection method to avoid passing a copy of the overridable method when declaring the field + _visibility_selection = lambda self, *args, **kwargs: self._get_visibility_selection(*args, **kwargs) + _columns = { 'name': fields.char('Name', size=64, required=True, translate=True, readonly=False, states={'done': [('readonly', True)]}), 'user_id': fields.many2one('res.users', 'Responsible User', readonly=False, states={'done': [('readonly', True)]}), @@ -209,11 +215,14 @@ class event_event(osv.osv): 'note': fields.text('Description', readonly=False, states={'done': [('readonly', True)]}), 'company_id': fields.many2one('res.company', 'Company', required=False, change_default=True, readonly=False, states={'done': [('readonly', True)]}), 'is_subscribed' : fields.function(_subscribe_fnc, type="boolean", string='Subscribed'), + 'visibility': fields.selection(_visibility_selection, 'Privacy / Visibility', + select=True, required=True), } _defaults = { 'state': 'draft', 'company_id': lambda self,cr,uid,c: self.pool.get('res.company')._company_default_get(cr, uid, 'event.event', context=c), 'user_id': lambda obj, cr, uid, context: uid, + 'visibility': 'employees', } def subscribe_to_event(self, cr, uid, ids, context=None): diff --git a/addons/event/event_view.xml b/addons/event/event_view.xml index 4f5e33eeafd..a9831720abf 100644 --- a/addons/event/event_view.xml +++ b/addons/event/event_view.xml @@ -76,6 +76,7 @@ <div class="oe_title"> <label for="name" class="oe_edit_only"/> <h1><field name="name"/></h1> + <field name="visibility"/> </div> <group> <group> diff --git a/addons/event/security/event_security.xml b/addons/event/security/event_security.xml index 83039ca4686..90a232731a7 100644 --- a/addons/event/security/event_security.xml +++ b/addons/event/security/event_security.xml @@ -25,25 +25,35 @@ <data noupdate="1"> <!-- Multi - Company Rules --> - <record model="ir.rule" id="event_event_comp_rule"> - <field name="name">Event multi-company</field> + <record model="ir.rule" id="event_event_company_rule"> + <field name="name">Event: multi-company</field> <field name="model_id" ref="model_event_event"/> <field name="global" eval="True"/> - <field name="domain_force">['|',('company_id','=',False),('company_id','child_of',[user.company_id.id])]</field> + <field name="domain_force">['|', + ('company_id', '=', False), + ('company_id', 'child_of', [user.company_id.id]), + ] + </field> </record> - - <record model="ir.rule" id="event_registration_comp_rule"> - <field name="name">Event Registration multi-company</field> + <record model="ir.rule" id="event_registration_company_rule"> + <field name="name">Event/Registration: multi-company</field> <field name="model_id" ref="model_event_registration"/> <field name="global" eval="True"/> - <field name="domain_force">['|',('company_id','=',False),('company_id','child_of',[user.company_id.id])]</field> + <field name="domain_force">['|', + ('company_id', '=', False), + ('company_id', 'child_of', [user.company_id.id]), + ] + </field> </record> - - <record model="ir.rule" id="report_event_registration_comp_rule"> - <field name="name">Report Event Registration multi-company</field> + <record model="ir.rule" id="report_event_registration_company_rule"> + <field name="name">Event/Report Registration: multi-company</field> <field name="model_id" ref="model_report_event_registration"/> <field name="global" eval="True"/> - <field name="domain_force">['|',('company_id','=',False),('company_id','child_of',[user.company_id.id])]</field> + <field name="domain_force">['|', + ('company_id', '=', False), + ('company_id', 'child_of', [user.company_id.id]), + ] + </field> </record> </data> |
