minor fix report

This commit is contained in:
wilson gomez 2021-08-30 15:39:59 -05:00
parent 7fe88ad1f3
commit 34765fc0da
4 changed files with 17 additions and 1 deletions

View File

@ -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

View File

@ -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

View File

@ -7,5 +7,4 @@ this repository contains the full copyright notices and license terms. -->
<label name="to_date"/>
<field name="to_date"/>
<field name="locations" colspan="4"/>
<field name="location_storage" invisible="1"/>
</form>

Binary file not shown.