[FIX] stock: force group by date when ordered by date
When displaying forecasted inventory if there is no default order, the default order forced on date and id. In that case, if the date is not in the "group by", it causes warning. With this commit, the date is forced in the SQL view. closes odoo/odoo#32633 Signed-off-by: Raphael Collet (rco) <rco@openerp.com>
This commit is contained in:
@@ -129,6 +129,8 @@ class ReportStockForecat(models.Model):
|
||||
WHERE
|
||||
final.product_qty != 0 OR final.reference = 'Starting Inventory'
|
||||
%s
|
||||
ORDER BY
|
||||
date
|
||||
)
|
||||
""" % (self._select(), self._left_join(), self._groupby())
|
||||
self.env.cr.execute(query)
|
||||
@@ -185,7 +187,6 @@ class ReportStockForecat(models.Model):
|
||||
order to analyze different quantities in different situations.
|
||||
"""
|
||||
# Sort result by date_expected and id.
|
||||
orderby = 'date, id' if not orderby else orderby
|
||||
if 'cumulative_quantity' in fields and 'quantity' not in fields:
|
||||
fields.append('quantity')
|
||||
res = super(ReportStockForecat, self).read_group(domain, fields, groupby, offset=offset, limit=limit, orderby=orderby, lazy=lazy)
|
||||
|
||||
Reference in New Issue
Block a user