Skip to content

Commit

Permalink
Merge pull request #218 from efeone/aumms_007
Browse files Browse the repository at this point in the history
feat : Calculate the amount in child table purchase item details
  • Loading branch information
Jumana-K authored Feb 16, 2024
2 parents 1089aa8 + 13f65bc commit 519d9a1
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,8 @@
"fieldname": "amount",
"fieldtype": "Float",
"in_list_view": 1,
"label": "Amount"
"label": "Amount",
"read_only": 1
},
{
"fieldname": "column_break_juco",
Expand All @@ -55,6 +56,7 @@
"read_only": 1
},
{
"depends_on": "eval:doc.stone",
"fieldname": "stone_weight",
"fieldtype": "Float",
"in_list_view": 1,
Expand Down Expand Up @@ -91,7 +93,7 @@
"index_web_pages_for_search": 1,
"istable": 1,
"links": [],
"modified": "2024-02-16 15:04:13.555094",
"modified": "2024-02-16 15:46:24.566785",
"modified_by": "Administrator",
"module": "AuMMS",
"name": "Purchase Item Details",
Expand Down
20 changes: 14 additions & 6 deletions aumms/aumms/doctype/purchase_tool/purchase_tool.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,7 @@
// For license information, please see license.txt

frappe.ui.form.on("Purchase Tool", {

// refresh : function(frm){}

// refresh: function(frm) {}
});

frappe.ui.form.on("Purchase Item Details", {
Expand All @@ -22,9 +20,19 @@ frappe.ui.form.on("Purchase Item Details", {
}
},
gold_weight: function(frm, cdt, cdn) {
let d = locals[cdt][cdn];
if (!frm.doc.has_stone) {
let net_weight = d.gold_weight;
frappe.model.set_value(cdt, cdn, 'net_weight', net_weight);
let amount = d.gold_weight * frm.doc.board_rate;
frappe.model.set_value(cdt, cdn, 'amount', amount);
}
},
stone_charge: function(frm, cdt, cdn) {
let d = locals[cdt][cdn];
if (!frm.doc.has_stone) {
frappe.model.set_value(cdt, cdn, 'net_weight', d.gold_weight);
if (frm.doc.has_stone) {
let amount = (d.gold_weight * frm.doc.board_rate) + (d.stone_charge);
frappe.model.set_value(cdt, cdn, 'amount', amount);
}
},
}
});

0 comments on commit 519d9a1

Please sign in to comment.