[MERGE] Separate crm.lead model from res.partner.

Currently, crm.lead inherit from res.partner, in order to have some address fields. It was previously inheriting from res.partner.address, and now from res.partner since the merge of the two models. In order to clean the models, crm.lead should be independent from res.partner.

Specs:
- copy fields required for the views
- remove the inherit from res.partner

bzr revid: tde@openerp.com-20120628151232-90b0ied228r82q38
This commit is contained in:
Thibault Delavallée 2012-06-28 17:12:32 +02:00
commit 4e793c24cb
2 changed files with 16 additions and 2 deletions

View File

@ -40,7 +40,7 @@ class crm_lead(base_stage, osv.osv):
_name = "crm.lead"
_description = "Lead/Opportunity"
_order = "priority,date_action,id desc"
_inherit = ['ir.needaction_mixin', 'mail.thread','res.partner']
_inherit = ['ir.needaction_mixin', 'mail.thread']
def _get_default_section_id(self, cr, uid, context=None):
""" Gives default section by checking if present in the context """
@ -245,6 +245,20 @@ class crm_lead(base_stage, osv.osv):
'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),
# Fields for address, due to separation from crm and res.partner
'street': fields.char('Street', size=128),
'street2': fields.char('Street2', size=128),
'zip': fields.char('Zip', change_default=True, size=24),
'city': fields.char('City', size=128),
'state_id': fields.many2one("res.country.state", 'State', domain="[('country_id','=',country_id)]"),
'country_id': fields.many2one('res.country', 'Country'),
'phone': fields.char('Phone', size=64),
'fax': fields.char('Fax', size=64),
'mobile': fields.char('Mobile', size=64),
'function': fields.char('Function', size=128),
'title': fields.many2one('res.partner.title', 'Title'),
'company_id': fields.many2one('res.company', 'Company', select=1),
}
_defaults = {

View File

@ -590,7 +590,7 @@
help="Opportunities that are assigned to either me or one of the sale teams I manage" />
<separator orientation="vertical"/>
<field name="user_id"/>
<field name="country"/>
<field name="country_id"/>
<field name="partner_id"/>
<field name="section_id"
context="{'invisible_section': False, 'default_section_id': self}"/>