Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support finance update with amount set to zero #24

Open
llewelld opened this issue Dec 16, 2024 · 2 comments · May be fixed by #25 or #27
Open

Support finance update with amount set to zero #24

llewelld opened this issue Dec 16, 2024 · 2 comments · May be fixed by #25 or #27

Comments

@llewelld
Copy link

The finance update command allows you to amend existing finance rows for cost recovery.

The command line allows you to specify only the fields that have changed, leaving the others intact. In order to check whether a value has been passed, the current logic is used:

new_finance["amount"] = amount if amount else old_finance["amount"]

So when no amount value is passed, amount will be set to None and so this will just end up as:

new_finance["amount"] = old_finance["amount"]

In other words: no change.

Unfortunately the condition also fails if you set amount to be zero. This means it's currently impossible to run a finance update command that sets the amount to zero, for example like this:

rctab sub finance update --finance-id <FIN_ID> --subscription-id <SUB_ID> --amount 0

Occasionally it's useful to set the amount of a finance row to zero, so it'd be useful if this was possible.

@llewelld llewelld linked a pull request Dec 16, 2024 that will close this issue
@Iain-S
Copy link
Contributor

Iain-S commented Dec 18, 2024

Good catch. Out of curiosity / for the docs, when is it useful to set the finance row to 0? I'd have thought that it would usually be easier to use the finance delete command but I can imagine that there are edge cases.

@Iain-S Iain-S linked a pull request Dec 18, 2024 that will close this issue
@llewelld
Copy link
Author

That's a good question. This arose from a request to move funding that distributed across multiple subscriptions to a single subscription. For the subscriptions where the funding was moved from, my instinct was to set the row to zero... I guess this maintains a clearer audit trail (so the ticket ID is visible in RCTab), but in truth it didn't occur to me to just delete the entire row.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
2 participants