[FIX] point_of_sale: Initial balance of a new statement in the POS

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) <sig@openerp.com>
This commit is contained in:
Goffin Simon
2019-06-04 11:10:51 +00:00
parent bd3a788479
commit 46d0b461cd
+2 -1
View File
@@ -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)