Skip to content

Commit

Permalink
Receipt: fix cancellation
Browse files Browse the repository at this point in the history
  • Loading branch information
abernardi committed Dec 13, 2023
1 parent 9a00ef1 commit 17c6ed1
Showing 1 changed file with 8 additions and 9 deletions.
17 changes: 8 additions & 9 deletions recibo.py
Original file line number Diff line number Diff line change
Expand Up @@ -310,17 +310,16 @@ def cancel(cls, recibos):
delete_moves = []

for recibo in recibos:
reconciliations_c = [x.reconciliation
reconciliations = set()
reconciliations.update([x.reconciliation
for x in recibo.confirmed_move.lines
if x.reconciliation]
reconciliations_p = [x.reconciliation
if x.reconciliation])
reconciliations.update([x.reconciliation
for x in recibo.paid_move.lines
if x.reconciliation]
with Transaction().set_user(0, set_context=True):
if reconciliations_c:
Reconciliation.delete(reconciliations_c)
if reconciliations_p:
Reconciliation.delete(reconciliations_p)
if x.reconciliation])
if reconciliations:
with Transaction().set_user(0, set_context=True):
Reconciliation.delete(list(reconciliations))

if recibo.confirmed_move:
recibo.confirmed_cancel_move = recibo.confirmed_move.cancel()
Expand Down

0 comments on commit 17c6ed1

Please sign in to comment.