[FIX] stock_landed_costs: skip cancel move

- Create a product A, FIFO and Automated
- Create a PO for 50 units
- Receive 45 units, no backorder
- Create a landed cost for the picking

The landed cost is split between the two move lines (45 units and 5
units).

This occurs since in v13, there is no canceled picking created for the
backorder, but a canceled stock move.

We filter out canceled moves.

opw-2179145

closes odoo/odoo#44095

X-original-commit: 120a2d116e4820fa9a4529e8ef01569823d02d13
Signed-off-by: Nicolas Martinelli (nim) <nim@odoo.com>
This commit is contained in:
Nicolas Martinelli
2020-01-28 12:15:02 +00:00
parent a74a648030
commit f06397b2e6
@@ -201,7 +201,7 @@ class LandedCost(models.Model):
for move in self.mapped('picking_ids').mapped('move_lines'):
# it doesn't make sense to make a landed cost for a product that isn't set as being valuated in real time at real cost
if move.product_id.valuation != 'real_time' or move.product_id.cost_method not in ('fifo', 'average'):
if move.product_id.valuation != 'real_time' or move.product_id.cost_method not in ('fifo', 'average') or move.state == 'cancel':
continue
vals = {
'product_id': move.product_id.id,