Skip to content

Commit

Permalink
Merge pull request OCA#18 from florian-dacosta/6.1-check_account_befo…
Browse files Browse the repository at this point in the history
…re_reconciliation

6.1-Check account before reconciliation
  • Loading branch information
gurneyalex committed Sep 3, 2015
2 parents 34bc24c + cdc1a21 commit 070d97d
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions sale_automatic_workflow/sale.py
Original file line number Diff line number Diff line change
Expand Up @@ -99,13 +99,19 @@ def reconcile_invoice(self, cr, uid, ids, context=None):
line_ids = []
payment_amount = 0
invoice_amount = 0
account_id = invoice.account_id.id
partner_id = invoice.partner_id.id
if invoice.sale_ids and invoice.sale_ids[0].payment_id and invoice.move_id:
for move in invoice.sale_ids[0].payment_id.move_ids:
if move.credit > 0 and not move.reconcile_id:
if move.credit > 0 and not move.reconcile_id \
and move.account_id.id == account_id \
and move.partner_id.id == partner_id:
line_ids.append(move.id)
payment_amount += move.credit
for move in invoice.move_id.line_id:
if move.debit > 0 and not move.reconcile_id:
if move.debit > 0 and not move.reconcile_id \
and move.account_id.id == account_id \
and move.partner_id.id == partner_id:
line_ids.append(move.id)
invoice_amount += move.debit
balance = abs(payment_amount-invoice_amount)
Expand Down

0 comments on commit 070d97d

Please sign in to comment.