Skip to content

Commit

Permalink
Merge pull request frappe#45040 from ruthra-kumar/use_idx_for_identif…
Browse files Browse the repository at this point in the history
…ying

refactor: use `idx` for identifying row
  • Loading branch information
ruthra-kumar authored Jan 2, 2025
2 parents 1f26fec + 51354c8 commit e609a6a
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion erpnext/controllers/tests/test_reactivity.py
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ def test_01_basic_item_details(self):
)
itm = si.append("items")
itm.item_code = self.item
si.process_item_selection(si.items[0].name)
si.process_item_selection(itm.idx)
self.assertEqual(itm.rate, 90)

df = qb.DocType("DocField")
Expand Down
2 changes: 1 addition & 1 deletion erpnext/public/js/controllers/transaction.js
Original file line number Diff line number Diff line change
Expand Up @@ -505,7 +505,7 @@ erpnext.TransactionController = class TransactionController extends erpnext.taxe
doc: doc,
method: "process_item_selection",
args: {
item: item.name
item_idx: item.idx
},
callback: function(r) {
if(!r.exc) {
Expand Down
4 changes: 2 additions & 2 deletions erpnext/utilities/transaction_base.py
Original file line number Diff line number Diff line change
Expand Up @@ -288,9 +288,9 @@ def fetch_item_details(self, item: dict) -> dict:
)

@frappe.whitelist()
def process_item_selection(self, item):
def process_item_selection(self, item_idx):
# Server side 'item' doc. Update this to reflect in UI
item_obj = self.get("items", {"name": item})[0]
item_obj = self.get("items", {"idx": item_idx})[0]

# 'item_details' has latest item related values
item_details = self.fetch_item_details(item_obj)
Expand Down

0 comments on commit e609a6a

Please sign in to comment.