[IMP] account_check_printing: Disable Check payments on Cash journals import
Purpose
=======
When generating `Cash` bank journal on CoA import, it doesn't makes sense to have the `Check` payment method enabled by default
Specification
=============
When system automatically creates journals of bank and cash type when CoA is being installed,
1) type = "Bank"
- Manual -> Checked
- Check --> Checked
2) type = "Cash"
- Manual -> Checked
- Check --> Unchecked
This commit is contained in:
committed by
Yannick Tivisse
parent
4a4513ceb5
commit
64df882627
@@ -927,15 +927,17 @@ class WizardMultiChartsAccounts(models.TransientModel):
|
||||
of the accounts that have been generated from them.
|
||||
'''
|
||||
self.ensure_one()
|
||||
bank_journals = self.env['account.journal']
|
||||
# Create the journals that will trigger the account.account creation
|
||||
for acc in self.bank_account_ids:
|
||||
self.env['account.journal'].create({
|
||||
bank_journals += self.env['account.journal'].create({
|
||||
'name': acc.acc_name,
|
||||
'type': acc.account_type,
|
||||
'company_id': company.id,
|
||||
'currency_id': acc.currency_id.id,
|
||||
'sequence': 10
|
||||
})
|
||||
return bank_journals
|
||||
|
||||
|
||||
class AccountBankAccountsWizard(models.TransientModel):
|
||||
|
||||
@@ -3,3 +3,4 @@
|
||||
|
||||
from . import account_journal
|
||||
from . import account_payment
|
||||
from . import chart_template
|
||||
|
||||
@@ -0,0 +1,21 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
from odoo import api, models
|
||||
|
||||
|
||||
class WizardMultiChartsAccounts(models.TransientModel):
|
||||
_inherit = 'wizard.multi.charts.accounts'
|
||||
|
||||
@api.multi
|
||||
def _create_bank_journals_from_o2m(self, company, acc_template_ref):
|
||||
'''
|
||||
When system automatically creates journals of bank and cash type when CoA is being installed
|
||||
do not enable the `Check` payment method on bank journals of type `Cash`.
|
||||
|
||||
'''
|
||||
bank_journals = super(WizardMultiChartsAccounts, self)._create_bank_journals_from_o2m(company, acc_template_ref)
|
||||
payment_method_check = self.env.ref('account_check_printing.account_payment_method_check')
|
||||
bank_journals.filtered(lambda journal: journal.type == 'cash').write({
|
||||
'outbound_payment_method_ids': [(3, payment_method_check.id)]
|
||||
})
|
||||
return bank_journals
|
||||
Reference in New Issue
Block a user