From b2e6784c699cace9904c2d5419f57e0ee0dfeb01 Mon Sep 17 00:00:00 2001 From: "Loan (lse)" Date: Mon, 6 Apr 2020 13:12:38 +0000 Subject: [PATCH] [FIX] point_of_sale: wrong stock valuation entry Before this commit: When a PoS session is closed in anglosaxon accounting with real time stock valuation, the stock moves linked to PoS orders are used to create the stock valuation entry. When an order is composed of only products of type 'service', there are no picking linked to the order, and so the entry is created with all stock moves having no picking_id. After this commit: To avoid this problem, we are checking that the PoS order has a picking before looking for stock moves. OPW-2206625 closes odoo/odoo#49117 X-original-commit: 0386e1f099bf42a59a79febfa06906dd76bd62e2 Signed-off-by: pimodoo --- addons/point_of_sale/models/pos_session.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/addons/point_of_sale/models/pos_session.py b/addons/point_of_sale/models/pos_session.py index ff39a7fda67..6eefec52618 100644 --- a/addons/point_of_sale/models/pos_session.py +++ b/addons/point_of_sale/models/pos_session.py @@ -446,7 +446,7 @@ class PosSession(models.Model): for amount_key, amount in amounts.items(): taxes[tax_key][amount_key] += amount - if self.company_id.anglo_saxon_accounting: + if self.company_id.anglo_saxon_accounting and order.picking_ids.ids: # Combine stock lines stock_moves = self.env['stock.move'].search([ ('picking_id', 'in', order.picking_ids.ids),