Improvement WarehouseStockDetailedReport

This commit is contained in:
Oscar 2021-09-23 08:15:13 -05:00
parent 53c33c2726
commit ceeedd03b8
8 changed files with 47 additions and 6 deletions

View File

@ -0,0 +1 @@
,psk,Tech,23.09.2021 08:13,file:///home/psk/.config/libreoffice/4;

View File

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

View File

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

View File

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

View File

@ -4,6 +4,7 @@ depends:
product
stock
stock_supply
stock_lot
xml:
product.xml
stock.xml

10
view/stock_lot_form.xml Normal file
View File

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

8
view/stock_lot_tree.xml Normal file
View File

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