From e99e0d6922742500ecb222b7667a85fe9220863f Mon Sep 17 00:00:00 2001 From: Nicolas Martinelli Date: Wed, 26 Oct 2016 10:46:00 +0200 Subject: [PATCH] [FIX] point_of_sale: journal of closing entries - Invoice a POS order => the invoice number is for example 0001 - Close the POS session - Invoice another POS order => the invoice number is 0003 This is because the journal used for the POS closing entries is the same than the journal used for the customer invoices. Therefore, the closing entry consumes a sequence number of the invoices. This affects POS orders, but potentially SO as well if they use the same journal. This is fixed in v10 from commit b5b0d36b31. In v9, we use a workaround by looking first if a `ir.config_parameter` named `pos.closing.journal_id` exists. We use this journal for the session closing. opw-691771 --- addons/point_of_sale/point_of_sale.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/addons/point_of_sale/point_of_sale.py b/addons/point_of_sale/point_of_sale.py index b815673878b..1d35dc8437c 100644 --- a/addons/point_of_sale/point_of_sale.py +++ b/addons/point_of_sale/point_of_sale.py @@ -610,7 +610,9 @@ class pos_session(osv.osv): local_context = dict(context or {}, force_company=company_id) order_ids = [order.id for order in session.order_ids if order.state == 'paid'] - move_id = pos_order_obj._create_account_move(cr, uid, session.start_at, session.name, session.config_id.journal_id.id, company_id, context=context) + # FORWARD-PORT UP TO SAAS-12 + journal_id = self.pool['ir.config_parameter'].get_param(cr, SUPERUSER_ID, 'pos.closing.journal_id', default=session.config_id.journal_id.id, context=context) + move_id = pos_order_obj._create_account_move(cr, uid, session.start_at, session.name, int(journal_id), company_id, context=context) pos_order_obj._create_account_move_line(cr, uid, order_ids, session, move_id, context=local_context) @@ -1287,7 +1289,9 @@ class pos_order(osv.osv): if move_id is None: # Create an entry for the sale - move_id = self._create_account_move(cr, uid, order.session_id.start_at, order.name, order.sale_journal.id, order.company_id.id, context=context) + # FORWARD-PORT UP TO SAAS-12 + journal_id = self.pool['ir.config_parameter'].get_param(cr, SUPERUSER_ID, 'pos.closing.journal_id', default=order.sale_journal.id, context=context) + move_id = self._create_account_move(cr, uid, order.session_id.start_at, order.name, int(journal_id), order.company_id.id, context=context) move = account_move_obj.browse(cr, SUPERUSER_ID, move_id, context=context)