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

Subscribers

People subscribed via source and target branches

to status/vote changes: