[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
This commit is contained in:
Nicolas Martinelli
2016-10-26 10:57:16 +02:00
parent 19cca50e7c
commit e99e0d6922
+6 -2
View File
@@ -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)