[IMP] improve code
bzr revid: avo@tinyerp.com-20140313121727-jpop13zj1h64qj6i
This commit is contained in:
parent
55c3d2336a
commit
9e03bc126b
|
@ -786,18 +786,6 @@ class calendar_event(osv.Model):
|
||||||
data.update(update_data)
|
data.update(update_data)
|
||||||
self.write(cr, uid, ids, data, context=context)
|
self.write(cr, uid, ids, data, context=context)
|
||||||
return True
|
return True
|
||||||
|
|
||||||
def default_get(self, cr, uid, fields, context=None):
|
|
||||||
res = super(calendar_event, self).default_get(cr, uid, fields, context=context)
|
|
||||||
if context.get('active_model') == 'res.partner':
|
|
||||||
if context.get('user_id'):
|
|
||||||
res.update({'partner_ids' : [self.pool['res.users'].browse(cr, uid, context.get('user_id'), context=context).partner_id.id]})
|
|
||||||
|
|
||||||
if context.get('active_model') == 'crm.lead':
|
|
||||||
if context.get('partner_id'):
|
|
||||||
res.update({'partner_ids' : [context.get('partner_id')]})
|
|
||||||
return res
|
|
||||||
|
|
||||||
|
|
||||||
def _tz_get(self, cr, uid, context=None):
|
def _tz_get(self, cr, uid, context=None):
|
||||||
return [(x.lower(), x) for x in pytz.all_timezones]
|
return [(x.lower(), x) for x in pytz.all_timezones]
|
||||||
|
|
|
@ -76,14 +76,14 @@ Dashboard for CRM will include:
|
||||||
|
|
||||||
'crm_view.xml',
|
'crm_view.xml',
|
||||||
|
|
||||||
'crm_phonecall_view.xml',
|
|
||||||
'crm_phonecall_menu.xml',
|
|
||||||
|
|
||||||
'crm_lead_view.xml',
|
'crm_lead_view.xml',
|
||||||
'crm_lead_menu.xml',
|
'crm_lead_menu.xml',
|
||||||
|
|
||||||
'calendar_event_menu.xml',
|
'calendar_event_menu.xml',
|
||||||
|
|
||||||
|
'crm_phonecall_view.xml',
|
||||||
|
'crm_phonecall_menu.xml',
|
||||||
|
|
||||||
'report/crm_lead_report_view.xml',
|
'report/crm_lead_report_view.xml',
|
||||||
'report/crm_phonecall_report_view.xml',
|
'report/crm_phonecall_report_view.xml',
|
||||||
|
|
||||||
|
|
|
@ -317,7 +317,6 @@ class crm_lead(format_address, osv.osv):
|
||||||
|
|
||||||
def on_change_partner_id(self, cr, uid, ids, partner_id, context=None):
|
def on_change_partner_id(self, cr, uid, ids, partner_id, context=None):
|
||||||
values = {}
|
values = {}
|
||||||
phonecall_obj = self.pool.get('crm.phonecall')
|
|
||||||
if partner_id:
|
if partner_id:
|
||||||
partner = self.pool.get('res.partner').browse(cr, uid, partner_id, context=context)
|
partner = self.pool.get('res.partner').browse(cr, uid, partner_id, context=context)
|
||||||
values = {
|
values = {
|
||||||
|
@ -333,8 +332,6 @@ class crm_lead(format_address, osv.osv):
|
||||||
'fax': partner.fax,
|
'fax': partner.fax,
|
||||||
'zip': partner.zip,
|
'zip': partner.zip,
|
||||||
}
|
}
|
||||||
call_ids = phonecall_obj.search(cr, uid, [('opportunity_id','in',ids)], context)
|
|
||||||
phonecall_obj.write(cr, uid, call_ids, {'partner_id': partner_id}, context)
|
|
||||||
return {'value': values}
|
return {'value': values}
|
||||||
|
|
||||||
def on_change_user(self, cr, uid, ids, user_id, context=None):
|
def on_change_user(self, cr, uid, ids, user_id, context=None):
|
||||||
|
|
|
@ -395,7 +395,7 @@
|
||||||
context="{'default_opportunity_id': active_id, 'search_default_opportunity_id': active_id, 'default_partner_id': partner_id, 'default_duration': 1.0}" />
|
context="{'default_opportunity_id': active_id, 'search_default_opportunity_id': active_id, 'default_partner_id': partner_id, 'default_duration': 1.0}" />
|
||||||
<button string="Schedule a Meeting" type="action"
|
<button string="Schedule a Meeting" type="action"
|
||||||
name="%(calendar.action_calendar_event)d"
|
name="%(calendar.action_calendar_event)d"
|
||||||
context="{'partner_id': partner_id}"/>
|
context="{'default_partner_ids': partner_id and [partner_id]}"/>
|
||||||
</div>
|
</div>
|
||||||
<div class="oe_title">
|
<div class="oe_title">
|
||||||
<label for="name" class="oe_edit_only"/>
|
<label for="name" class="oe_edit_only"/>
|
||||||
|
|
|
@ -144,7 +144,7 @@
|
||||||
|
|
||||||
<menuitem name="Scheduled Calls" id="menu_crm_case_phone_outbound"
|
<menuitem name="Scheduled Calls" id="menu_crm_case_phone_outbound"
|
||||||
parent="crm.menu_crm_case_phone"
|
parent="crm.menu_crm_case_phone"
|
||||||
groups="crm.group_scheduled_calls_menu"
|
groups="crm.group_scheduled_calls"
|
||||||
action="crm_case_categ_phone_outgoing0"/>
|
action="crm_case_categ_phone_outgoing0"/>
|
||||||
|
|
||||||
</data>
|
</data>
|
||||||
|
|
|
@ -69,8 +69,8 @@ class crm_configuration(osv.TransientModel):
|
||||||
help="""Allows you to use Sales Teams to manage your leads and opportunities."""),
|
help="""Allows you to use Sales Teams to manage your leads and opportunities."""),
|
||||||
'alias_prefix': fields.char('Default Alias Name for Leads'),
|
'alias_prefix': fields.char('Default Alias Name for Leads'),
|
||||||
'alias_domain' : fields.char('Alias Domain'),
|
'alias_domain' : fields.char('Alias Domain'),
|
||||||
'group_scheduled_calls_menu': fields.boolean("Schedule calls to manage call center",
|
'group_scheduled_calls': fields.boolean("Schedule calls to manage call center",
|
||||||
implied_group='crm.group_scheduled_calls_menu',
|
implied_group='crm.group_scheduled_calls',
|
||||||
help="""This adds menu 'Scheduled Calls' under 'Sales / Phone Calls'""")
|
help="""This adds menu 'Scheduled Calls' under 'Sales / Phone Calls'""")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -14,8 +14,8 @@
|
||||||
<label for="id" string="Pre-Sale Services"/>
|
<label for="id" string="Pre-Sale Services"/>
|
||||||
<div>
|
<div>
|
||||||
<div>
|
<div>
|
||||||
<field name="group_scheduled_calls_menu" class="oe_inline"/>
|
<field name="group_scheduled_calls" class="oe_inline"/>
|
||||||
<label for="group_scheduled_calls_menu"/>
|
<label for="group_scheduled_calls"/>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</group>
|
</group>
|
||||||
|
|
|
@ -24,6 +24,16 @@ from openerp.osv import fields,osv
|
||||||
class res_partner(osv.osv):
|
class res_partner(osv.osv):
|
||||||
""" Inherits partner and adds CRM information in the partner form """
|
""" Inherits partner and adds CRM information in the partner form """
|
||||||
_inherit = 'res.partner'
|
_inherit = 'res.partner'
|
||||||
|
|
||||||
|
def schedule_meeting(self, cr, uid, id, context=None):
|
||||||
|
user_id = context.get('user_id')
|
||||||
|
if user_id:
|
||||||
|
partner_id = self.pool.get('res.users').browse(cr, uid, user_id).partner_id.id
|
||||||
|
res = self.pool.get('ir.actions.act_window').for_xml_id(cr, uid, 'calendar', 'action_calendar_event', context)
|
||||||
|
res['context'] = {
|
||||||
|
'default_partner_ids': user_id and [partner_id],
|
||||||
|
}
|
||||||
|
return res
|
||||||
|
|
||||||
def _opportunity_meeting_count(self, cr, uid, ids, field_name, arg, context=None):
|
def _opportunity_meeting_count(self, cr, uid, ids, field_name, arg, context=None):
|
||||||
res = dict(map(lambda x: (x,{'opportunity_count': 0, 'meeting_count': 0}), ids))
|
res = dict(map(lambda x: (x,{'opportunity_count': 0, 'meeting_count': 0}), ids))
|
||||||
|
|
|
@ -94,10 +94,8 @@
|
||||||
attrs="{'invisible': [('customer', '=', False)]}"
|
attrs="{'invisible': [('customer', '=', False)]}"
|
||||||
name="%(crm.crm_case_category_act_oppor11)d"
|
name="%(crm.crm_case_category_act_oppor11)d"
|
||||||
context="{'search_default_partner_id': active_id}"/>
|
context="{'search_default_partner_id': active_id}"/>
|
||||||
<button class="oe_inline" type="action"
|
<button class="oe_inline" string="Schedule a Meeting" type="object"
|
||||||
string="Schedule a Meeting"
|
name="schedule_meeting" context="{'user_id': user_id}"/>
|
||||||
name="%(calendar.action_calendar_event)d"
|
|
||||||
context="{'user_id': user_id}"/>
|
|
||||||
<button class="oe_inline" type="action" string="Calls"
|
<button class="oe_inline" type="action" string="Calls"
|
||||||
name="%(crm.crm_case_categ_phone_incoming0)d"
|
name="%(crm.crm_case_categ_phone_incoming0)d"
|
||||||
context="{'search_default_partner_id': active_id, 'default_duration': 1.0}" />
|
context="{'search_default_partner_id': active_id, 'default_duration': 1.0}" />
|
||||||
|
|
|
@ -42,7 +42,7 @@
|
||||||
<field name="category_id" ref="base.module_category_hidden"/>
|
<field name="category_id" ref="base.module_category_hidden"/>
|
||||||
</record>
|
</record>
|
||||||
|
|
||||||
<record id="group_scheduled_calls_menu" model="res.groups">
|
<record id="group_scheduled_calls" model="res.groups">
|
||||||
<field name="name">Show Scheduled Calls Menu</field>
|
<field name="name">Show Scheduled Calls Menu</field>
|
||||||
<field name="category_id" ref="base.module_category_hidden"/>
|
<field name="category_id" ref="base.module_category_hidden"/>
|
||||||
</record>
|
</record>
|
||||||
|
|
Loading…
Reference in New Issue