hns
3 years ago
5 changed files with 55 additions and 14 deletions
Binary file not shown.
@ -1,8 +1,19 @@ |
|||
// Copyright (c) 2021, Hard n Soft Technologies Pvt Ltd and contributors
|
|||
// For license information, please see license.txt
|
|||
|
|||
frappe.ui.form.on('System Mapping', { |
|||
// refresh: function(frm) {
|
|||
/*frappe.ui.form.on('System Mapping', { |
|||
validate: function(frm) { |
|||
frappe.call({ |
|||
method: "smart_service.transactions.doctype.system_mapping.system_mapping.update_mat", |
|||
args: { |
|||
"doc": cur_frm.doc.name, |
|||
"variant": cur_frm.doc.variant_mapping, |
|||
"kilometer": cur_frm.doc.kilometer_mapping |
|||
}, |
|||
callback:function(r){ |
|||
} |
|||
}); |
|||
|
|||
// }
|
|||
}); |
|||
|
|||
} |
|||
});*/ |
|||
|
@ -1,8 +1,16 @@ |
|||
# Copyright (c) 2021, Hard n Soft Technologies Pvt Ltd and contributors |
|||
# For license information, please see license.txt |
|||
|
|||
# import frappe |
|||
import frappe |
|||
from frappe.model.document import Document |
|||
|
|||
class SystemMapping(Document): |
|||
def validate(self): |
|||
pass |
|||
@frappe.whitelist() |
|||
def update_mat(doc,variant,kilometer): |
|||
self = frappe.get_doc("System Mapping",str(doc)) |
|||
for item in self.get("system_sub_systems"): |
|||
km = frappe.db.sql("""update `tabKilometer Mapping_Items` as km, `tabKilometer Mapping` as kmm set km.mat = %s where km.parent = %s |
|||
and km.sub_systems = %s and kmm.variant_mapping = %s |
|||
""",(item.mat,str(kilometer),item.sub_systems,self.variant_mapping),as_dict=True) |
|||
|
Loading…
Reference in new issue