diff options
| author | Denis Ledoux <dle@openerp.com> | 2013-06-25 18:20:46 +0200 |
|---|---|---|
| committer | Denis Ledoux <dle@openerp.com> | 2013-06-25 18:20:46 +0200 |
| commit | 5ed41bcea4c5b0f4e4afdd45c8a114cf3ca144fc (patch) | |
| tree | f3d256944be2979be18c07282e62dc5bcb8ec10a /addons/event | |
| parent | 3afc97f451d8550f18b7b54a08456f7d242888e8 (diff) | |
| parent | c180afab26171617c1c7c22db5d9836b159e5e7d (diff) | |
[MERGE]upstream
bzr revid: dle@openerp.com-20130625162046-snd83ltaha9o5fl8
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> |
