mirror of
https://github.com/guohuadeng/app-odoo.git
synced 2025-02-23 04:11:36 +02:00
init 中文翻译po
This commit is contained in:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user