[FIX] stock: picking of move line

- Activate Lots and S/N
- Track a product A by unique S/N
- Receive one unit of A
- Sell the unit of A through the POS
- Go to Inventory > Products > Lots/Serial Numbers, and open the
  Upstream Traceability report

The line corresponding to the outgoing move line is not linked to the
corresponding picking.

The field `picking_id` is empty on the `stock.move.line`, so the link is
not directly retrieved.

Even if the POS should set the `picking_id` field, the traceability
report should fallback on the picking of the move.

opw-1939413

closes odoo/odoo#31879

Signed-off-by: Nicolas Martinelli (nim) <nim@odoo.com>
This commit is contained in:
Nicolas Martinelli
2019-03-15 13:03:36 +00:00
parent 6b4a35facd
commit e7c92352be
+4 -3
View File
@@ -138,10 +138,11 @@ class MrpStockReport(models.TransientModel):
res_model = ''
ref = ''
res_id = False
if move_line.picking_id:
picking_id = move_line.picking_id or move_line.move_id.picking_id
if picking_id:
res_model = 'stock.picking'
res_id = move_line.picking_id.id
ref = move_line.picking_id.name
res_id = picking_id.id
ref = picking_id.name
elif move_line.move_id.inventory_id:
res_model = 'stock.inventory'
res_id = move_line.move_id.inventory_id.id