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

After a "Go Back" in browser : Item Not Showing in Quick Entry of Batch Creation from Batch No. Field in Stock Entry Detail #35841

Closed
FHenry opened this issue Jun 22, 2023 · 17 comments · Fixed by #37096
Assignees
Labels

Comments

@FHenry
Copy link
Contributor

FHenry commented Jun 22, 2023

Information about bug

Create an Item with "Has Batch No"
Create a stock entry
click to create a Batch number, the first time the item is correctly fill.
Go back with your browser arrow to go on item page
retry , this time the Item field in quick Entry create batch is empty

2023-06-22.11-14-08.mp4

Module

stock

Version

Frappe and ERPNext version 13 and version 14

Installation method

None

Relevant log output / Stack trace / Full Error Message.

No response

@FHenry FHenry added the bug label Jun 22, 2023
@s-aga-r
Copy link
Contributor

s-aga-r commented Jun 27, 2023

@FHenry This should be resolved in #35743 (v14.27.9). Please update your instance and retry.

Closing this, re-open if not fixed after the update.

@s-aga-r s-aga-r closed this as completed Jun 27, 2023
@s-aga-r s-aga-r self-assigned this Jun 27, 2023
@FHenry
Copy link
Contributor Author

FHenry commented Jun 28, 2023

@s-aga-r When I open this issue you'r PR that's I've check was already merge, I git it a try with frappe v14.27.12 and the bug is still here.
The problem is more deeper than just a route, it happens only when you use "Previous page" from your browser, it's like in the deep JS (vue js, or other) the state is remove.

I already try to find where it come from, as this bug occurs at least since version-13. but when I find it can be related to awesomplete, I can't find more relevant information

I can't re-open the issue could you do it ?

@s-aga-r s-aga-r reopened this Jun 28, 2023
@s-aga-r
Copy link
Contributor

s-aga-r commented Jun 28, 2023

@FHenry If that's the case then this should also be happening with other doctypes. Could you try with other doctypes?

@FHenry
Copy link
Contributor Author

FHenry commented Jun 28, 2023

@s-aga-r you in mind other just frappe doctype (or in ERPNext,I don't knowotherDoctype exemple that work like that,that's can explain this bug is unknown) another that have this feature? A quick entry with a link on an element of the source doctype?

@FHenry
Copy link
Contributor Author

FHenry commented Jun 29, 2023

@s-aga-r I've made a sample app with simple feature like so Item Batch stuff
https://github.com/FHenry/erpnext_my_sample_project.git

And here it work even with the "Previous page" browser.

So I have to come from other part specifics of Batch Doctype of Stock entry Doctype I continue to dig

@FHenry
Copy link
Contributor Author

FHenry commented Jun 29, 2023

@s-aga-r

The fact is the "setup"(

) JS method of Stock Entry is not triggers after the previous page button so

let batch_field = frm.get_docfield('items', 'batch_no');

is executed and so

https://github.com/frappe/frappe/blob/74633305c154f0b3df3f50d5cb0f1b64415f1bf2/frappe/public/js/frappe/form/controls/link.js#L162

is not run

2023-06-29.13-19-26.mp4

@s-aga-r
Copy link
Contributor

s-aga-r commented Jun 30, 2023

@FHenry sending PR?

@FHenry
Copy link
Contributor Author

FHenry commented Jun 30, 2023

@s-aga-r I would like but I don't understand why setup JS is not launched the second time... If you find I'm curious

@s-aga-r
Copy link
Contributor

s-aga-r commented Sep 14, 2023

@s-aga-r I would like but I don't understand why setup JS is not launched the second time... If you find I'm curious

@FHenry setup didn't get run every time ig since the page got cached. Try moving the Items Batch set_query to refresh. If it works then raise a PR for version-14-hotfix as v15 has Serial and Batch Bundle.

Edit:
Fix this in FW otherwise, you will end up moving set_query to refresh.

