Skip to content

Commit

Permalink
Merge pull request #1872 from Judystudy/master
Browse files Browse the repository at this point in the history
[FIX] 核销单的应收冲应付没有生成结算单 #1866
  • Loading branch information
GoodERPJeff committed Jul 12, 2018
2 parents d58810d + f587593 commit a4e476d
Showing 1 changed file with 16 additions and 2 deletions.
18 changes: 16 additions & 2 deletions money/models/money_order.py
Original file line number Diff line number Diff line change
Expand Up @@ -1076,6 +1076,20 @@ def _get_or_pay(self, line, business_type,
to_invoice_id.to_reconcile = 0
to_invoice_id.reconciled = -line.this_reconcile

# 应收冲应付,应收行、应付行分别生成负的结算单,并且核销
if business_type in ['get_to_pay']:
if not float_is_zero(line.this_reconcile, 2):
invoice_id = self.env['money.invoice'].create({
'name': name,
'category_id': line.category_id.id,
'amount': -line.this_reconcile,
'date': self.date,
'date_due': line.date_due,
'partner_id': partner_id.id,
})
# 核销 业务伙伴 的本次核销金额
invoice_id.to_reconcile = 0
invoice_id.reconciled = -line.this_reconcile
return True

@api.multi
Expand Down Expand Up @@ -1136,8 +1150,8 @@ def _get_or_pay_cancel(self, line, business_type, name):
line.name.to_reconcile += line.this_reconcile
line.name.reconciled -= line.this_reconcile

# 应收转应收、应付转应付,找到生成的结算单反审核并删除
if business_type in ['get_to_get', 'pay_to_pay']:
# 应收转应收、应付转应付、应收冲应付,找到生成的结算单反审核并删除
if business_type in ['get_to_get', 'pay_to_pay', 'get_to_pay']:
invoices = self.env['money.invoice'].search([('name', '=', name)])
for inv in invoices:
if inv.state == 'done':
Expand Down

0 comments on commit a4e476d

Please sign in to comment.