[CLEAN] sale_crm: cleaning before merging

- sales report: the group by salesteam was wrongly placed in the view
- sale_crm: fixed computation for sparklines, now bar graph should display the same
result as the sales analysis
- added a forgottent cursor: pointer for a gauge
- moved the gauges in the dom
- sale_crm: report: removed extra content not necessary

bzr revid: tde@openerp.com-20131205144505-jfsd8lh91r1b13a1
This commit is contained in:
Thibault Delavallée 2013-12-05 15:45:05 +01:00
parent ea62cbacf8
commit d181c63d07
4 changed files with 13 additions and 30 deletions

View File

@ -1,26 +1,7 @@
# -*- coding: utf-8 -*-
##############################################################################
#
# OpenERP, Open Source Management Solution
# Copyright (C) 2004-2010 Tiny SPRL (<http://tiny.be>).
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as
# published by the Free Software Foundation, either version 3 of the
# License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU Affero General Public License for more details.
#
# You should have received a copy of the GNU Affero General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#
##############################################################################
from openerp.osv import fields, osv
from openerp import tools
class sale_report(osv.osv):
_inherit = "sale.report"
@ -29,7 +10,7 @@ class sale_report(osv.osv):
}
def _select(self):
return super(sale_report, self)._select() + ", s.section_id as section_id"
return super(sale_report, self)._select() + ", s.section_id as section_id"
def _group_by(self):
return super(sale_report, self)._group_by() + ", s.section_id"

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 name="Sales" position="after">
<filter name="User" position="after">
<separator/>
<filter string="Sales Team" context="{'group_by':'section_id'}"/>
</filter>

View File

@ -53,10 +53,10 @@ class crm_case_section(osv.osv):
date_end = month_begin.replace(day=calendar.monthrange(month_begin.year, month_begin.month)[1]).strftime(tools.DEFAULT_SERVER_DATE_FORMAT)
for id in ids:
res[id] = dict()
created_domain = [('section_id', '=', id), ('state', 'in', ['draft', 'sent']), ('date_order', '>=', date_begin), ('date_order', '<=', date_end)]
created_domain = [('section_id', '=', id), ('state', '=', ['draft']), ('date_order', '>=', date_begin), ('date_order', '<=', date_end)]
res[id]['monthly_quoted'] = self.__get_bar_values(cr, uid, obj, created_domain, ['amount_total', 'date_order'], 'amount_total', 'date_order', context=context)
validated_domain = [('section_id', '=', id), ('state', 'not in', ['draft', 'sent']), ('date_confirm', '>=', date_begin), ('date_order', '<=', date_end)]
res[id]['monthly_confirmed'] = self.__get_bar_values(cr, uid, obj, validated_domain, ['amount_total', 'date_confirm'], 'amount_total', 'date_confirm', context=context)
validated_domain = [('section_id', '=', id), ('state', 'not in', ['draft', 'sent', 'cancel']), ('date_order', '>=', date_begin), ('date_order', '<=', date_end)]
res[id]['monthly_confirmed'] = self.__get_bar_values(cr, uid, obj, validated_domain, ['amount_total', 'date_order'], 'amount_total', 'date_order', context=context)
return res
def _get_invoices_data(self, cr, uid, ids, field_name, arg, context=None):

View File

@ -296,10 +296,12 @@
</a>
</div>
</xpath>
<xpath expr="//div[@class='oe_kanban_salesteams_avatars']" position="replace">
<div class="oe_center oe_salesteams_justgage" t-if="record.invoiced_target.raw_value">
<field name="monthly_invoiced" widget="gauge" style="width:160px; height: 120px;" options="{'max_field': 'invoiced_target'}">Invoiced</field>
<field name="invoiced_forecast" widget="gauge" style="width:160px; height: 120px; cursor: pointer;" options="{'max_field': 'invoiced_target', 'action_change': 'action_forecast'}">Forecast</field>
<xpath expr="//div[@class='oe_clear']" position="after">
<div class="oe_center" t-if="record.invoiced_target.raw_value">
<field name="monthly_invoiced" widget="gauge" style="width:160px; height: 120px; cursor: pointer;"
options="{'max_field': 'invoiced_target'}">Invoiced</field>
<field name="invoiced_forecast" widget="gauge" style="width:160px; height: 120px; cursor: pointer;"
options="{'max_field': 'invoiced_target', 'action_change': 'action_forecast'}">Forecast</field>
</div>
<div class="oe_center oe_salesteams_help" 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.