[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) <sig@openerp.com>
This commit is contained in:
jev
2021-01-18 10:53:23 +00:00
parent bd9c96e188
commit 4f45e5ea2e
+2 -2
View File
@@ -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):