From 46d0b461cdf246fdd1b7922401a9f1859a4fe55d Mon Sep 17 00:00:00 2001 From: Goffin Simon Date: Tue, 4 Jun 2019 11:03:18 +0000 Subject: [PATCH] [FIX] point_of_sale: Initial balance of a new statement in the POS MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Steps to reproduce the bug: - Create a new Bank Account A available in the POS - Set A as a payment method in the pos.config - Create a new session and sell a product P for 100€ - Make the payment with A - Close the session and validate the entries - Check that a new statement in A has been created with a starting balance = 0€ and an ending balance = 100€ - Create a new session and close the session Bug: A new statement for A had been created with a starting balance = 0€ instead of 100€ (the ending balance of the previous session) opw:1981984 closes odoo/odoo#33868 Signed-off-by: Simon Goffin (sig) --- addons/point_of_sale/models/pos_session.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/addons/point_of_sale/models/pos_session.py b/addons/point_of_sale/models/pos_session.py index 97a93d004d2..b6eea3cf8a2 100644 --- a/addons/point_of_sale/models/pos_session.py +++ b/addons/point_of_sale/models/pos_session.py @@ -208,7 +208,8 @@ class PosSession(models.Model): st_values = { 'journal_id': journal.id, 'user_id': self.env.user.id, - 'name': pos_name + 'name': pos_name, + 'balance_start': self.env["account.bank.statement"]._get_opening_balance(journal.id) } statements.append(ABS.with_context(ctx).sudo(uid).create(st_values).id)