diff --git a/addons/base_calendar/base_calendar.py b/addons/base_calendar/base_calendar.py
index 814b9587753..b1bb9742abf 100644
--- a/addons/base_calendar/base_calendar.py
+++ b/addons/base_calendar/base_calendar.py
@@ -250,8 +250,8 @@ class calendar_attendee(osv.osv):
if name == 'cn':
if attdata.user_id:
result[id][name] = attdata.user_id.name
- elif attdata.partner_address_id:
- result[id][name] = attdata.partner_address_id.name or attdata.partner_id.name
+ elif attdata.partner_id:
+ result[id][name] = attdata.partner_id.name or False
else:
result[id][name] = attdata.email or ''
@@ -365,9 +365,7 @@ that points to the directory information corresponding to the attendee."),
store=True, help="To specify the language for text values in a\
property or property parameter."),
'user_id': fields.many2one('res.users', 'User'),
- 'partner_address_id': fields.many2one('res.partner.address', 'Contact'),
- 'partner_id': fields.related('partner_address_id', 'partner_id', type='many2one', \
- relation='res.partner', string='Partner', help="Partner related to contact"),
+ 'partner_id': fields.many2one('res.partner', 'Contact'),
'email': fields.char('Email', size=124, help="Email of Invited Person"),
'event_date': fields.function(_compute_data, string='Event Date', \
type="datetime", multi='event_date'),
diff --git a/addons/base_calendar/base_calendar_view.xml b/addons/base_calendar/base_calendar_view.xml
index 16064762f9b..09cd2a0c416 100644
--- a/addons/base_calendar/base_calendar_view.xml
+++ b/addons/base_calendar/base_calendar_view.xml
@@ -22,10 +22,8 @@
-
+ string="Contact" />
@@ -78,7 +76,7 @@
-
+
@@ -132,7 +130,7 @@
+ context="{'group_by':'partner_id'}" />
diff --git a/addons/base_calendar/wizard/base_calendar_invite_attendee.py b/addons/base_calendar/wizard/base_calendar_invite_attendee.py
index e3a38c069b8..676f9b3fdd2 100644
--- a/addons/base_calendar/wizard/base_calendar_invite_attendee.py
+++ b/addons/base_calendar/wizard/base_calendar_invite_attendee.py
@@ -41,7 +41,7 @@ class base_calendar_invite_attendee(osv.osv_memory):
'invite_id', 'user_id', 'Users'),
'partner_id': fields.many2one('res.partner', 'Partner'),
'email': fields.char('Email', size=124, help="Provide external email address who will receive this invitation."),
- 'contact_ids': fields.many2many('res.partner.address', 'invite_contact_rel',
+ 'contact_ids': fields.many2many('res.partner', 'invite_contact_rel',
'invite_id', 'contact_id', 'Contacts'),
'send_mail': fields.boolean('Send mail?', help='Check this if you want to \
send an Email to Invited Person')
@@ -112,10 +112,10 @@ send an Email to Invited Person')
mail_to.append(datas['email'])
elif type == 'partner':
- add_obj = self.pool.get('res.partner.address')
+ add_obj = self.pool.get('res.partner')
for contact in add_obj.browse(cr, uid, datas['contact_ids']):
res = {
- 'partner_address_id': contact.id,
+ 'partner_id': contact.id,
'email': contact.email
}
res.update(ref)
@@ -159,8 +159,8 @@ send an Email to Invited Person')
if not partner_id:
return {'value': {'contact_ids': []}}
- cr.execute('SELECT id FROM res_partner_address \
- WHERE partner_id=%s', (partner_id,))
+ cr.execute('SELECT id FROM res_partner \
+ WHERE id=%s or parent_id =%s' , (partner_id,partner_id,))
contacts = map(lambda x: x[0], cr.fetchall())
return {'value': {'contact_ids': contacts}}
diff --git a/addons/crm/crm.py b/addons/crm/crm.py
index 4ebb0b4796d..d4ffe6cf9ae 100644
--- a/addons/crm/crm.py
+++ b/addons/crm/crm.py
@@ -178,7 +178,6 @@ class crm_base(object):
date_closed
user_id
partner_id
- partner_address_id
"""
def _get_default_partner_address(self, cr, uid, context=None):
"""Gives id of default address for current user
@@ -238,7 +237,7 @@ class crm_base(object):
"""
data = {'value': {'email_from': False, 'phone':False}}
if add:
- address = self.pool.get('res.partner.address').browse(cr, uid, add)
+ address = self.pool.get('res.partner').browse(cr, uid, add)
data['value'] = {'email_from': address and address.email or False ,
'phone': address and address.phone or False}
if 'phone' not in self._columns:
@@ -254,7 +253,6 @@ class crm_base(object):
data={}
if part:
addr = self.pool.get('res.partner').address_get(cr, uid, [part], ['contact'])
- data = {'partner_address_id': addr['contact']}
data.update(self.onchange_partner_address_id(cr, uid, ids, addr['contact'])['value'])
return {'value': data}
diff --git a/addons/crm/crm_lead.py b/addons/crm/crm_lead.py
index b17fa31ac91..94194d8e7ce 100644
--- a/addons/crm/crm_lead.py
+++ b/addons/crm/crm_lead.py
@@ -40,7 +40,7 @@ class crm_lead(crm_case, osv.osv):
_name = "crm.lead"
_description = "Lead/Opportunity"
_order = "priority,date_action,id desc"
- _inherit = ['mail.thread','res.partner.address']
+ _inherit = ['mail.thread','res.partner']
def _read_group_stage_ids(self, cr, uid, ids, domain, read_group_order=None, access_rights_uid=None, context=None):
access_rights_uid = access_rights_uid or uid
@@ -170,7 +170,7 @@ class crm_lead(crm_case, osv.osv):
domain="['|',('section_id','=',section_id),('section_id','=',False)]", help="From which campaign (seminar, marketing campaign, mass mailing, ...) did this contact come from?"),
'channel_id': fields.many2one('crm.case.channel', 'Channel', help="Communication channel (mail, direct, phone, ...)"),
'contact_name': fields.char('Contact Name', size=64),
- 'partner_name': fields.char("Customer Name", size=64,help='The name of the future partner that will be created while converting the lead into opportunity', select=1),
+ 'partner_name': fields.char("Customer Name", size=64,help='The name of the future partner company that will be created while converting the lead into opportunity', select=1),
'optin': fields.boolean('Opt-In', help="If opt-in is checked, this contact has accepted to receive emails."),
'optout': fields.boolean('Opt-Out', help="If opt-out is checked, this contact has refused to receive emails or unsubscribed to a campaign."),
'type':fields.selection([ ('lead','Lead'), ('opportunity','Opportunity'), ],'Type', help="Type is used to separate Leads and Opportunities"),
@@ -194,7 +194,6 @@ class crm_lead(crm_case, osv.osv):
# Only used for type opportunity
- 'partner_address_id': fields.many2one('res.partner.address', 'Partner Contact', domain="[('partner_id','=',partner_id)]"),
'probability': fields.float('Probability (%)',group_operator="avg"),
'planned_revenue': fields.float('Expected Revenue'),
'ref': fields.reference('Reference', selection=crm._links_get, size=128),
@@ -205,8 +204,8 @@ class crm_lead(crm_case, osv.osv):
'title_action': fields.char('Next Action', size=64),
'stage_id': fields.many2one('crm.case.stage', 'Stage', domain="[('section_ids', '=', section_id)]"),
'color': fields.integer('Color Index'),
- 'partner_address_name': fields.related('partner_address_id', 'name', type='char', string='Partner Contact Name', readonly=True),
- 'partner_address_email': fields.related('partner_address_id', 'email', type='char', string='Partner Contact Email', readonly=True),
+ 'partner_address_name': fields.related('partner_id', 'name', type='char', string='Partner Contact Name', readonly=True),
+ 'partner_address_email': fields.related('partner_id', 'email', type='char', string='Partner Contact Email', readonly=True),
'company_currency': fields.related('company_id', 'currency_id', 'symbol', type='char', string='Company Currency', readonly=True),
'user_email': fields.related('user_id', 'user_email', type='char', string='User Email', readonly=True),
'user_login': fields.related('user_id', 'login', type='char', string='User Login', readonly=True),
@@ -230,7 +229,7 @@ class crm_lead(crm_case, osv.osv):
"""
if not add:
return {'value': {'email_from': False, 'country_id': False}}
- address = self.pool.get('res.partner.address').browse(cr, uid, add)
+ address = self.pool.get('res.partner').browse(cr, uid, add)
return {'value': {'email_from': address.email, 'phone': address.phone, 'country_id': address.country_id.id}}
def on_change_optin(self, cr, uid, ids, optin):
@@ -501,8 +500,7 @@ class crm_lead(crm_case, osv.osv):
first_opportunity = opportunities_list[0]
tail_opportunities = opportunities_list[1:]
- fields = ['partner_id', 'title', 'name', 'categ_id', 'channel_id', 'city', 'company_id', 'contact_name', 'country_id',
- 'partner_address_id', 'type_id', 'user_id', 'section_id', 'state_id', 'description', 'email', 'fax', 'mobile',
+ fields = ['partner_id', 'title', 'name', 'categ_id', 'channel_id', 'city', 'company_id', 'contact_name', 'country_id', 'type_id', 'user_id', 'section_id', 'state_id', 'description', 'email', 'fax', 'mobile',
'partner_name', 'phone', 'probability', 'planned_revenue', 'street', 'street2', 'zip', 'create_date', 'date_action_last',
'date_action_next', 'email_from', 'email_cc', 'partner_name']
@@ -546,7 +544,6 @@ class crm_lead(crm_case, osv.osv):
'stage_id': stage_id or False,
'date_action': time.strftime('%Y-%m-%d %H:%M:%S'),
'date_open': time.strftime('%Y-%m-%d %H:%M:%S'),
- 'partner_address_id': contact_id,
}
def _convert_opportunity_notification(self, cr, uid, lead, context=None):
@@ -580,15 +577,42 @@ class crm_lead(crm_case, osv.osv):
}, context=context)
return True
- def _lead_create_partner(self, cr, uid, lead, context=None):
+ def _lead_create_contact(self, cr, uid, lead, name, is_company, parent_id=False, context=None):
partner = self.pool.get('res.partner')
- partner_id = partner.create(cr, uid, {
- 'name': lead.partner_name or lead.contact_name or lead.name,
- 'user_id': lead.user_id.id,
- 'comment': lead.description,
- 'section_id': lead.section_id.id or False,
- 'address': []
- })
+ vals = { 'name': name,
+ 'user_id': lead.user_id.id,
+ 'comment': lead.description,
+ 'section_id': lead.section_id.id or False,
+ 'parent_id': parent_id,
+ 'phone': lead.phone,
+ 'mobile': lead.mobile,
+ 'email': lead.email_from and to_email(lead.email_from)[0],
+ 'fax': lead.fax,
+ 'title': lead.title and lead.title.id or False,
+ 'function': lead.function,
+ 'street': lead.street,
+ 'street2': lead.street2,
+ 'zip': lead.zip,
+ 'city': lead.city,
+ 'country_id': lead.country_id and lead.country_id.id or False,
+ 'state_id': lead.state_id and lead.state_id.id or False,
+ 'is_company': is_company,
+ }
+
+ partner = partner.create(cr, uid,vals, context)
+ return partner
+
+ def _create_lead_partner(self, cr, uid, lead, context=None):
+ partner_id = False
+ if lead.partner_name and lead.contact_name:
+ partner_id = self._lead_create_contact(cr, uid, lead, lead.partner_name, 'partner', context=context)
+ self._lead_create_contact(cr, uid, lead, lead.contact_name, 'contact', partner_id, context=context)
+ elif lead.partner_name and not lead.contact_name:
+ partner_id = self._lead_create_contact(cr, uid, lead, lead.partner_name, 'partner', context=context)
+ elif not lead.partner_name and lead.contact_name:
+ partner_id = self._lead_create_contact(cr, uid, lead, lead.contact_name, 'contact', context=context)
+ else:
+ partner_id = self._lead_create_contact(cr, uid, lead, lead.name, 'contact', context=context)
return partner_id
def _lead_set_partner(self, cr, uid, lead, partner_id, context=None):
@@ -597,29 +621,9 @@ class crm_lead(crm_case, osv.osv):
if partner_id:
res_partner.write(cr, uid, partner_id, {'section_id': lead.section_id.id or False})
contact_id = res_partner.address_get(cr, uid, [partner_id])['default']
- res = lead.write({'partner_id' : partner_id, 'partner_address_id': contact_id}, context=context)
-
+ res = lead.write({'partner_id' : partner_id, }, context=context)
return res
- def _lead_create_partner_address(self, cr, uid, lead, partner_id, context=None):
- address = self.pool.get('res.partner.address')
- return address.create(cr, uid, {
- 'partner_id': partner_id,
- 'name': lead.contact_name,
- 'phone': lead.phone,
- 'mobile': lead.mobile,
- 'email': lead.email_from and to_email(lead.email_from)[0],
- 'fax': lead.fax,
- 'title': lead.title and lead.title.id or False,
- 'function': lead.function,
- 'street': lead.street,
- 'street2': lead.street2,
- 'zip': lead.zip,
- 'city': lead.city,
- 'country_id': lead.country_id and lead.country_id.id or False,
- 'state_id': lead.state_id and lead.state_id.id or False,
- })
-
def convert_partner(self, cr, uid, ids, action='create', partner_id=False, context=None):
"""
This function convert partner based on action.
@@ -632,8 +636,7 @@ class crm_lead(crm_case, osv.osv):
for lead in self.browse(cr, uid, ids, context=context):
if action == 'create':
if not partner_id:
- partner_id = self._lead_create_partner(cr, uid, lead, context=context)
- self._lead_create_partner_address(cr, uid, lead, partner_id, context=context)
+ partner_id = self._create_lead_partner(cr, uid, lead, context)
self._lead_set_partner(cr, uid, lead, partner_id, context=context)
partner_ids[lead.id] = partner_id
return partner_ids
@@ -694,9 +697,8 @@ class crm_lead(crm_case, osv.osv):
'date' : schedule_time,
'section_id' : section_id or False,
'partner_id': lead.partner_id and lead.partner_id.id or False,
- 'partner_address_id': lead.partner_address_id and lead.partner_address_id.id or False,
- 'partner_phone' : phone or lead.phone or (lead.partner_address_id and lead.partner_address_id.phone or False),
- 'partner_mobile' : lead.partner_address_id and lead.partner_address_id.mobile or False,
+ 'partner_phone' : phone or lead.phone or (lead.partner_id and lead.partner_id.phone or False),
+ 'partner_mobile' : lead.partner_id and lead.partner_id.mobile or False,
'priority': lead.priority,
}
diff --git a/addons/crm/crm_lead_demo.xml b/addons/crm/crm_lead_demo.xml
index 830b572676d..e4d32cdaa13 100644
--- a/addons/crm/crm_lead_demo.xml
+++ b/addons/crm/crm_lead_demo.xml
@@ -103,7 +103,6 @@
-
@@ -240,7 +239,6 @@
-
opportunity
@@ -256,7 +254,6 @@
-
opportunity
@@ -307,7 +304,6 @@
opportunity
-
@@ -332,7 +328,6 @@
opportunity
-
@@ -353,7 +348,6 @@
-
opportunity
@@ -372,7 +366,6 @@
-
opportunity
@@ -397,7 +390,6 @@
-
opportunity
@@ -426,7 +418,6 @@
-
opportunity
@@ -450,7 +441,6 @@
-
opportunity
@@ -473,7 +463,6 @@
-
opportunity
@@ -496,7 +485,6 @@
-
opportunity
@@ -509,7 +497,6 @@
-
opportunity
diff --git a/addons/crm/crm_lead_view.xml b/addons/crm/crm_lead_view.xml
index 44d83f47634..6e2540f7954 100644
--- a/addons/crm/crm_lead_view.xml
+++ b/addons/crm/crm_lead_view.xml
@@ -81,7 +81,7 @@
-
+
@@ -259,7 +259,6 @@
date_start="date_action" color="user_id">
-
@@ -479,10 +478,7 @@
string="Create"
attrs="{'invisible':[('partner_id','!=',False)]}"/>
-
+
@@ -156,7 +153,6 @@
-
diff --git a/addons/crm/crm_phonecall.py b/addons/crm/crm_phonecall.py
index 8d9a47b15eb..a5a4c0862bf 100644
--- a/addons/crm/crm_phonecall.py
+++ b/addons/crm/crm_phonecall.py
@@ -44,8 +44,6 @@ class crm_phonecall(crm_base, osv.osv):
select=True, help='Sales team to which Case belongs to.'),
'user_id': fields.many2one('res.users', 'Responsible'),
'partner_id': fields.many2one('res.partner', 'Partner'),
- 'partner_address_id': fields.many2one('res.partner.address', 'Partner Contact', \
- domain="[('partner_id','=',partner_id)]"),
'company_id': fields.many2one('res.company', 'Company'),
'description': fields.text('Description'),
'state': fields.selection([
@@ -67,8 +65,6 @@ class crm_phonecall(crm_base, osv.osv):
domain="['|',('section_id','=',section_id),('section_id','=',False),\
('object_id.model', '=', 'crm.phonecall')]"),
'partner_phone': fields.char('Phone', size=32),
- 'partner_contact': fields.related('partner_address_id', 'name', \
- type="char", string="Contact", size=128),
'partner_mobile': fields.char('Mobile', size=32),
'priority': fields.selection(crm.AVAILABLE_PRIORITIES, 'Priority'),
'date_closed': fields.datetime('Closed', readonly=True),
@@ -95,7 +91,7 @@ class crm_phonecall(crm_base, osv.osv):
res = super(crm_phonecall, self).onchange_partner_address_id(cr, uid, ids, add, email)
res.setdefault('value', {})
if add:
- address = self.pool.get('res.partner.address').browse(cr, uid, add)
+ address = self.pool.get('res.partner').browse(cr, uid, add)
res['value']['partner_phone'] = address.phone
res['value']['partner_mobile'] = address.mobile
return res
@@ -153,7 +149,6 @@ class crm_phonecall(crm_base, osv.osv):
'date' : schedule_time,
'section_id' : section_id or False,
'partner_id': call.partner_id and call.partner_id.id or False,
- 'partner_address_id': call.partner_address_id and call.partner_address_id.id or False,
'partner_phone' : call.partner_phone,
'partner_mobile' : call.partner_mobile,
'priority': call.priority,
@@ -180,9 +175,9 @@ class crm_phonecall(crm_base, osv.osv):
return self.write(cr, uid, ids, {'partner_id' : partner_id}, context=context)
def _call_create_partner_address(self, cr, uid, phonecall, partner_id, context=None):
- address = self.pool.get('res.partner.address')
+ address = self.pool.get('res.partner')
return address.create(cr, uid, {
- 'partner_id': partner_id,
+ 'parent_id': partner_id,
'name': phonecall.name,
'phone': phonecall.partner_phone,
})
@@ -227,7 +222,6 @@ class crm_phonecall(crm_base, osv.osv):
def convert_opportunity(self, cr, uid, ids, opportunity_summary=False, partner_id=False, planned_revenue=0.0, probability=0.0, context=None):
partner = self.pool.get('res.partner')
- address = self.pool.get('res.partner.address')
opportunity = self.pool.get('crm.lead')
opportunity_dict = {}
default_contact = False
@@ -237,14 +231,12 @@ class crm_phonecall(crm_base, osv.osv):
if partner_id:
address_id = partner.address_get(cr, uid, [partner_id])['default']
if address_id:
- default_contact = address.browse(cr, uid, address_id, context=context)
+ default_contact = partner.browse(cr, uid, address_id, context=context)
opportunity_id = opportunity.create(cr, uid, {
'name': opportunity_summary or call.name,
'planned_revenue': planned_revenue,
'probability': probability,
'partner_id': partner_id or False,
- 'partner_address_id': default_contact and default_contact.id,
- 'phone': default_contact and default_contact.phone,
'mobile': default_contact and default_contact.mobile,
'section_id': call.section_id and call.section_id.id or False,
'description': call.description or False,
diff --git a/addons/crm/crm_phonecall_demo.xml b/addons/crm/crm_phonecall_demo.xml
index e80930284f4..614b93f2bc1 100644
--- a/addons/crm/crm_phonecall_demo.xml
+++ b/addons/crm/crm_phonecall_demo.xml
@@ -5,7 +5,6 @@
((((((((((( Demo Cases )))))))))))
-->
-
@@ -21,7 +20,6 @@
-
@@ -37,7 +35,6 @@
-
@@ -68,7 +65,6 @@
-
diff --git a/addons/crm/crm_phonecall_view.xml b/addons/crm/crm_phonecall_view.xml
index 34ef2612623..93f18fac679 100644
--- a/addons/crm/crm_phonecall_view.xml
+++ b/addons/crm/crm_phonecall_view.xml
@@ -28,7 +28,6 @@
-
@@ -91,8 +90,6 @@
attrs="{'invisible':[('partner_id','!=',False)]}"
groups="base.group_partner_manager"/>
-
@@ -140,9 +137,7 @@
-
+
diff --git a/addons/crm/res_partner.py b/addons/crm/res_partner.py
index 2bccdeed235..62cd977a428 100644
--- a/addons/crm/res_partner.py
+++ b/addons/crm/res_partner.py
@@ -64,7 +64,6 @@ class res_partner(osv.osv):
'planned_revenue' : planned_revenue,
'probability' : probability,
'partner_id' : partner_id,
- 'partner_address_id' : address,
'categ_id' : categ_ids and categ_ids[0] or '',
'state' :'draft',
'type': 'opportunity'
diff --git a/addons/crm/res_partner_view.xml b/addons/crm/res_partner_view.xml
index bcb11fe6b11..8e01d9d6bea 100644
--- a/addons/crm/res_partner_view.xml
+++ b/addons/crm/res_partner_view.xml
@@ -24,7 +24,7 @@
-
+
diff --git a/addons/crm/wizard/crm_lead_to_opportunity.py b/addons/crm/wizard/crm_lead_to_opportunity.py
index 52a79e4514c..f6fd4332745 100644
--- a/addons/crm/wizard/crm_lead_to_opportunity.py
+++ b/addons/crm/wizard/crm_lead_to_opportunity.py
@@ -67,8 +67,6 @@ class crm_lead2opportunity_partner(osv.osv_memory):
ids = lead_obj.search(cr, uid, [('partner_id', '=', partner_id), ('type', '=', 'opportunity'), '!', ('state', 'in', ['done', 'cancel'])])
if ids:
opportunities.append(ids[0])
-
-
if not partner_id:
label = False
opp_ids = []
diff --git a/addons/crm/wizard/crm_opportunity_to_phonecall.py b/addons/crm/wizard/crm_opportunity_to_phonecall.py
index ed2a8e7fd1c..873dd6ab36e 100644
--- a/addons/crm/wizard/crm_opportunity_to_phonecall.py
+++ b/addons/crm/wizard/crm_opportunity_to_phonecall.py
@@ -55,9 +55,9 @@ class crm_opportunity2phonecall(osv.osv_memory):
if 'note' in fields:
res.update({'note': opp.description})
if 'contact_name' in fields:
- res.update({'contact_name': opp.partner_address_id and opp.partner_address_id.name or False})
+ res.update({'contact_name': opp.partner_id and opp.partner_id.name or False})
if 'phone' in fields:
- res.update({'phone': opp.phone or (opp.partner_address_id and opp.partner_address_id.phone or False)})
+ res.update({'phone': opp.phone or (opp.partner_id and opp.partner_id.phone or False)})
return res
def action_schedule(self, cr, uid, ids, context=None):
diff --git a/addons/crm/wizard/crm_phonecall_to_partner.py b/addons/crm/wizard/crm_phonecall_to_partner.py
index 0fa077bbf42..0263bfe3b53 100644
--- a/addons/crm/wizard/crm_phonecall_to_partner.py
+++ b/addons/crm/wizard/crm_phonecall_to_partner.py
@@ -38,17 +38,16 @@ class crm_phonecall2partner(osv.osv_memory):
phonecall_obj = self.pool.get('crm.phonecall')
partner_obj = self.pool.get('res.partner')
- contact_obj = self.pool.get('res.partner.address')
rec_ids = context and context.get('active_ids', [])
value = {}
-
+ partner_id = False
for phonecall in phonecall_obj.browse(cr, uid, rec_ids, context=context):
partner_ids = partner_obj.search(cr, uid, [('name', '=', phonecall.name or phonecall.name)])
if not partner_ids and phonecall.email_from:
- address_ids = contact_obj.search(cr, uid, ['|', ('phone', '=', phonecall.partner_phone), ('mobile','=',phonecall.partner_mobile)])
+ address_ids = partner_obj.search(cr, uid, ['|', ('phone', '=', phonecall.partner_phone), ('mobile','=',phonecall.partner_mobile)])
if address_ids:
- addresses = contact_obj.browse(cr, uid, address_ids)
- partner_ids = addresses and [addresses[0].partner_id.id] or False
+ addresses = partner_ids.browse(cr, uid, address_ids)
+ partner_ids = addresses and [addresses[0].parent_id.id] or False
partner_id = partner_ids and partner_ids[0] or False
return partner_id