Merge lp:~openerp-dev/openobject-addons/6.1-opw-573096-ira into lp:openobject-addons/6.1

Proposed by Ila Rana(Open ERP)
Status: Approved
Approved by: Naresh(OpenERP)
Approved revision: 6708
Proposed branch: lp:~openerp-dev/openobject-addons/6.1-opw-573096-ira
Merge into: lp:openobject-addons/6.1
Diff against target: 28 lines (+11/-1)
1 file modified
base_contact/base_contact.py (+11/-1)
To merge this branch: bzr merge lp:~openerp-dev/openobject-addons/6.1-opw-573096-ira
Reviewer Review Type Date Requested Status
Michael (OpenERP) (community) Approve
Julien Thewys (community) Approve
Naresh(OpenERP) (community) Approve
Xavier ALT Pending
Review via email: mp+99300@code.launchpad.net

Description of the change

Hello Naresh,

I have fixed the problem of "base_contact does not support lead_to_partner conversion".
At the time of partner creation the contact_id is not created. I have made changes in base_contact for same.

Thanks,
Ila Rana(ira)

To post a comment you must log in.
Revision history for this message
Naresh(OpenERP) (nch-openerp) :
review: Approve
Revision history for this message
Julien Thewys (julien-thewys) wrote :

Hello,

Thanks for the patch but it does not work for me:
1. the contact is still not created
2. it breaks a test:
openerp.tools.yaml_import: Assertion "NONAME" FAILED
test: len(job_ids) == 2
values: ! 0 == 2
3. the title cannot be saved on the crm.lead form (so it cannot be converted either)
4. base_contact uses both firstname and lastname instead of name, so converting to partner should also copy the firstname. It means that the crm.lead form view must be adapted to display a firstname and a lastname field.
5. the email and the phone should not be saved on the contact but rather on the address (= on the job).
Could you fix that also please?

Also, as a good practice for readability, it is recommended to write
    if 'contact_id' in data:
instead of
    if not data.get('contact_id', False):

I just also saw that the create method you modified had an error prone signature:
    context={}
instead of the idiom
    context=None

You can fix all that in a raw.

Thank you.

review: Needs Fixing
Revision history for this message
Julien Thewys (julien-thewys) wrote :

Forget about my last comment, I was not testing on the right environment.
Also my remark about "'contact_id' in" is false in this context.

So only the following is still true.
Thanks.

> 4. base_contact uses both firstname and lastname instead of name, so
> converting to partner should also copy the firstname. It means that the
> crm.lead form view must be adapted to display a firstname and a lastname
> field.
> 5. the email and the phone should not be saved on the contact but rather on
> the address (= on the job).
> Could you fix that also please?
>
> I just also saw that the create method you modified had an error prone
> signature:
> context={}
> instead of the idiom
> context=None

review: Needs Fixing
Revision history for this message
Julien Thewys (julien-thewys) :
review: Approve
Revision history for this message
Michael (OpenERP) (mva-openerp) :
review: Approve
Revision history for this message
Naresh(OpenERP) (nch-openerp) wrote :

Hello,

This bug was qualified as Not Relevant on Trunk (means that architecture on trunk has changed and so this bug has no meaning anymore). If this Merge Proposal could not be merged in v6.1 at the release of v7.0, it will be closed.

Thanks,
Naresh Soni

Unmerged revisions

6708. By Julien Thewys

[FIX] base_contact: last_name is required, must be non blank

When creating an address/job, you create a referenced contact only if a contact_id is not already provided AND last_name is provided.

6707. By Ila Rana(Open ERP)

[FIX]base_contact:base_contact does not support lead_to_partner conversion(573096)

6706. By Ila Rana(Open ERP)

[FIX]base_contact:base_contact does not support lead_to_partner conversion(573096)

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'base_contact/base_contact.py'
--- base_contact/base_contact.py 2012-02-15 13:22:13 +0000
+++ base_contact/base_contact.py 2012-04-13 14:01:20 +0000
@@ -209,7 +209,9 @@
209 'name' : fields.related('contact_id', 'name', type='char', size=64, string="Contact Name", store=True),209 'name' : fields.related('contact_id', 'name', type='char', size=64, string="Contact Name", store=True),
210 'title' : fields.related('contact_id', 'title', type='many2one', relation='res.partner.title', string="Title", store=True),210 'title' : fields.related('contact_id', 'title', type='many2one', relation='res.partner.title', string="Title", store=True),
211 }211 }
212 def create(self, cr, uid, data, context={}):212 def create(self, cr, uid, data, context=None):
213 if context is None:
214 context = {}
213 if not data.get('location_id', False):215 if not data.get('location_id', False):
214 loc_id = self.pool.get('res.partner.location').create(cr, uid, {216 loc_id = self.pool.get('res.partner.location').create(cr, uid, {
215 'street': data.get('street',''),217 'street': data.get('street',''),
@@ -220,6 +222,14 @@
220 'state_id': data.get('state_id',False)222 'state_id': data.get('state_id',False)
221 }, context=context)223 }, context=context)
222 data['location_id'] = loc_id224 data['location_id'] = loc_id
225 if not data.get('contact_id', False) and data.get('name', False):
226 con_id = self.pool.get('res.partner.contact').create(cr, uid, {
227 'last_name': data.get('name', ''),
228 'title': data.get('title', ''),
229 'partner_id': data.get('partner_id', False),
230 'function' : data.get('function', '')
231 }, context=context)
232 data['contact_id'] = con_id
223 result = super(res_partner_address, self).create(cr, uid, data, context=context)233 result = super(res_partner_address, self).create(cr, uid, data, context=context)
224 return result234 return result
225235