pos_sale_report: Now works well when you select multiple products in product tree view

Add Today and Yesterday filter, for easy analysis of recent sales
This commit is contained in:
Alexis de Lattre
2015-10-30 23:17:37 +01:00
parent 27fc5070ec
commit da2c22329c
4 changed files with 12 additions and 26 deletions

View File

@@ -31,7 +31,7 @@ class pos_sale_report(models.Model):
_rec_name = 'date'
_order = 'date desc'
date = fields.Datetime(string='Order Date', readonly=True)
date = fields.Date(string='Order Date', readonly=True)
product_id = fields.Many2one(
'product.product', string='Product Variant', readonly=True)
product_tmpl_id = fields.Many2one(
@@ -44,7 +44,7 @@ class pos_sale_report(models.Model):
# WARNING : this code doesn't handle uom conversion for the moment
def _sale_order_select(self):
select = """SELECT min(sol.id)*-1 AS id,
so.date_order AS date,
so.date_order::date AS date,
sol.product_id AS product_id,
pp.product_tmpl_id AS product_tmpl_id,
so.company_id AS company_id,
@@ -61,7 +61,7 @@ class pos_sale_report(models.Model):
def _pos_order_select(self):
select = """SELECT min(pol.id) AS id,
po.date_order AS date,
po.date_order::date AS date,
pol.product_id AS product_id,
pp.product_tmpl_id AS product_tmpl_id,
po.company_id AS company_id,

View File

@@ -10,6 +10,10 @@
<search string="POS orders and Sale orders aggregated report">
<field name="product_tmpl_id"/>
<field name="product_id"/>
<filter name="today" string="Today"
domain="[('date', '=', context_today().strftime('%Y-%m-%d'))]"/>
<filter name="yesterday" string="Yesterday"
domain="[('date', '=', (context_today() + datetime.timedelta(days=-1)).strftime('%Y-%m-%d'))]"/>
<group string="Group By" name="groupby">
<filter name="date_groupby" string="Date" context="{'group_by': 'date'}"/>
<filter name="product_tmpl_groupby" string="Product" context="{'group_by': 'product_tmpl_id'}"/>