# This file is part of Tryton. The COPYRIGHT file at the top level of # this repository contains the full copyright notices and license terms. import csv from io import BytesIO, TextIOWrapper from sql import Table from sql.aggregate import Sum from sql.conditionals import Coalesce from trytond.config import config from trytond.model import ModelStorage, ModelView, fields from trytond.pool import Pool, PoolMeta from trytond.pyson import Eval from trytond.transaction import Transaction from trytond.wizard import Button, StateTransition, StateView, Wizard class AccountTemplate(metaclass=PoolMeta): __name__ = 'account.account.template' @classmethod def __register__(cls, module_name): cursor = Transaction().connection.cursor() model_data = Table('ir_model_data') super().__register__(module_name) 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) # template_id = ModelData.get_id('account_ch.root') # if self.account.account_template.id == template_id: # defaults['account_receivable'] = self.get_account( # 'account_ch.3400') # defaults['account_payable'] = self.get_account( # 'account_ch.6040') return defaults