CRM モジュールをカスタム モジュールに正常に継承しました。次に、リードをオポチュニティに変換し、コールをスケジュールする必要があります。リードをオポチュニティに変換しようとすると、次のエラーが表示されます。
エラー:
Client Traceback (most recent call last):
File "/usr/lib/pymodules/python2.7/openerp/addons/web/http.py", line 204, in dispatch
response["result"] = method(self, **self.params)
File "/usr/lib/pymodules/python2.7/openerp/addons/web/controllers/main.py", line 1128, in call_kw
return self._call_kw(req, model, method, args, kwargs)
File "/usr/lib/pymodules/python2.7/openerp/addons/web/controllers/main.py", line 1120, in _call_kw
return getattr(req.session.model(model), method)(*args, **kwargs)
File "/usr/lib/pymodules/python2.7/openerp/addons/web/session.py", line 42, in proxy
result = self.proxy.execute_kw(self.session._db, self.session._uid, self.session._password, self.model, method, args, kw)
File "/usr/lib/pymodules/python2.7/openerp/addons/web/session.py", line 30, in proxy_method
result = self.session.send(self.service_name, method, *args)
File "/usr/lib/pymodules/python2.7/openerp/addons/web/session.py", line 103, in send
raise xmlrpclib.Fault(openerp.tools.ustr(e), formatted_info)
Server Traceback (most recent call last):
File "/usr/lib/pymodules/python2.7/openerp/addons/web/session.py", line 89, in send
return openerp.netsvc.dispatch_rpc(service_name, method, args)
File "/usr/lib/pymodules/python2.7/openerp/netsvc.py", line 292, in dispatch_rpc
result = ExportService.getService(service_name).dispatch(method, params)
File "/usr/lib/pymodules/python2.7/openerp/service/web_services.py", line 626, in dispatch
res = fn(db, uid, *params)
File "/usr/lib/pymodules/python2.7/openerp/osv/osv.py", line 190, in execute_kw
return self.execute(db, uid, obj, method, *args, **kw or {})
File "/usr/lib/pymodules/python2.7/openerp/osv/osv.py", line 132, in wrapper
return f(self, dbname, *args, **kwargs)
File "/usr/lib/pymodules/python2.7/openerp/osv/osv.py", line 199, in execute
res = self.execute_cr(cr, uid, obj, method, *args, **kw)
File "/usr/lib/pymodules/python2.7/openerp/osv/osv.py", line 187, in execute_cr
return getattr(object, method)(cr, uid, *args, **kw)
File "/usr/lib/pymodules/python2.7/openerp/addons/crm/wizard/crm_lead_to_opportunity.py", line 51, in default_get
res = super(crm_lead2opportunity_partner, self).default_get(cr, uid, fields, context=context)
File "/usr/lib/pymodules/python2.7/openerp/addons/crm/wizard/crm_partner_binding.py", line 89, in default_get
res = super(crm_partner_binding, self).default_get(cr, uid, fields, context=context)
File "/usr/lib/pymodules/python2.7/openerp/osv/orm.py", line 1583, in default_get
self.view_init(cr, uid, fields_list, context)
File "/usr/lib/pymodules/python2.7/openerp/addons/crm/wizard/crm_lead_to_opportunity.py", line 91, in view_init
if lead.state in ['done', 'cancel']:
File "/usr/lib/pymodules/python2.7/openerp/osv/orm.py", line 499, in __getattr__
raise AttributeError(e)
AttributeError: 'Field state not found in browse_record(crm.lead, 4)'
コード Lead.py
from osv import osv
from osv import fields
class crm_lead(osv.osv):
_name = 'bala.lead'
_inherit = 'crm.lead'
_description = "adding fields to crm.lead"
_columns = {
'nitesh_lead': fields.char('Nitesh Lead',size=64),
'lead_source': fields.many2one('crm.lead.source','Lead Source'),
'lead_status': fields.many2one('crm.lead.status','Lead Status')
}
class res_partner_title(osv.osv):
_name = 'crm.lead.source'
_order = 'name'
_columns = {
'name': fields.char('Source', required=True, size=46, translate=True)
}
class res_partner_title(osv.osv):
_name = 'crm.lead.status'
_order = 'name'
_columns = {
'name': fields.char('Status', required=True, size=46, translate=True)
}
Lead_view.xml
<?xml version="1.0" encoding="utf-8"?>
<openerp>
<data>
<!-- ========================This is Form layout===============================-->
<record id="crm_case_form_view_leads_extended" model="ir.ui.view">
<field name="name">CRM - Leads Form</field>
<field name="model">bala.lead</field>
<field name="inherit_id" ref="crm.crm_case_form_view_leads" />
<field name="arch" type="xml">
<field name="email_from" postion="replace"/>
<field name="contact_name" position="replace"/>
<label for="contact_name" position="replace">
<br/>
</label>
<xpath expr="//label[@for='street']" position="before">
<field name="contact_name"/>
</xpath>
<xpath expr="//label[@for='section_id']" position="before">
<field name="lead_source"/>
<field name="lead_status"/>
</xpath>
<field name="function" position="replace"/>
<field name="partner_name" position="replace"/>
<field name="priority" position="replace"/>
<field name="categ_ids" position="replace"/>
<field name="partner_id" position="replace"/>
</field>
</record>
<!-- ===========================Action layout=========================== -->
<record id="new_lead" model="ir.actions.act_window">
<field name="name">Lead</field>
<field name="type">ir.actions.act_window</field>
<field name="res_model">bala.lead</field>
<field name="view_type">form</field>
<field name="view_mode">form,tree</field>
<field name="view_id" ref="crm_case_form_view_leads_extended"/>
</record>
<!-- ===========================Menu Settings=========================== -->
<menuitem name ="Lead" id = "menu_lis_lab" />
<menuitem name="Leads" id="sub_lead" parent="menu_lis_lab" />
<menuitem name="Create Lead" id="create_lead" parent="sub_lead" action="new_lead"/>
</data>
</openerp>