diff --git a/stock_declared_value/models/stock_picking.py b/stock_declared_value/models/stock_picking.py index 889d8a8eb..2969cdf97 100644 --- a/stock_declared_value/models/stock_picking.py +++ b/stock_declared_value/models/stock_picking.py @@ -43,18 +43,18 @@ def _compute_declared_value(self): so_qty_done = move_line.quantity # convert quantities if move line uom and sale line uom # are different - if move_line.product_uom != order_line.product_uom_id: - so_product_qty = move_line.product_uom._compute_quantity( + if move_line.product_uom_id != order_line.product_uom_id: + so_product_qty = move_line.product_uom_id._compute_quantity( move_line.product_uom_qty, order_line.product_uom_id ) - so_qty_done = move_line.product_uom._compute_quantity( + so_qty_done = move_line.product_uom_id._compute_quantity( move_line.quantity, order_line.product_uom_id ) picking_value += order_line.price_reduce_taxexcl * so_product_qty done_value += order_line.price_reduce_taxexcl * so_qty_done elif rec.picking_type_id.pricelist_id: pricelist = rec.picking_type_id.pricelist_id - price = rec.picking_type_id.pricelist_id.with_context(uom=move_line.product_uom.id)._price_get( + price = rec.picking_type_id.pricelist_id.with_context(uom=move_line.product_uom_id.id)._price_get( move_line.product_id, move_line.quantity or 1.0, partner=rec.partner_id.id )[rec.picking_type_id.pricelist_id.id] picking_value += price * move_line.product_uom_qty diff --git a/stock_ux/__manifest__.py b/stock_ux/__manifest__.py index 3f70c02c4..61f12ed20 100644 --- a/stock_ux/__manifest__.py +++ b/stock_ux/__manifest__.py @@ -19,7 +19,7 @@ ############################################################################## { "name": "Stock UX", - "version": "19.0.1.3.0", + "version": "19.0.1.3.1", "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 29831b404..a9c54fe47 100644 --- a/stock_ux/models/stock_move_line.py +++ b/stock_ux/models/stock_move_line.py @@ -36,12 +36,18 @@ def _compute_product_uom_qty_location(self): if not location: self.update({"product_uom_qty_location": 0.0}) return False - # because now we use location_id to select location, we have compelte - # location name. If y need we can use some code of - # _get_domain_locations on stock/product.py - location_name = location[0] - if isinstance(location[0], int): - location_name = self.env["stock.location"].browse(location[0]).reference + # `location` puede venir como int (ID único), list/tuple de ints, o string. + # En v19 algunas vistas lo pasan como int directo → location[0] explota. + if isinstance(location, int): + location_name = self.env["stock.location"].browse(location).complete_name + elif isinstance(location, (list, tuple)): + first = location[0] + location_name = ( + self.env["stock.location"].browse(first).complete_name + if isinstance(first, int) else first + ) + else: + location_name = location # string locations = self.env["stock.location"].search([("complete_name", "ilike", location_name)]) for rec in self: product_uom_qty_location = rec.quantity