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
8 changes: 4 additions & 4 deletions stock_declared_value/models/stock_picking.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
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": "19.0.1.3.0",
"version": "19.0.1.3.1",
"category": "Warehouse Management",
"sequence": 14,
"summary": "",
Expand Down
18 changes: 12 additions & 6 deletions stock_ux/models/stock_move_line.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Loading