From 4f45e5ea2e8d81b2849ad39e07f0b965b1bba913 Mon Sep 17 00:00:00 2001 From: jev Date: Fri, 15 Jan 2021 10:58:39 +0000 Subject: [PATCH] [FIX] point_of_sale: already reconciled stock_account_move_line When the customer use Anglo-Saxon stock valuation and have already reconciled some `account.move.line` related to an open `pos.session`, closing the session will fail. (You are trying to reconcile some entries that are already reconciled) Now, the reconciled lines are ignored. The inventory valuation is still correct as these lines were already reconciled. opws: 2374559 2376187 2377958 2391395 2425197 closes odoo/odoo#64668 X-original-commit: 3f939af62df65dcb9c8cdd2ecc3ac3d4c2983a2f Signed-off-by: Simon Goffin (sig) --- addons/point_of_sale/models/pos_session.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/addons/point_of_sale/models/pos_session.py b/addons/point_of_sale/models/pos_session.py index 8c566ab475e..163688a762f 100644 --- a/addons/point_of_sale/models/pos_session.py +++ b/addons/point_of_sale/models/pos_session.py @@ -729,9 +729,9 @@ class PosSession(models.Model): stock_moves = self.env['stock.move'].search([('picking_id', 'in', pickings.ids)]) stock_account_move_lines = self.env['account.move'].search([('stock_move_id', 'in', stock_moves.ids)]).mapped('line_ids') for account_id in stock_output_lines: - ( stock_output_lines[account_id].filtered(lambda aml: not aml.reconciled) + ( stock_output_lines[account_id] | stock_account_move_lines.filtered(lambda aml: aml.account_id == account_id) - ).reconcile() + ).filtered(lambda aml: not aml.reconciled).reconcile() return data def _prepare_line(self, order_line):