Skip to content

Commit

Permalink
T0801 - Messages to CI for refunded Birthday Invoices
Browse files Browse the repository at this point in the history
 - Fix amount
  • Loading branch information
langjer committed Mar 12, 2024
1 parent e0a0cfa commit bf4577e
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 4 deletions.
2 changes: 1 addition & 1 deletion gift_compassion/models/account_move.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ def _compute_is_gift_refundable(self):
if move.invoice_category in ["gift", "sponsorship"]:
gifts = move.invoice_line_ids.mapped("gift_id")
move.is_gift_refundable = not gifts or any(
gift.state in ["draft", "Undeliverable"] for gift in gifts
gift.state in ["verify", "draft", "Undeliverable"] for gift in gifts
)
else:
move.is_gift_refundable = True
5 changes: 2 additions & 3 deletions gift_compassion/models/sponsorship_gift.py
Original file line number Diff line number Diff line change
Expand Up @@ -214,9 +214,8 @@ def _compute_invoice_fields(self):
gift.gift_date = max(
invoice_lines.mapped("move_id").mapped("invoice_date") or [False]
)
gift.amount = sum(invoice_lines.mapped("credit")) - sum(
invoice_lines.mapped("debit")
)
amount_currency_inverse = [-value for value in invoice_lines.mapped("amount_currency")]
gift.amount = sum(amount_currency_inverse)

def _compute_currency(self):
# Set gift currency depending on its invoice currency
Expand Down

0 comments on commit bf4577e

Please sign in to comment.