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:
@@ -1,23 +1,3 @@
|
||||
# -*- encoding: utf-8 -*-
|
||||
##############################################################################
|
||||
#
|
||||
# POS Sale Report module for Odoo
|
||||
# Copyright (C) 2015 Akretion (http://www.akretion.com)
|
||||
# @author Alexis de Lattre <alexis.delattre@akretion.com>
|
||||
#
|
||||
# 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/>.
|
||||
#
|
||||
##############################################################################
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
from . import report
|
||||
|
||||
@@ -10,7 +10,8 @@
|
||||
res_model="pos.sale.report"
|
||||
src_model="product.product"
|
||||
view_mode="graph"
|
||||
context="{'search_default_product_id': active_id}"
|
||||
domain="[('product_id', 'in', active_ids)]"
|
||||
context="{'search_default_product_groupby': 1}"
|
||||
/>
|
||||
|
||||
<act_window id="product_template_pos_sale_report_action"
|
||||
@@ -19,7 +20,8 @@
|
||||
res_model="pos.sale.report"
|
||||
src_model="product.template"
|
||||
view_mode="graph"
|
||||
context="{'search_default_product_tmpl_id': active_id}"
|
||||
domain="[('product_tmpl_id', 'in', active_ids)]"
|
||||
context="{'search_default_product_tmpl_groupby': 1}"
|
||||
/>
|
||||
|
||||
|
||||
|
||||
@@ -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,
|
||||
|
||||
@@ -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'}"/>
|
||||
|
||||
Reference in New Issue
Block a user