Merge lp:~openerp-dev/openobject-addons/trunk-bug-1204455-ssh into lp:openobject-addons

Proposed by Sunil Sharma(OpenERP)
Status: Needs review
Proposed branch: lp:~openerp-dev/openobject-addons/trunk-bug-1204455-ssh
Merge into: lp:openobject-addons
Diff against target: 57 lines (+17/-1)
3 files modified
hr/hr.py (+8/-0)
hr/hr_view.xml (+3/-1)
hr/security/hr_security.xml (+6/-0)
To merge this branch: bzr merge lp:~openerp-dev/openobject-addons/trunk-bug-1204455-ssh
Reviewer Review Type Date Requested Status
Daniel Reis (community) Needs Information
OpenERP Core Team Pending
Review via email: mp+202082@code.launchpad.net

Description of the change

Hello,

       I have fix this bug, Employee personal address should be private information in hr.

Thanks
Sunil Sharma (SSH)

To post a comment you must log in.
Revision history for this message
Daniel Reis (dreis-pt) wrote :

The Record Rule is a good solution, but there is a use case that will not work:
Sometimes we have many2one field for res.partner that reference an OpenERP user.
For example: in Project Issues, we night wnat the "Contact" (partner_id) field to reference the Demo user.

I suggest using for the record rule:
<field name="domain_force">[('employee','=',False)] </field>

review: Needs Information
9055. By Sunil Sharma(OpenERP)

[imp]:as per suggestion

9056. By Sunil Sharma(OpenERP)

[imp]:add write method

Unmerged revisions

9056. By Sunil Sharma(OpenERP)

[imp]:add write method

9055. By Sunil Sharma(OpenERP)

[imp]:as per suggestion

9054. By Sunil Sharma(OpenERP)

[FIX]:hr:personal address should be private information

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'hr/hr.py'
2--- hr/hr.py 2013-12-12 09:32:34 +0000
3+++ hr/hr.py 2014-01-20 05:33:20 +0000
4@@ -252,6 +252,14 @@
5 )
6 return employee_id
7
8+ def write(self, cr, uid, ids, vals, context=None):
9+ """Overrides orm write method
10+ """
11+ if 'address_home_id' in vals:
12+ if vals['address_home_id']:
13+ self.pool.get('res.partner').write(cr, uid, vals['address_home_id'], {'employee': True})
14+ return super(hr_employee, self).write(cr, uid, ids, vals, context=context)
15+
16 def unlink(self, cr, uid, ids, context=None):
17 resource_ids = []
18 for employee in self.browse(cr, uid, ids, context=context):
19
20=== modified file 'hr/hr_view.xml'
21--- hr/hr_view.xml 2013-12-12 09:32:34 +0000
22+++ hr/hr_view.xml 2014-01-20 05:33:20 +0000
23@@ -67,7 +67,7 @@
24 <field name="otherid" groups="base.group_hr_user"/>
25 </group>
26 <group string="Contact Information">
27- <field name="address_home_id" context="{'show_address': 1}" options='{"always_reload": True, "highlight_first_line": True}'/>
28+ <field name="address_home_id" context="{'show_address': 1,'default_customer':0, 'default_supplier':0, 'default_employee':1}" options='{"always_reload": True, "highlight_first_line": True}'/>
29 </group>
30 <group string="Status">
31 <field name="gender"/>
32@@ -95,6 +95,8 @@
33 </field>
34 </record>
35
36+
37+
38 <record id="view_employee_tree" model="ir.ui.view">
39 <field name="name">hr.employee.tree</field>
40 <field name="model">hr.employee</field>
41
42=== modified file 'hr/security/hr_security.xml'
43--- hr/security/hr_security.xml 2013-10-27 12:31:04 +0000
44+++ hr/security/hr_security.xml 2014-01-20 05:33:20 +0000
45@@ -35,6 +35,12 @@
46 <field eval="True" name="global"/>
47 <field name="domain_force">['|',('company_id','=',False),('company_id','child_of',[user.company_id.id])]</field>
48 </record>
49+ <record id="hr_employee_address" model="ir.rule">
50+ <field name="name">hr employee address rule</field>
51+ <field name="model_id" ref="base.model_res_partner"/>
52+ <field name="domain_force">[('employee','=',False)] </field>
53+ <field name="groups" eval="[(4, ref('base.group_user'))]"/>
54+ </record>
55
56 </data>
57 </openerp>

Subscribers

People subscribed via source and target branches

to all changes: