Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 1 addition & 2 deletions aumms/aumms/doctype/aumms_item/aumms_item.json
Original file line number Diff line number Diff line change
Expand Up @@ -369,7 +369,7 @@
],
"index_web_pages_for_search": 1,
"links": [],
"modified": "2024-11-05 12:06:59.188117",
"modified": "2025-03-19 13:09:02.575621",
"modified_by": "Administrator",
"module": "AuMMS",
"name": "AuMMS Item",
Expand Down Expand Up @@ -413,7 +413,6 @@
"write": 1
}
],
"quick_entry": 1,
"sort_field": "modified",
"sort_order": "DESC",
"states": [],
Expand Down
23 changes: 19 additions & 4 deletions aumms/aumms/doctype/jewellery_receipt/jewellery_receipt.js
Original file line number Diff line number Diff line change
Expand Up @@ -130,11 +130,8 @@ frappe.ui.form.on("Jewellery Receipt", {
console.log("here1");
console.log(cur_items_len);
console.log(quantity);


for (var i = cur_items_len; i < quantity; i++) {
console.log("loop");

frm.add_child("item_details", {
item_category: frm.doc.item_category,
item_type: frm.doc.item_type,
Expand All @@ -146,7 +143,7 @@ frappe.ui.form.on("Jewellery Receipt", {
frm.refresh_fields()
}
});

}

frm.refresh_field("item_details");
Expand Down Expand Up @@ -465,6 +462,24 @@ frappe.ui.form.on("Item Wise Stone Details", {
}
});

frappe.ui.form.on("Jewellery Receipt", {
refresh: function (frm) {
frm.doc.item_details?.forEach(row => frm.events.set_stone_fields_mandatory(frm, row));
},
set_stone_fields_mandatory: function (frm, row) {
["stone", "stone_uom", "stone_weight", "rate"].forEach(field =>
frm.fields_dict["item_details"].grid.update_docfield_property(field, "reqd", row.has_stone)
);
frm.refresh_field("item_details");
}
});

frappe.ui.form.on("Jewellery Item Receipt", {
has_stone: function (frm, cdt, cdn) {
frm.events.set_stone_fields_mandatory(frm, locals[cdt][cdn]);
}
});

function update_stone_weight_and_charge(frm) {
frm.doc.item_details.forEach((item) => {
item.stone_weight_gold_weight_uom = 0;
Expand Down
Loading