fix account reset

This commit is contained in:
ivan deng
2021-03-31 19:35:07 +08:00
parent 61bde24726
commit effa625cec
3 changed files with 27 additions and 10 deletions

View File

@@ -364,17 +364,18 @@ class ResConfigSettings(models.TransientModel):
sql2 = "update account_journal set bank_account_id=NULL where company_id=%d;" % company_id sql2 = "update account_journal set bank_account_id=NULL where company_id=%d;" % company_id
self._cr.execute(sql) self._cr.execute(sql)
self._cr.execute(sql2) self._cr.execute(sql2)
self._cr.commit() self._cr.commit()
except Exception as e: except Exception as e:
_logger.error('remove data error: %s,%s', 'account_chart: set tax and account_journal', e) _logger.error('remove data error: %s,%s', 'account_chart: set tax and account_journal', e)
try:
# 增加对 pos的处理 # 增加对 pos的处理
sql = ("update pos_config set journal_id=NULL;") if self.env['ir.model']._get('pos.config'):
self._cr.execute(sql) self.env['pos.config'].write({
self._cr.commit() 'journal_id': False,
except Exception as e: })
pass # todo: 以下处理参考 res.partner的合并将所有m2o的都一次处理不需要次次找模型
# partner 处理
try: try:
rec = self.env['res.partner'].search([]) rec = self.env['res.partner'].search([])
for r in rec: for r in rec:
@@ -384,6 +385,7 @@ class ResConfigSettings(models.TransientModel):
}) })
except Exception as e: except Exception as e:
_logger.error('remove data error: %s,%s', 'account_chart', e) _logger.error('remove data error: %s,%s', 'account_chart', e)
# 品类处理
try: try:
rec = self.env['product.category'].search([]) rec = self.env['product.category'].search([])
for r in rec: for r in rec:
@@ -396,7 +398,18 @@ class ResConfigSettings(models.TransientModel):
'property_stock_valuation_account_id': None, 'property_stock_valuation_account_id': None,
}) })
except Exception as e: except Exception as e:
pass # raise Warning(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,
})
except Exception as e:
pass
# 库存计价处理
try: try:
rec = self.env['stock.location'].search([]) rec = self.env['stock.location'].search([])
for r in rec: for r in rec:

View File

@@ -48,6 +48,8 @@
<h2 class="oe_slogan">This is a Long Term Support Apps.</h2> <h2 class="oe_slogan">This is a Long Term Support Apps.</h2>
<div class="oe_demo" style=" margin: 30px auto 0; padding: 0 15px 0 0; border:none; width: 96%;"> <div class="oe_demo" style=" margin: 30px auto 0; padding: 0 15px 0 0; border:none; width: 96%;">
<h3>Update: v14.21.03.31</h3> <h3>Update: v14.21.03.31</h3>
<p>Account date reset, and account chart reset support multi company reset.</p>
<h3>Update: v14.21.03.30</h3>
<p>38. Add Draggable Dialog enable.</p> <p>38. Add Draggable Dialog enable.</p>
<p>37. Easy noupdate manage for External Identifiers(xml_id).</p> <p>37. Easy noupdate manage for External Identifiers(xml_id).</p>
<h3>Update: v14.21.03.03</h3> <h3>Update: v14.21.03.03</h3>

View File

@@ -143,8 +143,10 @@
confirm="Please confirm to delete the select data?" class="oe_highlight"/> confirm="Please confirm to delete the select data?" class="oe_highlight"/>
</div> </div>
<div class="col-12 col-lg-12 mb4"> <div class="col-12 col-lg-12 mb4">
<span class="col-3 col-lg-2 text-left">Accounting</span> <span class="col-3 col-lg-2 text-left">
Accounting
<span class="fa fa-lg fa-building-o" title="Values set here are company-specific." groups="base.group_multi_company"/> <span class="fa fa-lg fa-building-o" title="Values set here are company-specific." groups="base.group_multi_company"/>
</span>
<button string="Delete All Voucher/Invoice/Bill" type="object" name="remove_account" <button string="Delete All Voucher/Invoice/Bill" type="object" name="remove_account"
confirm="Please confirm to delete the select data?" class="oe_highlight"/> confirm="Please confirm to delete the select data?" class="oe_highlight"/>
| |