From 0220aa24e842028d0f0bad69a35a94025e391275 Mon Sep 17 00:00:00 2001 From: ivan deng Date: Sun, 7 Nov 2021 19:03:45 +0800 Subject: [PATCH] fix #47 l10n_cn_standard_latest14(Serious error in Chinese account type) #47 --- l10n_cn_standard_latest/__manifest__.py | 2 +- .../data/account.account.template.csv | 18 ++++++++++-------- l10n_cn_standard_latest/data/account.group.csv | 14 +++++++------- .../models/account_journal.py | 15 ++++----------- 4 files changed, 22 insertions(+), 27 deletions(-) diff --git a/l10n_cn_standard_latest/__manifest__.py b/l10n_cn_standard_latest/__manifest__.py index e284943d..eb2db344 100644 --- a/l10n_cn_standard_latest/__manifest__.py +++ b/l10n_cn_standard_latest/__manifest__.py @@ -9,7 +9,7 @@ { 'name': '2021最新中国企业会计表.Latest Chinese Accounting.', - 'version': '14.21.06.09', + 'version': '14.21.11.07', 'author': 'Sunpop.cn', 'category': 'Localization', 'website': 'https://www.sunpop.cn', diff --git a/l10n_cn_standard_latest/data/account.account.template.csv b/l10n_cn_standard_latest/data/account.account.template.csv index 6a18c818..f8dfd8bd 100644 --- a/l10n_cn_standard_latest/data/account.account.template.csv +++ b/l10n_cn_standard_latest/data/account.account.template.csv @@ -1,4 +1,6 @@ id,code,name,parent_id/id,reconcile,user_type_id/id,tag_ids/id,chart_template_id/id +account_1001,1001,库存现金,,TRUE,account.data_account_type_liquidity,,l10n_chart_china_standard_business_latest +account_1002,1002,银行存款,,TRUE,account.data_account_type_liquidity,tag21,l10n_chart_china_standard_business_latest account_1003,1003,存放中央银行款项,,TRUE,account.data_account_type_current_assets,tag21,l10n_chart_china_standard_business_latest account_1011,1011,存放同业,,FALSE,account.data_account_type_current_assets,tag21,l10n_chart_china_standard_business_latest account_1012,1012,其他货币资金,,FALSE,account.data_account_type_current_assets,,l10n_chart_china_standard_business_latest @@ -99,7 +101,7 @@ account_2221_6,2221.06,应交所得税,account_2221,FALSE,account.data_account_t account_2221_7,2221.07,应交土地增值税,account_2221,FALSE,account.data_account_type_current_liabilities,,l10n_chart_china_standard_business_latest account_2221_8,2221.08,应交城市维护建设税,account_2221,FALSE,account.data_account_type_current_liabilities,,l10n_chart_china_standard_business_latest account_2221_9,2221.09,应交房产税,account_2221,FALSE,account.data_account_type_current_liabilities,,l10n_chart_china_standard_business_latest -account_2221_10,2221.10,应交土地使用税,account_2221,FALSE,account.data_account_type_current_liabilities,,l10n_chart_china_standard_business_latest +account_2221_10,2221.1,应交土地使用税,account_2221,FALSE,account.data_account_type_current_liabilities,,l10n_chart_china_standard_business_latest account_2221_11,2221.11,应交车船使用税,account_2221,FALSE,account.data_account_type_current_liabilities,,l10n_chart_china_standard_business_latest account_2221_12,2221.12,应交个人所得税,account_2221,FALSE,account.data_account_type_current_liabilities,,l10n_chart_china_standard_business_latest account_2231,2231,应付利息,,FALSE,account.data_account_type_current_liabilities,,l10n_chart_china_standard_business_latest @@ -135,13 +137,13 @@ account_4102,4102,一般风险准备,,FALSE,account.data_account_type_equity,tag account_4103,4103,本年利润,,FALSE,account.data_account_type_equity,,l10n_chart_china_standard_business_latest account_4104,4104,利润分配,,FALSE,account.data_account_type_equity,,l10n_chart_china_standard_business_latest account_4201,4201,库存股,,FALSE,account.data_account_type_equity,,l10n_chart_china_standard_business_latest -account_5001,5001,生产成本,,FALSE,account.data_account_off_sheet,,l10n_chart_china_standard_business_latest -account_5101,5101,制造费用,,FALSE,account.data_account_off_sheet,,l10n_chart_china_standard_business_latest -account_5201,5201,劳务成本,,FALSE,account.data_account_off_sheet,,l10n_chart_china_standard_business_latest -account_5301,5301,研发支出,,FALSE,account.data_account_off_sheet,,l10n_chart_china_standard_business_latest -account_5401,5401,工程施工,,FALSE,account.data_account_off_sheet,tag30,l10n_chart_china_standard_business_latest -account_5402,5402,工程结算,,FALSE,account.data_account_off_sheet,tag30,l10n_chart_china_standard_business_latest -account_5403,5403,机械作业,,FALSE,account.data_account_off_sheet,tag30,l10n_chart_china_standard_business_latest +account_5001,5001,生产成本,,FALSE,account.data_account_type_direct_costs,,l10n_chart_china_standard_business_latest +account_5101,5101,制造费用,,FALSE,account.data_account_type_direct_costs,,l10n_chart_china_standard_business_latest +account_5201,5201,劳务成本,,FALSE,account.data_account_type_direct_costs,,l10n_chart_china_standard_business_latest +account_5301,5301,研发支出,,FALSE,account.data_account_type_direct_costs,,l10n_chart_china_standard_business_latest +account_5401,5401,工程施工,,FALSE,account.data_account_type_direct_costs,tag30,l10n_chart_china_standard_business_latest +account_5402,5402,工程结算,,FALSE,account.data_account_type_direct_costs,tag30,l10n_chart_china_standard_business_latest +account_5403,5403,机械作业,,FALSE,account.data_account_type_direct_costs,tag30,l10n_chart_china_standard_business_latest account_6001,6001,主营业务收入,,FALSE,account.data_account_type_revenue,,l10n_chart_china_standard_business_latest account_6011,6011,利息收入,,FALSE,account.data_account_type_revenue,tag23,l10n_chart_china_standard_business_latest account_6021,6021,手续费及佣金收入,,FALSE,account.data_account_type_revenue,tag23,l10n_chart_china_standard_business_latest diff --git a/l10n_cn_standard_latest/data/account.group.csv b/l10n_cn_standard_latest/data/account.group.csv index 394f98ca..9f7da706 100644 --- a/l10n_cn_standard_latest/data/account.group.csv +++ b/l10n_cn_standard_latest/data/account.group.csv @@ -1,7 +1,7 @@ -"id","code_prefix_start","code_prefix_end","name" -"account_group_1","1","1","资产类" -"account_group_2","2","2","负债类" -"account_group_3","3","3","共有类" -"account_group_4","4","4","所有者权益类" -"account_group_5","5","5","成本类" -"account_group_6","6","6","损益类" \ No newline at end of file +"id","code_prefix","name" +"account_group_1","1","资产类" +"account_group_2","2","负债类" +"account_group_3","3","共同类" +"account_group_4","4","所有者权益类" +"account_group_5","5","成本类" +"account_group_6","6","损益类" \ No newline at end of file diff --git a/l10n_cn_standard_latest/models/account_journal.py b/l10n_cn_standard_latest/models/account_journal.py index e9264e1e..00e62a3f 100644 --- a/l10n_cn_standard_latest/models/account_journal.py +++ b/l10n_cn_standard_latest/models/account_journal.py @@ -9,17 +9,6 @@ class AccountJournal(models.Model): @api.model def _prepare_liquidity_account(self, name, company, currency_id, type): - ''' - This function prepares the value to use for the creation of the default debit and credit accounts of a - liquidity journal (created through the wizard of generating COA from templates for example). - - :param name: name of the bank account - :param company: company for which the wizard is running - :param currency_id: ID of the currency in which is the bank account - :param type: either 'cash' or 'bank' - :return: mapping of field names and values - :rtype: dict - ''' digits = 6 chart = self.company_id.chart_template_id if chart: @@ -30,6 +19,8 @@ class AccountJournal(models.Model): else: account_code_prefix = company.cash_account_code_prefix or company.bank_account_code_prefix or '' digits = len(account_code_prefix) + # 获取上级 + p_account = self.env['account.account'].search([('code', '=', account_code_prefix), ('company_id', '=', company.id)], limit=1) liquidity_type = self.env.ref('account.data_account_type_liquidity') return { @@ -37,5 +28,7 @@ class AccountJournal(models.Model): 'currency_id': currency_id or False, 'code': self.env['account.account']._search_new_account_code(company, digits, account_code_prefix), 'user_type_id': liquidity_type and liquidity_type.id or False, + 'parent_id': p_account and p_account.id or False, + 'group_id': p_account and p_account.group_id and p_account.group_id.id or False, 'company_id': company.id, }