Permalink
Browse files

[FIX] point_of_sale: param for reconcile orders and payment

It has been argued that a regression took place because of e2efec8
Before that commit, everything was reconciled together
After, only payments and orders with a partner set were

While that commit improved performances (there are much less move lines to reconcile),
it introduced an inconvenience business wise because of the noise created
by the unreconciled lines

This commit proposes to cut the pear in half by introducing an ir parameter
to choose between the two options

OPW 1883594
closes #26971
  • Loading branch information...
kebeclibre committed Sep 13, 2018
1 parent dd20539 commit 9511cb2bb0fe41d2759dc504c7f5cae7f6ed0c99
Showing with 7 additions and 1 deletion.
  1. +6 −0 addons/point_of_sale/models/pos_order.py
  2. +1 −1 addons/point_of_sale/models/pos_session.py
@@ -407,6 +407,12 @@ def _reconcile_payments(self):
# for debugging and support purposes
_logger.exception('Reconciliation did not work for order %s', order.name)
def _filtered_for_reconciliation(self):
filter_states = ['invoiced', 'done']
if self.env['ir.config_parameter'].get_param('point_of_sale.order_reconcile_mode', 'all') == 'partner_only':
return self.filtered(lambda order: order.state in filter_states and order.partner_id)
return self.filtered(lambda order: order.state in filter_states)
def _default_session(self):
return self.env['pos.session'].search([('state', '=', 'opened'), ('user_id', '=', self.env.uid)], limit=1)
@@ -29,7 +29,7 @@ def _confirm_orders(self):
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_to_reconcile = session.order_ids.filtered(lambda order: order.state in ['invoiced', 'done'] and order.partner_id)
orders_to_reconcile = session.order_ids._filtered_for_reconciliation()
orders_to_reconcile.sudo()._reconcile_payments()
config_id = fields.Many2one(

0 comments on commit 9511cb2

Please sign in to comment.