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

refactor: validate due date code and message according to doctype #45126

Merged
merged 3 commits into from
Jan 8, 2025

Conversation

iamejaaz
Copy link
Contributor

@iamejaaz iamejaaz commented Jan 7, 2025

Closes #44998

Changes in PR:

  • Changed function arguments to named arguments.
  • Added a doctype parameter and displayed a message based on the doctype.
  • If there is only one row in the payment schedule child table, set its due date to the parent due date

Screenshots/GIFs

  • Sales Invoice
    image

  • Purchase Invoice
    image

@github-actions github-actions bot added accounts needs-tests This PR needs automated unit-tests. labels Jan 7, 2025
Comment on lines 678 to 690
validate_due_date(
posting_date,
self.due_date,
self.payment_terms_template,
posting_date=posting_date,
due_date=self.due_date,
template_name=self.payment_terms_template,
doctype=self.doctype,
)
elif self.doctype == "Purchase Invoice":
validate_due_date(
posting_date,
self.due_date,
self.bill_date,
self.payment_terms_template,
posting_date=posting_date,
due_date=self.due_date,
bill_date=self.bill_date,
template_name=self.payment_terms_template,
doctype=self.doctype,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There is no need to call the function separately for sales and Purchase Invoices. Commonify them; only due_date is different in both cases.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done changes

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi @nabinhait ,

I have removed the redundant mandatory error validation. Could you please check again now?

@iamejaaz iamejaaz requested a review from nabinhait January 8, 2025 05:05
@nabinhait nabinhait merged commit 81d8f25 into frappe:develop Jan 8, 2025
18 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
accounts needs-tests This PR needs automated unit-tests.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[UX] Sales Invoice - Prompt on Payment Due Date
2 participants