Skip to content

Commit

Permalink
[FIX] account_invoice_validation_workflow: fix crash on refund by modify
Browse files Browse the repository at this point in the history
The code in refund mode 'modify' is not updated to 8.0 so it will
crash when trying to create refund with new invoice.
  • Loading branch information
rm-jamotion committed Jul 19, 2017
1 parent 4e68ce4 commit f8bf9cf
Showing 1 changed file with 4 additions and 5 deletions.
9 changes: 4 additions & 5 deletions account_invoice_validation_workflow/invoice.py
Expand Up @@ -182,7 +182,7 @@ def compute_refund(self, cr, uid, ids, mode='refund', context=None):
for line in movelines:
if line.account_id.id == inv.account_id.id:
to_reconcile_ids[line.account_id.id] = [line.id]
if type(line.reconcile_id) != orm.orm.browse_null:
if line.reconcile_id:
reconcile_obj.unlink(cr, uid, line.reconcile_id.id)
# Specific to c2c need to trigger specific wrkf before
# create the refund
Expand Down Expand Up @@ -217,11 +217,11 @@ def compute_refund(self, cr, uid, ids, mode='refund', context=None):
'journal_id', 'period_id'], context=context)
invoice = invoice[0]
del invoice['id']
invoice_lines = inv_line_obj.read(
invoice_lines = inv_line_obj.browse(
cr, uid, invoice['invoice_line'], context=context)
invoice_lines = inv_obj._refund_cleanup_lines(
cr, uid, invoice_lines)
tax_lines = inv_tax_obj.read(
tax_lines = inv_tax_obj.browse(
cr, uid, invoice['tax_line'], context=context)
tax_lines = inv_obj._refund_cleanup_lines(
cr, uid, tax_lines)
Expand All @@ -235,8 +235,7 @@ def compute_refund(self, cr, uid, ids, mode='refund', context=None):
'period_id': period,
'name': description
})
for field in ('address_contact_id',
'address_invoice_id', 'partner_id',
for field in ('partner_id',
'account_id', 'currency_id',
'payment_term', 'journal_id'):
invoice[field] = invoice[
Expand Down

0 comments on commit f8bf9cf

Please sign in to comment.