for cash_journal in cash_payment_methods.mapped('cash_journal_id'):
ctx['journal_id'] = cash_journal.id if pos_config.cash_control and cash_journal.type == 'cash' else False
st_values = {
'journal_id': cash_journal.id,
'user_id': self.env.user.id,
'name': pos_name,
'balance_start': self.env["account.bank.statement"]._get_opening_balance(cash_journal.id) if cash_journal.type == 'cash' else 0
}
statement_ids |= statement_ids.with_context(ctx).create(st_values)
values.update({
'name': pos_name,
'statement_ids': [(6, 0, statement_ids.ids)],
'config_id': config_id,
})
if self.user_has_groups('point_of_sale.group_pos_user'):
res = super(PosSession, self.with_context(ctx).sudo()).create(values)
else:
res = super(PosSession, self.with_context(ctx)).create(values)
Why it is not creating bank statement for Bank Journal? Is there any reason for this?