feat: allow to edit Stock Quantity in the Sales and Purchase Transactions (#36600)
feat: allow to edit Stock Quantity in the Sales and Purchase transactions
This commit is contained in:
@@ -224,6 +224,14 @@ erpnext.TransactionController = class TransactionController extends erpnext.taxe
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
toggle_enable_for_stock_uom(field) {
|
||||
frappe.db.get_single_value('Stock Settings', field)
|
||||
.then(value => {
|
||||
this.frm.fields_dict["items"].grid.toggle_enable("stock_qty", value);
|
||||
});
|
||||
}
|
||||
|
||||
onload() {
|
||||
var me = this;
|
||||
|
||||
@@ -1191,6 +1199,16 @@ erpnext.TransactionController = class TransactionController extends erpnext.taxe
|
||||
]);
|
||||
}
|
||||
|
||||
stock_qty(doc, cdt, cdn) {
|
||||
let item = frappe.get_doc(cdt, cdn);
|
||||
item.conversion_factor = 1.0;
|
||||
if (item.stock_qty) {
|
||||
item.conversion_factor = flt(item.stock_qty) / flt(item.qty);
|
||||
}
|
||||
|
||||
refresh_field("conversion_factor", item.name, item.parentfield);
|
||||
}
|
||||
|
||||
calculate_stock_uom_rate(doc, cdt, cdn) {
|
||||
let item = frappe.get_doc(cdt, cdn);
|
||||
item.stock_uom_rate = flt(item.rate)/flt(item.conversion_factor);
|
||||
|
||||
Reference in New Issue
Block a user