Merge lp:~camptocamp/partner-contact-management/partner_contact_management_display_name into lp:~partner-contact-core-editors/partner-contact-management/7.0

Proposed by Vincent Renaville@camptocamp
Status: Rejected
Rejected by: Guewen Baconnier @ Camptocamp
Proposed branch: lp:~camptocamp/partner-contact-management/partner_contact_management_display_name
Merge into: lp:~partner-contact-core-editors/partner-contact-management/7.0
Diff against target: 75 lines (+36/-2)
3 files modified
partner_firstname/__openerp__.py (+5/-2)
partner_firstname/partner.py (+8/-0)
partner_firstname/test/res_partner_display_name.yml (+23/-0)
To merge this branch: bzr merge lp:~camptocamp/partner-contact-management/partner_contact_management_display_name
Reviewer Review Type Date Requested Status
Yannick Vaucher @ Camptocamp Disapprove
Alexandre Fayolle - camptocamp code review, no test Needs Fixing
Review via email: mp+173860@code.launchpad.net

Description of the change

overwrite field display_name or account_report_company in order to set the store function trigger with firstname and lastname

To post a comment you must log in.
Revision history for this message
Alexandre Fayolle - camptocamp (alexandre-fayolle-c2c) wrote :

missing test

review: Needs Fixing (code review, no test)
22. By Vincent Renaville@camptocamp

[ADD] Test

23. By Vincent Renaville@camptocamp

[MRG] overwrite field display_name or account_report_company in order to set the store function trigger with firstname and lastname

24. By Vincent Renaville@camptocamp

[ADD] Test files for display_name field

Revision history for this message
Vincent Renaville@camptocamp (vrenaville-c2c) wrote :

Hello Alexandre,

Thanks for your review
I have just add a test for my patch.

Vincent

Revision history for this message
Yannick Vaucher @ Camptocamp (yvaucher-c2c) wrote :

There is a pending MP with a link module which should already do the trick:

https://code.launchpad.net/~camptocamp/partner-contact-management/7.0-add-firstname_display_name_trigger/+merge/165354

This allows to install partner_firstname module even without account.

As an other way to solve this issue already exists I set it to disapprove.

This MP solves the following bug:
https://bugs.launchpad.net/partner-contact-management/+bug/1183319

review: Disapprove
Revision history for this message
Guewen Baconnier @ Camptocamp (gbaconnier-c2c) wrote :

> There is a pending MP with a link module which should already do the trick:
>
> https://code.launchpad.net/~camptocamp/partner-contact-management/7.0-add-
> firstname_display_name_trigger/+merge/165354
>
>
> This allows to install partner_firstname module even without account.
>
> As an other way to solve this issue already exists I set it to disapprove.
>
>
> This MP solves the following bug:
> https://bugs.launchpad.net/partner-contact-management/+bug/1183319
According to this comment I put the MP as 'rejected'. Thanks

Unmerged revisions

24. By Vincent Renaville@camptocamp

[ADD] Test files for display_name field

23. By Vincent Renaville@camptocamp

[MRG] overwrite field display_name or account_report_company in order to set the store function trigger with firstname and lastname

22. By Vincent Renaville@camptocamp

[ADD] Test

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'partner_firstname/__openerp__.py'
2--- partner_firstname/__openerp__.py 2013-02-20 12:43:45 +0000
3+++ partner_firstname/__openerp__.py 2013-07-15 12:27:26 +0000
4@@ -27,13 +27,16 @@
5 'author': 'Camptocamp',
6 'category': 'MISC',
7 'website': 'http://www.camptocamp.com',
8- 'depends': ['base'],
9+ 'depends': ['base','account_report_company'],
10 'data': [
11 'partner_view.xml',
12 'res_user_view.xml',
13 ],
14 'demo': [],
15- 'test': [],
16+ 'test': [
17+ 'test/res_partner_display_name.yml',
18+ ],
19+
20 'auto_install': False,
21 'installable': True,
22 'images': []
23
24=== modified file 'partner_firstname/partner.py'
25--- partner_firstname/partner.py 2013-02-05 08:26:54 +0000
26+++ partner_firstname/partner.py 2013-07-15 12:27:26 +0000
27@@ -37,6 +37,13 @@
28 res[rec['id']] = name
29 return res
30
31+ _display_name_store_triggers = {
32+ 'res.partner': (lambda self,cr,uid,ids,context=None: self.search(cr, uid, [('id','child_of',ids)]),
33+ ['parent_id', 'is_company', 'name','firstname','lastname'], 10)
34+ }
35+ # indirection to avoid passing a copy of the overridable method when declaring the function field
36+ _display_name = lambda self, *args, **kwargs: self._display_name_compute(*args, **kwargs)
37+
38 def _write_name(self, cursor, uid, partner_id, field_name, field_value, arg, context=None):
39 return self.write(cursor, uid, partner_id, {'lastname': field_value})
40
41@@ -58,4 +65,5 @@
42 fnct_inv=_write_name),
43
44 'firstname': fields.char("Firstname"),
45+ 'display_name': fields.function(_display_name, type='char', string='Name', store=_display_name_store_triggers),
46 'lastname': fields.char("Lastname", required=True)}
47
48=== added directory 'partner_firstname/test'
49=== added file 'partner_firstname/test/res_partner_display_name.yml'
50--- partner_firstname/test/res_partner_display_name.yml 1970-01-01 00:00:00 +0000
51+++ partner_firstname/test/res_partner_display_name.yml 2013-07-15 12:27:26 +0000
52@@ -0,0 +1,23 @@
53+-
54+ !record {model: 'res.partner', id: partner_firstname.test_user1}:
55+ function: Service Manager
56+ email: tang@asustek.com
57+ firstname: Tang
58+ lastname: Tsui
59+-
60+ !record {model: 'res.partner', id: partner_firstname.test_user2}:
61+ parent_id: partner_firstname.test_user1
62+ use_parent_address: True
63+ function: Store Manager
64+ email: joseph.walters@asustek.com
65+ firstname: Joseph
66+ lastname: Walters
67+-
68+ I check that Initially supplier invoice state is "Draft"
69+-
70+ !assert {model: res.partner, id: partner_firstname.test_user1}:
71+ - display_name == 'Tsui Tang'
72+
73+-
74+ !assert {model: res.partner, id: partner_firstname.test_user2}:
75+ - display_name == 'Tsui Tang, Walters Joseph'

Subscribers

People subscribed via source and target branches

to status/vote changes: