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

fix: update status of reference documents #2380

Open
wants to merge 8 commits into
base: develop
Choose a base branch
from

Conversation

AyshaHakeem
Copy link
Contributor

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.

@@ -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"):
Copy link
Member

@ruchamahabal ruchamahabal Nov 12, 2024

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.

Copy link
Member

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 🙈

Comment on lines 14 to 18
frappe.db.set_value(
"Gratuity",
payable.reference_document,
{"status": self.status, "paid_amount": payable.amount},
)
Copy link
Member

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

@AyshaHakeem AyshaHakeem marked this pull request as draft November 29, 2024 06:16
@AyshaHakeem AyshaHakeem marked this pull request as ready for review December 11, 2024 03:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants