diff --git a/addons/stock/report/report_stock.py b/addons/stock/report/report_stock.py
index 0aac0d6599b..258a2e4d28f 100644
--- a/addons/stock/report/report_stock.py
+++ b/addons/stock/report/report_stock.py
@@ -137,13 +137,15 @@ stock_report_tracklots()
class report_stock_lines_date(osv.osv):
_name = "report.stock.lines.date"
- _description = "Dates of Inventories"
+ _description = "Dates of Inventories and latest Moves"
_auto = False
_order = "date"
_columns = {
- 'id': fields.integer('Inventory Line Id', readonly=True),
+ 'id': fields.integer('Product Id', readonly=True),
'product_id': fields.many2one('product.product', 'Product', readonly=True, select=True),
- 'date': fields.datetime('Latest Inventory Date'),
+ 'date': fields.datetime('Date of latest Inventory', readonly=True),
+ 'move_date': fields.datetime('Date of latest Stock Move', readonly=True),
+ "active" : fields.boolean("Active", readonly=True),
}
def init(self, cr):
drop_view_if_exists(cr, 'report_stock_lines_date')
@@ -152,13 +154,16 @@ class report_stock_lines_date(osv.osv):
select
p.id as id,
p.id as product_id,
- max(s.date) as date
+ max(s.date) as date,
+ max(m.date) as move_date,
+ p.active as active
from
product_product p
- left outer join stock_inventory_line l on (p.id=l.product_id)
- left join stock_inventory s on (l.inventory_id=s.id)
- and s.state = 'done'
- where p.active='true'
+ left join (
+ stock_inventory_line l
+ inner join stock_inventory s on (l.inventory_id=s.id and s.state = 'done')
+ ) on (p.id=l.product_id)
+ left join stock_move m on (m.product_id=p.id and m.state = 'done')
group by p.id
)""")
diff --git a/addons/stock/report/report_stock_view.xml b/addons/stock/report/report_stock_view.xml
index f56d738636d..267b114b585 100644
--- a/addons/stock/report/report_stock_view.xml
+++ b/addons/stock/report/report_stock_view.xml
@@ -23,6 +23,7 @@
+
@@ -31,12 +32,13 @@
report.stock.lines.date.search
report.stock.lines.date
-
+
-
+
+
@@ -46,22 +48,23 @@
report.stock.lines.date.form
report.stock.lines.date
-
- Last Product Inventories
+ Latest Inventories & Moves
report.stock.lines.date
form
{'search_default_stockable':1}
tree,form
- Display the last inventories done on your products and easily sort them with specific filtering criteria. If you do frequent and partial inventories, you need this report in order to ensure that the stock of each product is controlled at least once a year.
+ Display the latest Inventories and Moves done on your products and easily sort them with specific filtering criteria. If you do frequent and partial inventories, you need this report in order to ensure that the stock of each product is controlled at least once a year. This also lets you find out which products have seen little move lately and may deserve special measures (discounted sale, quality control...)