fix(Asset Repair): Compute total_value instantly
This commit is contained in:
parent
e921878633
commit
ad78888c86
@ -35,6 +35,13 @@ frappe.ui.form.on('Asset Repair', {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
frappe.ui.form.on('Asset Repair Consumed Item', {
|
||||||
|
consumed_quantity: function(frm, cdt, cdn) {
|
||||||
|
var row = locals[cdt][cdn];
|
||||||
|
frappe.model.set_value(cdt, cdn, 'total_value', row.consumed_quantity * row.valuation_rate);
|
||||||
|
},
|
||||||
|
});
|
||||||
|
|
||||||
cur_frm.fields_dict.cost_center.get_query = function(doc) {
|
cur_frm.fields_dict.cost_center.get_query = function(doc) {
|
||||||
return {
|
return {
|
||||||
filters: {
|
filters: {
|
||||||
|
|||||||
@ -14,8 +14,6 @@ class AssetRepair(AccountsController):
|
|||||||
def validate(self):
|
def validate(self):
|
||||||
self.asset_doc = frappe.get_doc('Asset', self.asset)
|
self.asset_doc = frappe.get_doc('Asset', self.asset)
|
||||||
self.update_status()
|
self.update_status()
|
||||||
if self.get('stock_items'):
|
|
||||||
self.set_total_value() # change later
|
|
||||||
self.calculate_total_repair_cost()
|
self.calculate_total_repair_cost()
|
||||||
|
|
||||||
def update_status(self):
|
def update_status(self):
|
||||||
@ -24,10 +22,6 @@ class AssetRepair(AccountsController):
|
|||||||
else:
|
else:
|
||||||
self.asset_doc.set_status()
|
self.asset_doc.set_status()
|
||||||
|
|
||||||
def set_total_value(self):
|
|
||||||
for item in self.get('stock_items'):
|
|
||||||
item.total_value = flt(item.valuation_rate) * flt(item.consumed_quantity)
|
|
||||||
|
|
||||||
def calculate_total_repair_cost(self):
|
def calculate_total_repair_cost(self):
|
||||||
self.total_repair_cost = self.repair_cost
|
self.total_repair_cost = self.repair_cost
|
||||||
if self.get('stock_items'):
|
if self.get('stock_items'):
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user