[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 <pimodoo@users.noreply.github.com>
This commit is contained in:
Loan (lse)
2020-04-07 09:43:25 +00:00
committed by Pierre Masereel
parent 1dc3c0d1a8
commit b2e6784c69
+1 -1
View File
@@ -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),