Merge lp:~akretion-team/openobject-addons/trunk-simple-user-to-employee into lp:openobject-addons

Proposed by Alexis de Lattre
Status: Superseded
Proposed branch: lp:~akretion-team/openobject-addons/trunk-simple-user-to-employee
Merge into: lp:openobject-addons
Diff against target: 46 lines (+16/-4)
2 files modified
hr/hr.py (+5/-0)
hr/hr_department_view.xml (+11/-4)
To merge this branch: bzr merge lp:~akretion-team/openobject-addons/trunk-simple-user-to-employee
Reviewer Review Type Date Requested Status
OpenERP Core Team Pending
Review via email: mp+92932@code.launchpad.net

This proposal has been superseded by a proposal from 2012-07-10.

Description of the change

In OpenERP 6.0, there was an "address_id" field on res_users, which provided a link from res_users to res_partner_address. This field was usefull to print the phone numbers of the salesman on quotes and invoices for example ; the "Salesman" field on res.partner, sale.order and account.invoice points to res_users, so we could use "o.user_id.address_id.phone" to display the fixed phone number of the Salesman for example.

This address_id field was removed of the "base" module in OpenERP server trunk in revision 3526 (August 2011) cf http://bazaar.launchpad.net/~openerp/openobject-server/trunk/revision/3526. The source commit in the dev branch is this one : http://bazaar.launchpad.net/~openerp-dev/openobject-server/trunk-usability-remove_address_id_email-rmu/revision/3425

So, we are not able to access detailed user information (phone numbers, etc...) from the res_users object any more.
After some thoughts, I think that the best solution is to add a link from res_users to hr_employee.
This merge proposal :
- Adds an 'employee_ids' one2many field on res.users ; it is the reverse of the 'user_id' many2one field on hr.employee.
- Add the field to the form view of res.users.

This merge proposal is a much simpler alternative to my other merge proposal https://code.launchpad.net/~alexis-via/openobject-addons/trunk-user-to-employee/+merge/90075. In fact, it doesn't add any complexity because it just defines the reverse one2many link of an existing many2one link between hr.employee and res.users.

I hope that this very simple merge proposal will be accepted in trunk.

To post a comment you must log in.

Unmerged revisions

6460. By Alexis de Lattre

[Merge] with latest addons-trunk.

6459. By Alexis de Lattre

Add 'employee_ids' one2many field on res.users ; it is the reverse of the 'user_id' many2one field on hr.employee.
Add the field to the form view of res.users.

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 2012-01-31 13:36:57 +0000
3+++ hr/hr.py 2012-02-14 09:12:22 +0000
4@@ -274,6 +274,11 @@
5
6 return user_id
7
8+ _columns = {
9+ 'employee_ids': fields.one2many('hr.employee', 'user_id', 'Related employees',
10+ help="List of employees that are attached to this user"),
11+ }
12+
13 res_users()
14
15
16
17=== modified file 'hr/hr_department_view.xml'
18--- hr/hr_department_view.xml 2011-12-19 16:54:40 +0000
19+++ hr/hr_department_view.xml 2012-02-14 09:12:22 +0000
20@@ -63,9 +63,16 @@
21 <field name="model">res.users</field>
22 <field name="inherit_id" ref="base.view_users_form"/>
23 <field name="arch" type="xml">
24- <group name="default_filters" position="inside">
25- <field name="context_department_id" completion="1" widget="selection" string="Department"/>
26- </group>
27+ <data>
28+ <group name="default_filters" position="inside">
29+ <field name="context_department_id" completion="1" widget="selection" string="Department"/>
30+ </group>
31+ <page string="Access Rights" position="after">
32+ <page string="Employees">
33+ <field name="employee_ids" nolabel="1" colspan="4" />
34+ </page>
35+ </page>
36+ </data>
37 </field>
38 </record>
39 <record model="ir.ui.view" id="view_department_form_simple_modif_inherited1">
40@@ -79,5 +86,5 @@
41 </group>
42 </field>
43 </record>
44- </data>
45+ </data>
46 </openerp>

Subscribers

People subscribed via source and target branches

to all changes: