Skip to content

Commit

Permalink
[FIX]已有核销的固定资产不允许反审核 osbzr#1852
Browse files Browse the repository at this point in the history
  • Loading branch information
floraXiao committed Jul 9, 2018
1 parent 91cdef4 commit f0c73a7
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
2 changes: 2 additions & 0 deletions asset/models/asset.py
Original file line number Diff line number Diff line change
Expand Up @@ -314,6 +314,8 @@ def asset_draft(self):
raise UserError(u'已变更不能撤销确认!')
if self.period_id.is_closed:
raise UserError(u'该会计期间(%s)已结账!不能撤销确认' % self.period_id.name)
if self.money_invoice.reconciled != 0:
raise UserError(u'固定资产已有核销,请不要撤销')

'''删掉凭证'''
if self.voucher_id:
Expand Down
5 changes: 2 additions & 3 deletions money/models/money_order.py
Original file line number Diff line number Diff line change
Expand Up @@ -719,8 +719,6 @@ def money_invoice_draft(self):
for inv in self:
if inv.state == 'draft':
raise UserError(u'请不要重复撤销')
if inv.reconciled != 0:
raise UserError(u'结算单已有核销,请不要撤销')
inv.reconciled = 0.0
inv.to_reconcile = 0.0
inv.state = 'draft'
Expand Down Expand Up @@ -1139,7 +1137,8 @@ def _get_or_pay_cancel(self, line, business_type, name):
if business_type in ['get_to_get', 'pay_to_pay']:
invoices = self.env['money.invoice'].search([('name', '=', name)])
for inv in invoices:
inv.money_invoice_draft()
if inv.state == 'done':
inv.money_invoice_draft()
inv.unlink()
return True

Expand Down

0 comments on commit f0c73a7

Please sign in to comment.