Improvement WarehouseStockDetailedReport
This commit is contained in:
parent
53c33c2726
commit
ceeedd03b8
|
@ -0,0 +1 @@
|
|||
,psk,Tech,23.09.2021 08:13,file:///home/psk/.config/libreoffice/4;
|
|
@ -12,14 +12,14 @@ def register():
|
|||
product.Product,
|
||||
stock.Move,
|
||||
stock.MoveByProductStart,
|
||||
stock.Lot,
|
||||
stock.WarehouseStockStart,
|
||||
stock.WarehouseStockDetailedStart,
|
||||
stock.PrintProductsStart,
|
||||
shipment.CreateInternalShipmentStart,
|
||||
shipment.InternalShipment,
|
||||
shipment.ShipmentIn,
|
||||
stock.WarehouseStockStart,
|
||||
# stock.Inventory,
|
||||
stock.WarehouseStockDetailedStart,
|
||||
shipment.ShipmentDetailedStart,
|
||||
stock.PrintProductsStart,
|
||||
module='stock_co', type_='model')
|
||||
Pool.register(
|
||||
shipment.ShipmentDetailed,
|
||||
|
|
14
stock.py
14
stock.py
|
@ -17,6 +17,15 @@ STATES_MOVE = {
|
|||
}
|
||||
|
||||
|
||||
class Lot(metaclass=PoolMeta):
|
||||
__name__ = 'stock.lot'
|
||||
active = fields.Boolean('Active')
|
||||
|
||||
@staticmethod
|
||||
def default_active():
|
||||
return True
|
||||
|
||||
|
||||
class Move(metaclass=PoolMeta):
|
||||
__name__ = 'stock.move'
|
||||
description = fields.Char('Description', select=True, states=STATES_MOVE)
|
||||
|
@ -575,7 +584,7 @@ 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";
|
||||
query = "select distinct on(p.id) p.id, t.name, p.code, t.reference, 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()
|
||||
|
@ -588,12 +597,13 @@ class WarehouseStockDetailedReport(Report):
|
|||
history_purchase[row[0]] = row_dict
|
||||
|
||||
values = []
|
||||
add_ = values.append
|
||||
for l in locations:
|
||||
stock_context['locations'] = [l.id]
|
||||
with Transaction().set_context(stock_context):
|
||||
prdts = Product.search(dom_products, order=[('code', 'ASC')])
|
||||
for p in prdts:
|
||||
values.append({
|
||||
add_({
|
||||
'parent_name': l.parent.name if l.parent else '',
|
||||
'name': l.name,
|
||||
'product': p,
|
||||
|
|
11
stock.xml
11
stock.xml
|
@ -4,6 +4,17 @@ this repository contains the full copyright notices and license terms. -->
|
|||
<tryton>
|
||||
<data>
|
||||
|
||||
<record model="ir.ui.view" id="lot_view_form">
|
||||
<field name="model">stock.lot</field>
|
||||
<field name="inherit" ref="stock_lot.lot_view_form"/>
|
||||
<field name="name">stock_lot_form</field>
|
||||
</record>
|
||||
<!-- <record model="ir.ui.view" id="lot_view_tree">
|
||||
<field name="model">stock.lot</field>
|
||||
<field name="inherit" ref="stock_lot.lot_view_tree"/>
|
||||
<field name="name">stock_lot_tree</field>
|
||||
</record> -->
|
||||
|
||||
<record model="ir.ui.view" id="move_view_form">
|
||||
<field name="model">stock.move</field>
|
||||
<field name="inherit" ref="stock.move_view_form"/>
|
||||
|
|
|
@ -4,6 +4,7 @@ depends:
|
|||
product
|
||||
stock
|
||||
stock_supply
|
||||
stock_lot
|
||||
xml:
|
||||
product.xml
|
||||
stock.xml
|
||||
|
|
|
@ -0,0 +1,10 @@
|
|||
<?xml version="1.0"?>
|
||||
<!-- This file is part of Tryton. The COPYRIGHT file at the top level of
|
||||
this repository contains the full copyright notices and license terms. -->
|
||||
<data>
|
||||
<xpath
|
||||
expr="/form/field[@name='number']" position="after">
|
||||
<label name="active"/>
|
||||
<field name="active"/>
|
||||
</xpath>
|
||||
</data>
|
|
@ -0,0 +1,8 @@
|
|||
<?xml version="1.0"?>
|
||||
<!-- This file is part of Tryton. The COPYRIGHT file at the top level of
|
||||
this repository contains the full copyright notices and license terms. -->
|
||||
<data>
|
||||
<xpath expr="/tree/field[@name='number']" position="after">
|
||||
<field name="active"/>
|
||||
</xpath>
|
||||
</data>
|
Binary file not shown.
Loading…
Reference in New Issue