mirror of
https://gitlab.com/flectra-community/bank-payment.git
synced 2024-11-22 13:42:07 +00:00
✨ New app to automatically set default bank if no payment mode is used
->account_payment_partner_default_bank
This commit is contained in:
parent
7486a57407
commit
6b96b671d6
@ -18,8 +18,9 @@ class AccountInvoice(models.Model):
|
|||||||
company = self.env.user.company_id
|
company = self.env.user.company_id
|
||||||
res = super(AccountInvoice, self)._onchange_partner_id()
|
res = super(AccountInvoice, self)._onchange_partner_id()
|
||||||
if self.type == 'out_invoice' and not self.partner_bank_id:
|
if self.type == 'out_invoice' and not self.partner_bank_id:
|
||||||
if company.bank_ids:
|
bank_id = self._get_partner_bank_id(company.id)
|
||||||
self.partner_bank_id = company.bank_ids[0]
|
if bank_id:
|
||||||
|
self.partner_bank_id = bank_id
|
||||||
|
|
||||||
return res
|
return res
|
||||||
|
|
||||||
@ -31,6 +32,7 @@ class AccountInvoice(models.Model):
|
|||||||
company = self.env.user.company_id
|
company = self.env.user.company_id
|
||||||
res = super(AccountInvoice, self)._onchange_payment_mode_id()
|
res = super(AccountInvoice, self)._onchange_payment_mode_id()
|
||||||
if self.type == 'out_invoice' and not self.partner_bank_id:
|
if self.type == 'out_invoice' and not self.partner_bank_id:
|
||||||
if company.bank_ids:
|
bank_id = self._get_partner_bank_id(company.id)
|
||||||
self.partner_bank_id = company.bank_ids[0]
|
if bank_id:
|
||||||
|
self.partner_bank_id = bank_id
|
||||||
return res
|
return res
|
||||||
|
Loading…
Reference in New Issue
Block a user