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: move item_code reactivity to server-side #44293

Merged
merged 17 commits into from
Dec 10, 2024

Conversation

ruthra-kumar
Copy link
Member

@ruthra-kumar ruthra-kumar commented Nov 22, 2024

Context

Selecting an Item is the most common action in Sales / Purchase cycle. Whenever an Item is selected, system fetches the basic details like rate, discounts, stock qty, warehouse and sales account as such and auto-fills these details in it's respective fields. This behavior can simply be called as Reactivity.

It is achieved by a JS trigger on item_code located in transaction.js

item_code(doc, cdt, cdn) {

But, due to a lack of UI test cases, this Reactivity is prone to regression, especially the ones related to discounts and free items. Check #42195 were the broken scenarios are individually identified.

Long-Term Stability and Maintenance

To prevent frequent regression, we've decided to move most of the Reactivity to the server-side, as it allows for server-side tests and a single source to maintain.

This PR is the first in that direction. It moves all of the UI Reactivity associated with Item selection server-side.

Impacts

Purchase Invoice      
POS Invoice           
Sales Invoice         
Purchase Order        
Request for Quotation 
Supplier Quotation    
Quotation             
Sales Order           
Purchase Receipt

@ruthra-kumar ruthra-kumar self-assigned this Nov 22, 2024
@github-actions github-actions bot added the needs-tests This PR needs automated unit-tests. label Nov 22, 2024
@ruthra-kumar ruthra-kumar force-pushed the refactor_transaction_js branch 2 times, most recently from 0687dca to c9c1be1 Compare November 29, 2024 09:16
@ruthra-kumar ruthra-kumar changed the title refactor: moving trigger to server refactor: move item_code reactivity to server-side Nov 29, 2024
@ruthra-kumar ruthra-kumar force-pushed the refactor_transaction_js branch 2 times, most recently from f702352 to 263c482 Compare December 6, 2024 12:02
@ruthra-kumar ruthra-kumar removed dont-merge needs-tests This PR needs automated unit-tests. Breaking Changes labels Dec 10, 2024
@ruthra-kumar ruthra-kumar marked this pull request as ready for review December 10, 2024 09:17
@ruthra-kumar ruthra-kumar force-pushed the refactor_transaction_js branch from e4159ea to 6a26620 Compare December 10, 2024 10:37
@ruthra-kumar ruthra-kumar force-pushed the refactor_transaction_js branch from 6a26620 to 1467610 Compare December 10, 2024 12:18
@ruthra-kumar ruthra-kumar requested review from rohitwaghchaure and removed request for rohitwaghchaure December 10, 2024 14:35
@ruthra-kumar ruthra-kumar merged commit a7d9642 into frappe:develop Dec 10, 2024
18 checks passed
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