diff --git a/shipment.py b/shipment.py index 9c93a47..6dcd312 100644 --- a/shipment.py +++ b/shipment.py @@ -289,6 +289,7 @@ class ShipmentDetailedReport(Report): shipments = ModelShipment.search(dom_shipment, order=[('effective_date', 'ASC')] ) + _records = [] for s in shipments: for m in s.moves: @@ -298,6 +299,7 @@ class ShipmentDetailedReport(Report): 'shipment': s } _records.append(value) + report_context['records'] = _records report_context['Decimal'] = Decimal report_context['data'] = data diff --git a/stock.py b/stock.py index ee288a9..7b385b3 100644 --- a/stock.py +++ b/stock.py @@ -624,6 +624,19 @@ class WarehouseStockDetailedReport(Report): } # dom_products.append(('account_category', '=', data['category'])) + cursor = Transaction().connection.cursor() + query = "select distinct on(p.id) p.id, t.name, p.code, s.effective_date from product_product as p right join stock_move as s on p.id=s.product join product_template as t on p.template=t.id where s.shipment ilike 'stock.shipment.in,%' and state='done' order by p.id, s.effective_date DESC"; + cursor.execute(query) + columns = list(cursor.description) + result = cursor.fetchall() + history_purchase = {} + + for row in result: + row_dict = {} + for i, col in enumerate(columns): + row_dict[col.name] = row[i] + history_purchase[row[0]] = row_dict + values = [] for l in locations: stock_context['locations'] = [l.id] @@ -635,9 +648,11 @@ class WarehouseStockDetailedReport(Report): 'name': l.name, 'product': p, }) + products = values report_context['records'] = products report_context['Decimal'] = Decimal + report_context['history_purchase'] = history_purchase report_context['stock_date_end'] = data['to_date'] report_context['company'] = Company(data['company']) return report_context diff --git a/view/warehouse_stock_detailed_view_form.xml b/view/warehouse_stock_detailed_view_form.xml index 0cd1484..a088453 100644 --- a/view/warehouse_stock_detailed_view_form.xml +++ b/view/warehouse_stock_detailed_view_form.xml @@ -7,5 +7,4 @@ this repository contains the full copyright notices and license terms. -->