From 8b3332876b9f845eba0857728a94dd6ce66601b4 Mon Sep 17 00:00:00 2001 From: Juan Ignacio Carreras Date: Mon, 9 Jun 2025 19:31:43 +0000 Subject: [PATCH] [ADD]reorder move lines in embebid tree --- stock_ux/__manifest__.py | 2 +- stock_ux/models/stock_move_line.py | 22 ++++++++++++++++++++++ stock_ux/views/stock_move_line_views.xml | 3 ++- 3 files changed, 25 insertions(+), 2 deletions(-) diff --git a/stock_ux/__manifest__.py b/stock_ux/__manifest__.py index 3076bcdd8..64677f1b7 100644 --- a/stock_ux/__manifest__.py +++ b/stock_ux/__manifest__.py @@ -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": "", diff --git a/stock_ux/models/stock_move_line.py b/stock_ux/models/stock_move_line.py index 7d4e3cebe..f18eb1f46 100644 --- a/stock_ux/models/stock_move_line.py +++ b/stock_ux/models/stock_move_line.py @@ -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", @@ -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, @@ -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") diff --git a/stock_ux/views/stock_move_line_views.xml b/stock_ux/views/stock_move_line_views.xml index 33c72c249..381316cc7 100644 --- a/stock_ux/views/stock_move_line_views.xml +++ b/stock_ux/views/stock_move_line_views.xml @@ -49,7 +49,8 @@ - + +