From 7f5f945dcfc81e39d36eac06009bee109721c471 Mon Sep 17 00:00:00 2001 From: Goffin Simon Date: Thu, 23 Jul 2015 10:09:04 +0200 Subject: [PATCH] [FIX] sale: _sales_count The field "state" in "sale.report" model must consider the state used by "sale.order.line" to be consistent with the view created in this model. The function _sale_count in 'product.product' model must return the number of product included in a "confirmed" or "done" sale order line. opw:644200 --- addons/sale/report/sale_report.py | 14 +++++--------- addons/sale/report/sale_report_view.xml | 6 +++--- addons/sale/sale.py | 4 ++-- addons/sale/sale_view.xml | 2 +- 4 files changed, 11 insertions(+), 15 deletions(-) diff --git a/addons/sale/report/sale_report.py b/addons/sale/report/sale_report.py index 25976eaaacf..63b0ed7766c 100644 --- a/addons/sale/report/sale_report.py +++ b/addons/sale/report/sale_report.py @@ -43,15 +43,11 @@ class sale_report(osv.osv): 'categ_id': fields.many2one('product.category','Category of Product', readonly=True), 'nbr': fields.integer('# of Lines', readonly=True), # TDE FIXME master: rename into nbr_lines 'state': fields.selection([ - ('draft', 'Quotation'), - ('sent', 'Quotation Sent'), - ('waiting_date', 'Waiting Schedule'), - ('manual', 'Manual In Progress'), - ('progress', 'In Progress'), - ('invoice_except', 'Invoice Exception'), - ('done', 'Done'), - ('cancel', 'Cancelled') - ], 'Order Status', readonly=True), + ('cancel', 'Cancelled'), + ('draft', 'Draft'), + ('confirmed', 'Confirmed'), + ('exception', 'Exception'), + ('done', 'Done')], 'Order Status', readonly=True), 'pricelist_id': fields.many2one('product.pricelist', 'Pricelist', readonly=True), 'analytic_account_id': fields.many2one('account.analytic.account', 'Analytic Account', readonly=True), 'section_id': fields.many2one('crm.case.section', 'Sales Team'), diff --git a/addons/sale/report/sale_report_view.xml b/addons/sale/report/sale_report_view.xml index a9d6b6067a4..a7028e68879 100644 --- a/addons/sale/report/sale_report_view.xml +++ b/addons/sale/report/sale_report_view.xml @@ -18,7 +18,7 @@ Sales Funnel sale.report - ['&', ('date','<=', time.strftime('%%Y-12-31')), '&', ('date','>=',time.strftime('%%Y-01-01')), '|', ('state','in',('draft','sent')), ('state','not in',('draft','sent','cancel'))] + ['&', ('date','<=', time.strftime('%%Y-12-31')), '&', ('date','>=',time.strftime('%%Y-01-01')), ('state','not in',('cancel',))] {'group_by': ['state'], 'measures': ['price_total']} @@ -49,8 +49,8 @@ - - + + diff --git a/addons/sale/sale.py b/addons/sale/sale.py index 459356a761a..69448d945ab 100644 --- a/addons/sale/sale.py +++ b/addons/sale/sale.py @@ -1312,10 +1312,10 @@ class product_product(osv.Model): def _sales_count(self, cr, uid, ids, field_name, arg, context=None): r = dict.fromkeys(ids, 0) domain = [ - ('state', 'in', ['waiting_date','progress','manual', 'shipping_except', 'invoice_except', 'done']), + ('state', 'in', ['confirmed', 'done']), ('product_id', 'in', ids), ] - for group in self.pool['sale.report'].read_group(cr, uid, domain, ['product_id','product_uom_qty'], ['product_id'], context=context): + for group in self.pool['sale.report'].read_group(cr, uid, domain, ['product_id', 'product_uom_qty'], ['product_id'], context=context): r[group['product_id'][0]] = group['product_uom_qty'] return r diff --git a/addons/sale/sale_view.xml b/addons/sale/sale_view.xml index 8ffd75b8e06..7a0925e990a 100644 --- a/addons/sale/sale_view.xml +++ b/addons/sale/sale_view.xml @@ -686,7 +686,7 @@ Sales Analysis sale.report graph - [('state','not in',('draft','sent','cancel')),('section_id', '=', active_id)] + [('state','not in',('draft','cancel')),('section_id', '=', active_id)] {'search_default_order_month':1} 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.