28 lines
947 B
Python
28 lines
947 B
Python
# This file is part of Tryton. The COPYRIGHT file at the top level of
|
|
# this repository contains the full copyright notices and license terms.
|
|
|
|
from trytond.pool import Pool, PoolMeta
|
|
|
|
|
|
class AccountTemplate(metaclass=PoolMeta):
|
|
__name__ = 'account.account.template'
|
|
|
|
|
|
class CreateChart(metaclass=PoolMeta):
|
|
__name__ = 'account.create_chart'
|
|
|
|
def default_properties(self, fields):
|
|
pool = Pool()
|
|
ModelData = pool.get('ir.model.data')
|
|
defaults = super().default_properties(fields)
|
|
try:
|
|
template_id = ModelData.get_id('account_ch_os', 'root')
|
|
except KeyError:
|
|
return defaults
|
|
if self.account.account_template.id == template_id:
|
|
defaults['account_receivable'] = self.get_account(
|
|
'account_ch_os.acct_110000')
|
|
defaults['account_payable'] = self.get_account(
|
|
'account_ch_os.acct_200000')
|
|
return defaults
|