-
Notifications
You must be signed in to change notification settings - Fork 753
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
fix: update status of reference documents #2380
base: develop
Are you sure you want to change the base?
Conversation
@@ -310,3 +313,9 @@ def update_full_and_final_statement_status(doc, method=None): | |||
fnf = frappe.get_doc("Full and Final Statement", entry.reference_name) | |||
fnf.db_set("status", status) | |||
fnf.notify_update() | |||
|
|||
|
|||
def update_status_of_reference_documents(doc, status="Paid"): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
- We can encapsulate this function I think. No need to keep it outside the class
- Gratuity holds a "paid_amount" field. We should update that and call
gratuity.set_status
to update the status. If we just update the status,paid_amount
field will remain 0 - This should also mark gratuity as unpaid when FnF is cancelled. Current logic will change gratuity status to Cancelled I think.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Also can you add a test 🙈
frappe.db.set_value( | ||
"Gratuity", | ||
payable.reference_document, | ||
{"status": self.status, "paid_amount": payable.amount}, | ||
) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
set paid amount of gratuity doc and call set_status method so that the responsibility of setting the correct status is handled within gratuity itself
Also doesn't handle cancellation
Fixes the status issue for gratuity payments. When a Full & Final Statement is marked as 'Paid,' the linked gratuity doc's status updates to 'Paid' too.