Skip to content

Commit 48f5dca

Browse files
feat: new receipt for updated qnty logic
1 parent c7f4947 commit 48f5dca

File tree

1 file changed

+22
-0
lines changed

1 file changed

+22
-0
lines changed

d2h/public/js/purchase_receipt.js

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,26 @@
11
frappe.ui.form.on("Purchase Receipt", {
2+
refresh: function (frm) {
3+
frm.fields_dict["custom_item_duplicate"].grid.wrapper.on(
4+
"change",
5+
'input[data-fieldname="qty"]',
6+
function () {
7+
roles = frappe.user_roles;
8+
if (roles.includes("Store Dept") && !roles.includes("Administrator")) {
9+
frm.doc.custom_item_duplicate.map((item) => {
10+
frm.doc.items.map((new_item) => {
11+
if (new_item.item_code == item.item_code) {
12+
new_item.qty = item.qty;
13+
new_item.received_qty = item.qty;
14+
new_item.received_stock_qty = item.qty;
15+
new_item.stock_qty = item.qty;
16+
}
17+
});
18+
});
19+
frm.refresh_field("items");
20+
}
21+
}
22+
);
23+
},
224
onload: function (frm) {
325
if (
426
frappe.user_roles.includes("Store Dept") &&

0 commit comments

Comments
 (0)