feat: allow editing item name in cart for single invoice#51
feat: allow editing item name in cart for single invoice#51aperebaskine wants to merge 3 commits intoBrainWise-DEV:developfrom
Conversation
|
Added a new commit: item code is now displayed below the item name in the edit dialog |
|
Potential improvement: validate server-side that item name in the form data matches the item name in the database when "Allow Custom Item Name in Cart" is disabled. I'm not seeing any currently implemented logic that already validates item names in form so I'm not sure if this is necessary. |
|
Thanks I will start reviewing this code. |
IMO this make no sense, because in case od disable this new option item_name on form will always match the item_name in Item doctype since it is fetched from there. Maybe I am missing something |
|
@git-avc even when the option is disabled, item_name is sent by client so in theory it would be possible to construct and send manual API calls (bypassing the front-end) with modified item names. The question is whether it's necessary to prevent that or not. I'm assuming this was deemed unnecessary since there's no validation to begin with but thought it was worth mentioning. |
|
My Concern about this PR what will prevent the Casher to sell a higher rate item with Lower rate by just changing the names. e.g. IPhone 13 can be Sold as IPhone 17 by just renaming. |
|
Hy @engahmed1190 @aperebaskine Purpose of this is let people use POS system without all the items created ... Imagine a printing services shop. We have some items/services created (A4 color print, A4 BW print, ...) but need to specify on the item name something related to the job (ADS PROTOTYPE, CAMPAIGN SAMPLE ...). Maybe we can configure 1 item group for that ... We can consider too add a custom field to Item Doctype (something like "Let change item name on POS") |
|
Your concern is valid, here are possible steps we could take to solve this problem:
This would have to be implemented in Desk, removing the toggle inside the settings menu of the front-end. |
This seems good plan |
|
Once it ready let me know |
d07a81f to
7a93b16
Compare
1096eaf to
0a1ee31
Compare
|
@engahmed1190 I've finished making the changes. Now, to use item name customization, it must be enabled in Desk in both POS Settings and Item DocType. For POS Settings, I've added a Table MultiSelect to select the users that can use the feature, but I noticed that POS Profile already maintains a list of users for said POS so this may be redundant. Let me know what you think.
In the UI, the name will only be editable if the feature is enabled in both POS Settings and Item DocType and if the currently logged in user is in the list of allowed user in POS Settings. I've also added server-side validation for the item names in update_invoice endpoint. For now, I've made it so item code is always displayed in the edit dialog. Let me know if you want changes on that. |
|
Thanks @aperebaskine for the update — I’ve tested the implementation and it’s working as expected 👍 I have a few enhancement suggestions that would improve scalability, clarity, and UX. Please consider the following points: 1. Role-Based Control Instead of User-BasedRather than enabling item name editing at the individual user level, it would be more scalable and maintainable to control this via user roles.
2. UI Structure ImprovementThe current standalone section for Item Name Customization could be merged into a more relevant or existing section.
3. Minor: Function Return Type ClarityThe function
4. Potential Edge Case: Whitespace-Only Item NamesThe Suggestion:
5. UX Enhancement: Controlled Edit ModeTo prevent accidental edits:
This provides better control and a clearer user interaction flow. |
|
Please rebase and fix the conflicts. Thanks .. |


Description
This PR allows users to modify an item's name in the cart, for the corresponding invoice only. This is useful as some small businesses do not register an entry for every single of their SKUs on sale, opting instead use a more general item entry and specify a name on a per-invoice basis.
This does not update the item's original name nor does it allow the user to tamper with the item code (the actual identifier for the SKU in the database).
This is an updated version of PR #27, which may be closed following the merging of this one.
Implementation details
As requested in PR #27, a check field in POS Settings has been added to toggle this feature.
If the feature is enabled, within the item edit dialog, the item name is replaced with an input field. A function is added to restore the original name from cache, which can be triggered manually via a button in the UI, or automatically on blur if the field is empty.
To improve UX with this feature enabled, item code is now also displayed below the editable item name.