FHenry added a commit to FHenry/erpnext that referenced this issue Sep 14, 2023
…f Batch Creation from Batch No. Field in Stock Entry Detail frappe#35841
FHenry added a commit to FHenry/erpnext that referenced this issue Sep 14, 2023
@FHenry
Copy link
Contributor Author

FHenry commented Sep 14, 2023

@s-aga-r Thank's for the hints. I've been able to apply your suggestion and it works.

Edit :
PS : What does it mean "FW" ?

@s-aga-r
Copy link
Contributor

s-aga-r commented Sep 14, 2023

@s-aga-r Thank's for the hints. I've been able to apply your suggestion and it works.

Edit : PS : What does it mean "FW" ?

FW => FrameWork => Frappe Framework

All the set queries are written in setup, what about others?

#35841 (comment), Fix this in FW otherwise, you will end up moving set_query to refresh.

@FHenry
Copy link
Contributor Author

FHenry commented Sep 14, 2023

Because others set_query do not make a get_route_options_for_new_doc

@FHenry
Copy link
Contributor Author

FHenry commented Sep 14, 2023

Other place in ERPNext where get_route_options_for_new_doc is called is in onload() event, so I think it was the only here where this bug can occurs (as I see read in the documentation onload() is executed each time not like setup())

@s-aga-r
Copy link
Contributor

s-aga-r commented Sep 14, 2023

Other place in ERPNext where get_route_options_for_new_doc is called is in onload() event, so I think it was the only here where this bug can occurs (as I see read in the documentation onload() is executed each time not like setup())

@FHenry then let's move all the get_route_options_for_new_doc to onload, and add commits in existing PRs.

ex. Asset Repair, Job Card, Transaction js etc.

@FHenry
Copy link
Contributor Author

FHenry commented Sep 14, 2023

For #37092 (version-14-hotfix)
project.js : already in onload() => OK
job_card.js : already in setup_quality_inspection: function(frm) call by refresh() => OK
transaction.js (1): KO, I've misscheck first time, it was in setup(), I've move them to onload() (and remove duplicate code) => OK with the PR
transaction.js (2): already in setup_quality_inspection: function(frm) call by refresh() => OK
subcontracting_receipt.js: already in refresh() => OK

Asset Repair ? Are you on branch version-14 ? No get_route_options_for_new_doc in erpnext/assets/doctype/asset_repair/asset_repair.js
Edit : Ok It is in develop

For #37096 (develop)
stock_entry.js : in setup_quality_inspection: function(frm) call by refresh() => OK
transaction.js (1): KO it was in setup, I've move them to onload() (and remove duplicate code) => OK with the PR
transcation.js (2): in setup_quality_inspection() call in refresh() => OK
asset_repair.js : KO it was in setup, I've move them to refresh() => OK with this PR
job_card.js (1) : KO it was in setup, I've move them to refresh() => OK with this PR
job_card.js (2) : already in setup_quality_inspection: function(frm) call by refresh()=> OK
quotation.js : KO it was in setup, I've move them to refresh() => OK with this PR
stock_reconciliation.js : already in onload() => OK
asset_capitalization.js : already in setup_queries() call by onload()
project.js : already in onload() => OK
installation_note.js : KO it was in setup, I've move them to onload() => OK with this PR
pick_list.js : KO it was in setup, I've move them to refresh() => OK with this PR
subcontracting_receipt.js: KO in in set_queries: in setup(), I've move frm.trigger('set_queries'); to refresh() => OK with this PR

@s-aga-r
Copy link
Contributor

s-aga-r commented Sep 15, 2023

@FHenry did some changes in #37096 and #37092, could you check once in your local?

@FHenry
Copy link
Contributor Author

FHenry commented Sep 15, 2023

I've check and it's ok

@s-aga-r s-aga-r closed this as completed Sep 16, 2023
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Jan 2, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants