init 中文翻译po

This commit is contained in:
Ivan Office
2024-10-31 20:23:33 +08:00
parent 4c4502b901
commit 54f1c3adff
12 changed files with 553 additions and 345 deletions

View File

@@ -310,15 +310,20 @@ class ResConfigSettings(models.TransientModel):
company_id = self.env.company.id
self = self.with_company(self.env.company)
to_removes = [
# 清除财务科目,用于重设
# 清除财务科目,用于重设。有些是企业版的也处理下
'account.reconcile.model',
'account.transfer.model.line',
'account.transfer.model',
'res.partner.bank',
# 'account.invoice',
'account.payment',
'account.bank.statement',
# 'account.tax.account.tag',
'account.tax',
'account.tax.template',
# 'wizard_multi_charts_accounts',
'account.account',
# 'account.journal',
]
# todo: 要做 remove_hr因为工资表会用到 account
# 更新account关联很多是多公司字段故只存在 ir_property故在原模型只能用update
@@ -331,7 +336,6 @@ class ResConfigSettings(models.TransientModel):
sql2 = "update account_journal set bank_account_id=NULL where company_id=%d;" % company_id
self._cr.execute(sql)
self._cr.execute(sql2)
self._cr.commit()
except Exception as e:
_logger.error('remove data error: %s,%s', 'account_chart: set tax and account_journal', e)
@@ -345,59 +349,111 @@ class ResConfigSettings(models.TransientModel):
# partner 处理
try:
rec = self.env['res.partner'].search([])
for r in rec:
r.write({
'property_account_receivable_id': None,
'property_account_payable_id': None,
})
rec.write({
'property_account_receivable_id': None,
'property_account_payable_id': None,
})
self._cr.commit()
except Exception as e:
_logger.error('remove data error: %s,%s', 'account_chart', e)
# 品类处理
try:
rec = self.env['product.category'].search([])
for r in rec:
r.write({
'property_account_income_categ_id': None,
'property_account_expense_categ_id': None,
'property_account_creditor_price_difference_categ': None,
'property_stock_account_input_categ_id': None,
'property_stock_account_output_categ_id': None,
'property_stock_valuation_account_id': None,
})
rec.write({
'property_account_income_categ_id': None,
'property_account_expense_categ_id': None,
'property_account_creditor_price_difference_categ': None,
'property_stock_account_input_categ_id': None,
'property_stock_account_output_categ_id': None,
'property_stock_valuation_account_id': None,
'property_stock_journal': None,
})
self._cr.commit()
except Exception as e:
pass
# 产品处理
try:
rec = self.env['product.template'].search([])
for r in rec:
r.write({
'property_account_income_id': None,
'property_account_expense_id': None,
})
rec.write({
'property_account_income_id': None,
'property_account_expense_id': None,
'property_account_creditor_price_difference': None,
})
self._cr.commit()
except Exception as e:
pass
# 库存计价处理
# pos处理清支付清账本
try:
rec = self.env['stock.location'].search([])
for r in rec:
r.write({
'valuation_in_account_id': None,
'valuation_out_account_id': None,
})
rec = self.env['pos.config'].search([])
rec.write({
'invoice_journal_id': None,
'journal_id': None,
'payment_method_ids': None,
'fiscal_position_ids': None,
})
self._cr.commit()
except Exception as e:
pass # raise Warning(e)
pass
# 日记账处理
try:
rec = self.env['account.journal'].search([])
rec.write({
'default_account_id': False,
'suspense_account_id': False
'account_control_ids': None,
'bank_account_id': None,
'default_account_id': None,
'loss_account_id': None,
'profit_account_id': None,
'suspense_account_id': None,
})
self._cr.commit()
except Exception as e:
pass # raise Warning(e)
# 库存计价处理
try:
rec = self.env['stock.location'].search([])
rec.write({
'valuation_in_account_id': None,
'valuation_out_account_id': None,
})
self._cr.commit()
except Exception as e:
pass # raise Warning(e)
# 库存计价默认值处理
try:
# 当前有些日记账的默认值要在 ir.property 处理 _set_default比较麻烦
todo_list = [
'property_stock_account_input_categ_id',
'property_stock_account_output_categ_id',
'property_stock_valuation_account_id',
'property_stock_journal',
]
for name in todo_list:
field_id = self.env['ir.model.fields']._get('product.category', name).id
prop = self.env['ir.property'].sudo().search([
('fields_id', '=', field_id),
])
if prop:
prop.unlink()
self._cr.commit()
except Exception as e:
pass # raise Warning(e)
# 先 unlink 处理
j_ids = self.env['account.journal'].sudo().search([])
if j_ids:
try:
j_ids.unlink()
self._cr.commit()
except Exception as e:
pass # raise Warning(e)
try:
c_ids = self.env['res.company'].sudo().search([])
c_ids.sudo().write({
'chart_template_id': False,
})
except Exception as e:
pass
pass # raise Warning(e)
seqs = []
res = self._remove_app_data(to_removes, seqs)
return res
@@ -450,6 +506,48 @@ class ResConfigSettings(models.TransientModel):
]
return self._remove_app_data(to_removes)
def remove_event(self):
to_removes = [
# 清除
'website.event.menu',
'event.sponsor',
'event.sponsor.type',
'event.meeting.room',
'event.registration.answer',
'event.question.answer',
'event.question',
'event.quiz',
'event.quiz.answer',
'event.quiz.question',
'event.track',
'event.track.visitor',
'event.track.location',
'event.track.tag',
'event.track.tag.category',
'event.track.stage',
'event.mail.registration',
'event.mail',
'event.type.mail',
'event.lead.rule',
'event.booth.registration',
'event.booth',
'event.type',
'event.type.booth',
'event.booth.category',
'event.registration',
'event.ticket',
'event.type.ticket',
'event.event',
'event.stage',
'event.tag',
'event.tag.category',
'event.type',
]
seqs = [
'event.event.',
]
return self._remove_app_data(to_removes, seqs)
def remove_website(self):
to_removes = [
# 清除网站数据w, w_blog