summaryrefslogtreecommitdiff
path: root/addons
diff options
context:
space:
mode:
authorDamien Bouvy <dbo@odoo.com>2018-06-06 10:09:04 +0200
committerLucas Perais <lcsperais@gmail.com>2018-06-06 10:09:04 +0200
commite2efec8e544917e8524f75739eaf7cfabc1e23ae (patch)
tree1806b0b418aa444398b1de520ccbb1c7f891a4a3 /addons
parentc25b68f324f8d3604b33380504c3428585eb7efa (diff)
[FIX] pos: reconciliation and performance issues (#24610)
Before this commit, the complete list of orders of the pos session was processed through the reconciliation mechanism to check if an automatic reconciliation was possible (introduced in a controversial 'bug fix' at fe70f07, itself a backport of a master commit at a2319b4). The goal of this auto-reconciliation was to avoid potentially silent and numerous customer statements that could be reconciled automatically. This is mostly useless in a lot of cases, since a lot of users do not set any partner_id value on the pos order - there is nothing useful to reconcile. Going through the whole list of orders is time-wasting (especially since the reconciliation method does not scale well). Combine this with users who do not close their POS session often enough and closing a session can suddenly take up to several hours to process instead of several seconds with practically no obvious gain. After this commit, only orders which have a partner set on them will be auto-reconciled. opw-1818838 and opw-1817172
Diffstat (limited to 'addons')
-rw-r--r--addons/point_of_sale/models/pos_session.py4
1 files 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 44f9adb25c1..4ff493ee377 100644
--- a/addons/point_of_sale/models/pos_session.py
+++ b/addons/point_of_sale/models/pos_session.py
@@ -29,8 +29,8 @@ class PosSession(models.Model):
if order.state not in ('paid'):
raise UserError(_("You cannot confirm all orders of this session, because they have not the 'paid' status"))
order.action_pos_order_done()
- orders = session.order_ids.filtered(lambda order: order.state in ['invoiced', 'done'])
- orders.sudo()._reconcile_payments()
+ orders_to_reconcile = session.order_ids.filtered(lambda order: order.state in ['invoiced', 'done'] and order.partner_id)
+ orders_to_reconcile.sudo()._reconcile_payments()
config_id = fields.Many2one(
'pos.config', string='Point of Sale',