-
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: Add return against indexes for POS Invoice #32378
fix: Add return against indexes for POS Invoice #32378
Conversation
@Mergifyio backport version-14-hotfix version-13-hotfix |
🟠 Waiting for conditions to match
|
|
||
|
||
def on_doctype_update(): | ||
frappe.db.add_index("POS Invoice", ["customer", "is_return", "return_against"]) |
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.
Just a simple return against index should be enough. It has high enough cardinality ~= unique return.
That can be managed from doctype directly 👀
Codecov Report
Additional details and impacted files@@ Coverage Diff @@
## develop #32378 +/- ##
===========================================
+ Coverage 63.94% 64.11% +0.16%
===========================================
Files 817 817
Lines 58159 58171 +12
===========================================
+ Hits 37190 37295 +105
+ Misses 20969 20876 -93
|
@Mergifyio backport version-14-hotfix version-13-hotfix |
✅ Backports have been created
|
…-32378 fix: Add return against indexes for POS Invoice (backport #32378)
…-32378 fix: Add return against indexes for POS Invoice (backport #32378)
set_status
is called twice while creating a POS Invoice, once onvalidate
and once onsubmit
. Theset_status
method inpos_invoice.py
(similar to sales invoice) has an if block which check for return invoices to set the status as "Credit Note Issued"The very same query in POS Invoice took around ~5 sec (depending on the no of existing POS Invoices) for a specific site. Post adding the index the POS invoice submission took 3 seconds instead of 13 seconds
Also showed up in slow query logs
