OS template account
This commit is contained in:
15
modules/account_ch_os/__init__.py
Normal file
15
modules/account_ch_os/__init__.py
Normal file
@@ -0,0 +1,15 @@
|
||||
# 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
|
||||
|
||||
from . import account
|
||||
|
||||
|
||||
def register():
|
||||
Pool.register(
|
||||
account.AccountTemplate,
|
||||
module='account_ch_os', type_='model')
|
||||
Pool.register(
|
||||
account.CreateChart,
|
||||
module='account_ch_os', type_='wizard')
|
||||
27
modules/account_ch_os/account.py
Normal file
27
modules/account_ch_os/account.py
Normal file
@@ -0,0 +1,27 @@
|
||||
# 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
|
||||
2395
modules/account_ch_os/account_ch_os.xml
Normal file
2395
modules/account_ch_os/account_ch_os.xml
Normal file
File diff suppressed because it is too large
Load Diff
2
modules/account_ch_os/tests/__init__.py
Normal file
2
modules/account_ch_os/tests/__init__.py
Normal file
@@ -0,0 +1,2 @@
|
||||
# This file is part of Tryton. The COPYRIGHT file at the top level of
|
||||
# this repository contains the full copyright notices and license terms.
|
||||
12
modules/account_ch_os/tests/test_module.py
Normal file
12
modules/account_ch_os/tests/test_module.py
Normal file
@@ -0,0 +1,12 @@
|
||||
# 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.tests.test_tryton import ModuleTestCase
|
||||
|
||||
|
||||
class AccountCHOSTestCase(ModuleTestCase):
|
||||
'Test Account CH OS module'
|
||||
module = 'account_ch_os'
|
||||
|
||||
|
||||
del ModuleTestCase
|
||||
6
modules/account_ch_os/tryton.cfg
Normal file
6
modules/account_ch_os/tryton.cfg
Normal file
@@ -0,0 +1,6 @@
|
||||
[tryton]
|
||||
version=7.2.3
|
||||
depends:
|
||||
account
|
||||
xml:
|
||||
account_ch_os.xml
|
||||
Reference in New Issue
Block a user