Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion stock_ux/__manifest__.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
##############################################################################
{
"name": "Stock UX",
"version": "18.0.1.1.0",
"version": "18.0.1.2.0",
"category": "Warehouse Management",
"sequence": 14,
"summary": "",
Expand Down
22 changes: 22 additions & 0 deletions stock_ux/models/stock_move_line.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@

class StockMoveLine(models.Model):
_inherit = "stock.move.line"
_order = "id"
# La unica funcionalidad de este modulo es cambiar el ordenamiento del las vistas embebidas de stock.move

picking_create_user_id = fields.Many2one(
"res.users",
Expand All @@ -26,6 +28,14 @@ class StockMoveLine(models.Model):
compute="_compute_product_uom_qty_location",
string="Net Quantity",
)

product_uom_qty_location_stored = fields.Float(
compute="_compute_product_uom_qty_location_stored",
string="Cantidad neta",
store=True,
help="Net quantity for grouping/filtering, computed without context.",
)

name = fields.Char(
related="move_id.name",
related_sudo=False,
Expand All @@ -34,6 +44,18 @@ class StockMoveLine(models.Model):
related="move_id.origin_description",
)

@api.depends("location_id", "location_dest_id", "quantity")
def _compute_product_uom_qty_location_stored(self):
for rec in self:
# Ajusta la lógica según tu necesidad de agrupación
if rec.location_id and rec.location_dest_id:
if rec.location_id == rec.location_dest_id:
rec.product_uom_qty_location_stored = 0.0
else:
rec.product_uom_qty_location_stored = -rec.quantity
else:
rec.product_uom_qty_location_stored = 0.0

@api.depends_context("location")
def _compute_product_uom_qty_location(self):
location = self._context.get("location")
Expand Down
3 changes: 2 additions & 1 deletion stock_ux/views/stock_move_line_views.xml
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,8 @@
<field name="inherit_id" ref="stock.view_move_line_tree"/>
<field name="arch" type="xml">
<field name="location_dest_id" position="after">
<field name="product_uom_qty_location" sum="Total"/>
<field name="product_uom_qty_location" column_invisible="True"/>
<field name="product_uom_qty_location_stored" sum="Total nuevo"/>
<!-- on enterprise view is not refres -->
<!-- <field name="product_uom_qty_location" sum="Total" invisible="not context.get('location', False)"/> -->
</field>
Expand Down
Loading