update cn account

This commit is contained in:
ivan deng
2021-11-09 15:35:17 +08:00
parent bf3260c85e
commit c4ec66b83a
2 changed files with 10 additions and 8 deletions

View File

@@ -338,10 +338,11 @@ class ResConfigSettings(models.TransientModel):
def remove_account_chart(self):
company_id = self.env.company.id
self = self.with_context(force_company=company_id, company_id=company_id)
self = self.with_company(self.env.company)
to_removes = [
# 清除财务科目,用于重设
'res.partner.bank',
'pos.payment.method',
'account.move.line',
'account.invoice',
'account.payment',
@@ -371,17 +372,18 @@ class ResConfigSettings(models.TransientModel):
# 增加对 pos的处理
try:
rec = self.env['pos.config'].search([])
rec = self.env['pos.config'].with_context(active_test=False).search([])
rec.write({
'journal_id': None,
'invoice_journal_id': None,
'payment_method_ids': None,
})
except Exception as e:
_logger.error('remove data error: %s,%s', 'account_chart', e)
# todo: 以下处理参考 res.partner的合并将所有m2o的都一次处理不需要次次找模型
# partner 处理
try:
rec = self.env['res.partner'].search([])
rec = self.env['res.partner'].with_context(active_test=False).search([])
rec.write({
'property_account_receivable_id': None,
'property_account_payable_id': None,
@@ -390,7 +392,7 @@ class ResConfigSettings(models.TransientModel):
_logger.error('remove data error: %s,%s', 'account_chart', e)
# 品类处理
try:
rec = self.env['product.category'].search([])
rec = self.env['product.category'].with_context(active_test=False).search([])
rec.write({
'property_account_income_categ_id': None,
'property_account_expense_categ_id': None,
@@ -403,7 +405,7 @@ class ResConfigSettings(models.TransientModel):
pass
# 产品处理
try:
rec = self.env['product.template'].search([])
rec = self.env['product.template'].with_context(active_test=False).search([])
rec.write({
'property_account_income_id': None,
'property_account_expense_id': None,
@@ -412,7 +414,7 @@ class ResConfigSettings(models.TransientModel):
pass
# 库存计价处理
try:
rec = self.env['stock.location'].search([])
rec = self.env['stock.location'].with_context(active_test=False).search([])
rec.write({
'valuation_in_account_id': None,
'valuation_out_account_id': None,
@@ -423,7 +425,7 @@ class ResConfigSettings(models.TransientModel):
seqs = []
res = self.remove_app_data(to_removes, seqs)
self._cr.commit()
self.env.company.sudo().write({'chart_template_id': False})
self.env.company.sudo().write({'chart_template_id': None})
return res
def remove_project(self):

View File

@@ -101,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.1,应交土地使用税,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_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
1 id code name parent_id/id reconcile user_type_id/id tag_ids/id chart_template_id/id
101 account_2221_7 2221.07 应交土地增值税 account_2221 FALSE account.data_account_type_current_liabilities l10n_chart_china_standard_business_latest
102 account_2221_8 2221.08 应交城市维护建设税 account_2221 FALSE account.data_account_type_current_liabilities l10n_chart_china_standard_business_latest
103 account_2221_9 2221.09 应交房产税 account_2221 FALSE account.data_account_type_current_liabilities l10n_chart_china_standard_business_latest
104 account_2221_10 2221.1 2221.10 应交土地使用税 account_2221 FALSE account.data_account_type_current_liabilities l10n_chart_china_standard_business_latest
105 account_2221_11 2221.11 应交车船使用税 account_2221 FALSE account.data_account_type_current_liabilities l10n_chart_china_standard_business_latest
106 account_2221_12 2221.12 应交个人所得税 account_2221 FALSE account.data_account_type_current_liabilities l10n_chart_china_standard_business_latest
107 account_2231 2231 应付利息 FALSE account.data_account_type_current_liabilities l10n_chart_china_standard_business_latest