[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
This commit is contained in:
parent
21f2e7b467
commit
7f5f945dcf
|
@ -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'),
|
||||
|
|
|
@ -18,7 +18,7 @@
|
|||
<record id="filter_sale_report_sales_funnel" model="ir.filters">
|
||||
<field name="name">Sales Funnel</field>
|
||||
<field name="model_id">sale.report</field>
|
||||
<field name="domain">['&', ('date','<=', time.strftime('%%Y-12-31')), '&', ('date','>=',time.strftime('%%Y-01-01')), '|', ('state','in',('draft','sent')), ('state','not in',('draft','sent','cancel'))]</field>
|
||||
<field name="domain">['&', ('date','<=', time.strftime('%%Y-12-31')), '&', ('date','>=',time.strftime('%%Y-01-01')), ('state','not in',('cancel',))]</field>
|
||||
<field name="user_id" eval="False"/>
|
||||
<field name="context">{'group_by': ['state'], 'measures': ['price_total']}</field>
|
||||
</record>
|
||||
|
@ -49,8 +49,8 @@
|
|||
<field name="date"/>
|
||||
<field name="date_confirm"/>
|
||||
<filter string="This Year" name="year" invisible="1" domain="[('date','<=', time.strftime('%%Y-12-31')),('date','>=',time.strftime('%%Y-01-01'))]"/>
|
||||
<filter name="Quotations" domain="[('state','in',('draft','sent'))]"/>
|
||||
<filter name="Sales" string="Sales" domain="[('state','not in',('draft','sent','cancel'))]"/>
|
||||
<filter name="Quotations" domain="[('state','in',('draft'))]"/>
|
||||
<filter name="Sales" string="Sales" domain="[('state','not in',('draft', 'cancel'))]"/>
|
||||
<separator/>
|
||||
<filter string="My Sales" help="My Sales" domain="[('user_id','=',uid)]"/>
|
||||
<field name="partner_id"/>
|
||||
|
|
|
@ -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
|
||||
|
||||
|
|
|
@ -686,7 +686,7 @@
|
|||
<field name="name">Sales Analysis</field>
|
||||
<field name="res_model">sale.report</field>
|
||||
<field name="view_mode">graph</field>
|
||||
<field name="domain">[('state','not in',('draft','sent','cancel')),('section_id', '=', active_id)]</field>
|
||||
<field name="domain">[('state','not in',('draft','cancel')),('section_id', '=', active_id)]</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>
|
||||
|
|
Loading…
Reference in New Issue