[IMP] Added company_id and currency_symbole field and improved related code to show tooltip as per requrement and 5 sec late,improved css to show proper cursore, improved actions & domains for proper results.

bzr revid: tpa@tinyerp.com-20130730110822-zzioh92in4azqay8
This commit is contained in:
Turkesh Patel (Open ERP)
2013-07-30 16:38:22 +05:30
parent 0049c8efe8
commit eb700cf29b
6 changed files with 69 additions and 14 deletions
+11 -1
View File
@@ -156,6 +156,13 @@ class crm_case_section(osv.osv):
res[id]['monthly_planned_revenue'] = self.__get_bar_values(cr, uid, obj, opp_domain, ['planned_revenue', 'create_date'], 'planned_revenue', 'create_date', context=context)
return res
def _get_currency_symbol(self, cr, uid, ids, name, arg, context=None):
"""Set currency symbole of company currency"""
res = {}
for sales_team in self.browse(cr, uid, ids, context=context):
res[sales_team.id] = sales_team.company_id.currency_id.symbol
return res
_columns = {
'name': fields.char('Sales Team', size=64, required=True, translate=True),
'complete_name': fields.function(get_full_name, type='char', size=256, readonly=True, store=True),
@@ -184,7 +191,9 @@ class crm_case_section(osv.osv):
string='Open Leads per Month'),
'monthly_planned_revenue': fields.function(_get_opportunities_data,
type="string", readonly=True, multi='_get_opportunities_data',
string='Planned Revenue per Month')
string='Planned Revenue per Month'),
'company_id': fields.many2one('res.company', 'Company', select=1),
'currency_symbol': fields.function(_get_currency_symbol, string='Currency Symbol', method=True, type='char'),
}
def _get_stage_common(self, cr, uid, context):
@@ -195,6 +204,7 @@ class crm_case_section(osv.osv):
'active': 1,
'stage_ids': _get_stage_common,
'use_leads': True,
'company_id': lambda s, cr, uid, c: s.pool.get('res.company')._company_default_get(cr, uid, 'crm.case.section', context=c),
}
_sql_constraints = [
+49 -4
View File
@@ -13,7 +13,6 @@
<field name="search_view_id" ref="crm.view_crm_case_leads_filter"/>
<field name="context">{
'search_default_section_id': [active_id],
'search_default_open': 1,
'default_section_id': active_id,
'default_type': 'lead',
'stage_type': 'lead',
@@ -43,7 +42,6 @@
<field name="search_view_id" ref="crm.view_crm_case_opportunities_filter"/>
<field name="context">{
'search_default_section_id': [active_id],
'search_default_assigned_to_me': 1,
'default_section_id': active_id,
'stage_type': 'opportunity',
'default_type': 'opportunity',
@@ -64,6 +62,52 @@
</field>
</record>
<record id="action_report_crm_lead_salesteam" model="ir.actions.act_window">
<field name="name">Leads Analysis</field>
<field name="res_model">crm.lead.report</field>
<field name="view_type">form</field>
<field name="context">{"search_default_month":1}</field>
<field name="view_mode">tree,graph</field>
<field name="domain">[('type','=', 'lead'),('section_id', '=', active_id)]</field>
<field name="help">Leads Analysis allows you to check different CRM related information like the treatment delays or number of leads per state. You can sort out your leads analysis by different groups to get accurate grained analysis.</field>
</record>
<record model="ir.actions.act_window.view" id="action_report_crm_lead_salesteam_tree">
<field name="sequence" eval="1"/>
<field name="view_mode">tree</field>
<field name="view_id" ref="view_report_crm_lead_tree"/>
<field name="act_window_id" ref="action_report_crm_lead_salesteam"/>
</record>
<record model="ir.actions.act_window.view" id="action_report_crm_lead_salesteam_graph">
<field name="sequence" eval="2"/>
<field name="view_mode">graph</field>
<field name="view_id" ref="view_report_crm_lead_graph"/>
<field name="act_window_id" ref="action_report_crm_lead_salesteam"/>
</record>
<record id="action_report_crm_opportunity_salesteam" model="ir.actions.act_window">
<field name="name">Opportunities Analysis</field>
<field name="res_model">crm.lead.report</field>
<field name="view_type">form</field>
<field name="context">{"search_default_month":1}</field>
<field name="view_mode">tree,graph</field>
<field name="domain">[('type','=', 'opportunity'), ('section_id', '=', active_id)]</field>
<field name="help">Opportunities Analysis gives you an instant access to your opportunities with information such as the expected revenue, planned cost, missed deadlines or the number of interactions per opportunity. This report is mainly used by the sales manager in order to do the periodic review with the teams of the sales pipeline.</field>
</record>
<record model="ir.actions.act_window.view" id="action_report_crm_opportunity_salesteam_tree">
<field name="sequence" eval="1"/>
<field name="view_mode">tree</field>
<field name="view_id" ref="view_report_crm_opportunity_tree"/>
<field name="act_window_id" ref="action_report_crm_opportunity_salesteam"/>
</record>
<record model="ir.actions.act_window.view" id="action_report_crm_opportunity_salesteam_graph">
<field name="sequence" eval="2"/>
<field name="view_mode">graph</field>
<field name="view_id" ref="view_report_crm_opportunity_graph"/>
<field name="act_window_id" ref="action_report_crm_opportunity_salesteam"/>
</record>
<!-- Case Sections Salesteams kanban view -->
<record model="ir.ui.view" id="crm_case_section_salesteams_view_kanban">
@@ -80,6 +124,7 @@
<field name="color"/>
<field name="monthly_open_leads"/>
<field name="monthly_planned_revenue"/>
<field name="currency_symbol"/>
<templates>
<t t-name="kanban-box">
<div t-attf-class="oe_kanban_color_#{kanban_getcolor(record.color.raw_value)} oe_kanban_card oe_kanban_global_click oe_kanban_crm_salesteams">
@@ -99,11 +144,11 @@
<div class="oe_items_list">
<div class="oe_salesteams_leads" t-if="record.use_leads.raw_value">
<a name="%(crm_case_form_view_salesteams_lead)d" type="action">Leads</a>
<a name="%(action_report_crm_lead)d" type="action" class="oe_sparkline_bar_link"><field name="monthly_open_leads" widget="sparkline_bar">Open Leads per Month<br/>Click to see a detailed analysis of leads.</field></a>
<a name="%(action_report_crm_lead_salesteam)d" type="action" class="oe_sparkline_bar_link"><field name="monthly_open_leads" widget="sparkline_bar">Open Leads per Month<br/>Click to see a detailed analysis of leads.</field></a>
</div>
<div class="oe_salesteams_opportunities">
<a name="%(crm_case_form_view_salesteams_opportunity)d" type="action">Opportunities</a>
<a name="%(action_report_crm_opportunity)d" type="action"><field name="monthly_planned_revenue" widget="sparkline_bar">Planned Revenue per Month<br/>Click to see a detailed analysis of opportunities.</field></a>
<a name="%(action_report_crm_opportunity_salesteam)d" type="action"><field name="monthly_planned_revenue" widget="sparkline_bar">Planned Revenue per Month<br/>Click to see a detailed analysis of opportunities.</field></a>
</div>
</div>
</div>
+2 -1
View File
@@ -1,5 +1,6 @@
.openerp .oe_kanban_view .oe_kanban_crm_salesteams {
width: 345px;
cursor: default;
}
.openerp .oe_kanban_view .oe_kanban_crm_salesteams .oe_avatars {
text-align: right;
@@ -61,5 +62,5 @@
.openerp .oe_kanban_view .oe_sparkline_bar {
height: 20px;
width: 36px;
width: 36px !important;
}
+2 -3
View File
@@ -8,7 +8,6 @@ openerp.crm = function(openerp) {
}
},
});
openerp.crm.SparklineBarWidget = openerp.web_kanban.AbstractField.extend({
className: "oe_sparkline_bar",
start: function() {
@@ -20,12 +19,12 @@ openerp.crm = function(openerp) {
self.$el.sparkline(value, {
type: 'bar',
barWidth: 5,
tooltipFormat: '{{offset:offset}} {{value}}',
tooltipFormat: _.str.sprintf("{{offset:offset}}: {{value}} %s",self.$el.closest("div[class='oe_salesteams_leads']").attr('class') ? 'Leads' : self.getParent().record.currency_symbol.raw_value),
tooltipValueLookups: {
'offset': tooltips
},
});
self.$el.tipsy({'delayIn': 0, 'html': true, 'title': function(){return title}, 'gravity': 'n'});
self.$el.tipsy({'delayIn': 3000, 'html': true, 'title': function(){return title}, 'gravity': 'n'});
}, 0);
},
});
+1 -1
View File
@@ -17,7 +17,7 @@
<field name="model">sale.report</field>
<field name="inherit_id" ref="sale.view_order_product_search"/>
<field name="arch" type="xml">
<filter string="My Sales" position="after">
<filter name="Sales" position="after">
<separator/>
<field name="section_id" groups="base.group_multi_salesteams"/>
</filter>
+4 -4
View File
@@ -217,7 +217,7 @@
<field name="view_type">form</field>
<field name="view_mode">tree,graph</field>
<field name="domain">[('state','=','draft'),('section_id', '=', active_id)]</field>
<field name="context">{'search_default_order_month':1,'search_default_User':1}</field>
<field name="context">{'search_default_order_month':1}</field>
<field name="help">This report performs analysis on your quotations. Analysis check your sales revenues and sort it by different group criteria (salesman, partner, product, etc.) Use this report to perform analysis on sales not having invoiced yet. If you want to analyse your turnover, you should use the Invoice Analysis report in the Accounting application.</field>
</record>
@@ -227,7 +227,7 @@
<field name="view_type">form</field>
<field name="view_mode">tree,graph</field>
<field name="domain">[('state','not in',('draft','done','cancel')),('section_id', '=', active_id)]</field>
<field name="context">{'search_default_order_month':1,'search_default_User':1}</field>
<field name="context">{'search_default_order_month':1}</field>
<field name="help">This report performs analysis on your sales orders. Analysis check your sales revenues and sort it by different group criteria (salesman, partner, product, etc.) Use this report to perform analysis on sales not having invoiced yet. If you want to analyse your turnover, you should use the Invoice Analysis report in the Accounting application.</field>
</record>
@@ -237,7 +237,7 @@
<field name="view_type">form</field>
<field name="view_mode">tree,graph</field>
<field name="domain">[('section_id', '=', active_id)]</field>
<field name="context">{'search_default_month':1, 'search_default_user':1}</field>
<field name="context">{'search_default_month':1}</field>
<field name="help">From this report, you can have an overview of the amount invoiced to your customer. The tool search can also be used to personalise your Invoices reports and so, match this analysis to your needs.</field>
</record>
@@ -299,7 +299,7 @@
<xpath expr="//div[@class='oe_items_list']" position="after">
<div class="oe_center" t-if="record.invoiced_target.raw_value">
<field name="monthly_invoiced" widget="gage" style="width:160px; height: 120px;" options="{'max_field': 'invoiced_target'}">Invoiced</field>
<field name="invoiced_forecast" widget="gage" style="width:160px; height: 120px;" options="{'max_field': 'invoiced_target', 'action_change': 'action_forecast'}">Forecast</field>
<field name="invoiced_forecast" widget="gage" style="width:160px; height: 120px; cursor: pointer;" options="{'max_field': 'invoiced_target', 'action_change': 'action_forecast'}">Forecast</field>
</div>
<div class="oe_center" style="color:#bbbbbb;" t-if="!record.invoiced_target.raw_value">
<br/>Define an invoicing target in the sales team settings to see the period's achievement and forecast at a glance.