-
Notifications
You must be signed in to change notification settings - Fork 7.9k
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: cost of poor quality report time filters not working #28958
fix: cost of poor quality report time filters not working #28958
Conversation
erpnext/manufacturing/report/cost_of_poor_quality_report/cost_of_poor_quality_report.py
Outdated
Show resolved
Hide resolved
Codecov Report
@@ Coverage Diff @@
## develop #28958 +/- ##
===========================================
+ Coverage 55.64% 55.73% +0.09%
===========================================
Files 1128 1131 +3
Lines 67335 67589 +254
===========================================
+ Hits 37467 37674 +207
- Misses 29868 29915 +47
|
4158435
to
3107e4d
Compare
report not usable right now on edit: fixed via frappe/frappe#15454 |
)) | ||
) | ||
query = append_filters(report_filters,operations,query,job_card) | ||
data = query.run() |
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.
the previous function was returning a list of dicts. this is list of tuples. 🤔
erpnext/manufacturing/report/cost_of_poor_quality_report/cost_of_poor_quality_report.py
Outdated
Show resolved
Hide resolved
erpnext/manufacturing/report/cost_of_poor_quality_report/cost_of_poor_quality_report.py
Outdated
Show resolved
Hide resolved
erpnext/manufacturing/report/cost_of_poor_quality_report/cost_of_poor_quality_report.py
Outdated
Show resolved
Hide resolved
.select(job_card_time_log.parent) | ||
.where(job_card_time_log.parent == job_card.name) | ||
.where(job_card_time_log.from_time >= report_filters.get('from_date','')) | ||
.where(job_card_time_log.to_time <= report_filters.get('to_date','')) |
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.
if comparing an empty string like x <= ''
nothing will show up I think? 🤔
These time filters should be conditionally chained like other filters.
job_card.serial_no, job_card.batch_no, job_card.workstation, job_card.total_time_in_mins, job_card.hour_rate, | ||
operatingcost) | ||
.where(job_card.docstatus==1) | ||
.where(job_card.is_corrective_job_card==1) |
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.
- This condition should also be added in the subquery for faster filtering.
- Sub-query should only be required when from/to time is specified.
- optionally apply date filters - join instead of expensive sub-query - return as dictionary
* fix: cost of poor quality report time filters not working * chore:update cost of poor quality report to use query builder * fix: linter warnings * chore: updated report query * chore: added test filters * fix : cleared linter warnings * chore: formatting * refactor: query generation - optionally apply date filters - join instead of expensive sub-query - return as dictionary * test: simplify test Co-authored-by: Ankush Menat <ankush@frappe.io> (cherry picked from commit 0f7c2a1)
…29521) * fix: cost of poor quality report time filters not working * chore:update cost of poor quality report to use query builder * fix: linter warnings * chore: updated report query * chore: added test filters * fix : cleared linter warnings * chore: formatting * refactor: query generation - optionally apply date filters - join instead of expensive sub-query - return as dictionary * test: simplify test Co-authored-by: Ankush Menat <ankush@frappe.io> (cherry picked from commit 0f7c2a1) Co-authored-by: aaronmenezes <ron2805@gmail.com>
…) (frappe#29521) * fix: cost of poor quality report time filters not working * chore:update cost of poor quality report to use query builder * fix: linter warnings * chore: updated report query * chore: added test filters * fix : cleared linter warnings * chore: formatting * refactor: query generation - optionally apply date filters - join instead of expensive sub-query - return as dictionary * test: simplify test Co-authored-by: Ankush Menat <ankush@frappe.io> (cherry picked from commit 0f7c2a1) Co-authored-by: aaronmenezes <ron2805@gmail.com>
Issue :
In the Cost of Poor Quality report, Time and date filter had no effect on the report.
Fix:
Update report query to fix this incorrect behavior.