[IMP] account: search/create bank from bic in bank account wizard
When creating a bank account, the BIC should be enough to find or create a new bank. task id #2321110 closes odoo/odoo#55993 Signed-off-by: oco-odoo <oco-odoo@users.noreply.github.com>
This commit is contained in:
@@ -94,6 +94,12 @@ class SetupBarBankConfigWizard(models.TransientModel):
|
||||
"""
|
||||
vals['partner_id'] = self.env.company.partner_id.id
|
||||
vals['new_journal_name'] = vals['acc_number']
|
||||
|
||||
# If no bank has been selected, but we have a bic, we are using it to find or create the bank
|
||||
if not vals['bank_id'] and vals['bank_bic']:
|
||||
vals['bank_id'] = self.env['res.bank'].search([('bic', '=', vals['bank_bic'])], limit=1).id \
|
||||
or self.env['res.bank'].create({'name': vals['bank_bic'], 'bic': vals['bank_bic']}).id
|
||||
|
||||
return super(SetupBarBankConfigWizard, self).create(vals)
|
||||
|
||||
@api.onchange('linked_journal_id')
|
||||
|
||||
@@ -44,8 +44,8 @@
|
||||
<group>
|
||||
<group>
|
||||
<field name="acc_number" placeholder="e.g BE15001559627230"/>
|
||||
<field name="bank_id" placeholder="e.g Bank of America"/>
|
||||
<field name="bank_bic" placeholder="e.g GEBABEBB" string="Bank Identifier Code"/>
|
||||
<field name="bank_id" placeholder="e.g Bank of America"/>
|
||||
</group>
|
||||
</group>
|
||||
<group attrs="{'invisible': [('num_journals_without_account', '<', 2)]}">
|
||||
|
||||
Reference in New Issue
Block a user