write this in custom script.
Custom Script
cur_frm.cscript.docs_required = function(doc, cdt, cdn) {
cur_frm.call({
"method": 'ef_fruits.ef_doc.ef_doc.apply_documents_requiredd',
"args": {
"docs_required": doc.docs_required,
},
callback: function(r) {
if(!r.exc) {
}
}
})
};
python function in custom app.
@frappe.whitelist()
def apply_documents_required(docs_required):
if self.documents_required_master:
shipping_rule = frappe.get_doc("Documents Required Master", self.documents_required_master)
frappe.msgprint("Hi @3")
for condition in shipping_rule.get("documents_required_master"):
doc_req = {
"doctype": "Documents Required",
"name_of_document": condition.name_of_document,
"dispatch_address": condition.dispatch_address
}
frappe.msgprint(condition.name_of_document)
frappe.msgprint(condition.dispatch_address)
python function to append data in dict object.
@frappe.whitelist(allow_guest=True)
def apply_documents_required(self, method):
doc_req = []
if not self.documents_required and self.documents_required_master:
doc_master = frappe.get_doc("Documents Required Master", self.documents_required_master)
for value in doc_master.get("documents_required_master"):
doc_req = {
"doctype": "Documents Required",
"name_of_document": value.name_of_document,
"dispatch_address": value.dispatch_address,
"number_of_copies": value.number_of_copies
}
self.append("documents_required", doc_req)
Note:
Above code will display of document name and document address.
You can return value from python function and set it into custom script.
I will write more on this later
Custom Script
cur_frm.cscript.docs_required = function(doc, cdt, cdn) {
cur_frm.call({
"method": 'ef_fruits.ef_doc.ef_doc.apply_documents_requiredd',
"args": {
"docs_required": doc.docs_required,
},
callback: function(r) {
if(!r.exc) {
}
}
})
};
python function in custom app.
@frappe.whitelist()
def apply_documents_required(docs_required):
if self.documents_required_master:
shipping_rule = frappe.get_doc("Documents Required Master", self.documents_required_master)
frappe.msgprint("Hi @3")
for condition in shipping_rule.get("documents_required_master"):
doc_req = {
"doctype": "Documents Required",
"name_of_document": condition.name_of_document,
"dispatch_address": condition.dispatch_address
}
frappe.msgprint(condition.name_of_document)
frappe.msgprint(condition.dispatch_address)
python function to append data in dict object.
@frappe.whitelist(allow_guest=True)
def apply_documents_required(self, method):
doc_req = []
if not self.documents_required and self.documents_required_master:
doc_master = frappe.get_doc("Documents Required Master", self.documents_required_master)
for value in doc_master.get("documents_required_master"):
doc_req = {
"doctype": "Documents Required",
"name_of_document": value.name_of_document,
"dispatch_address": value.dispatch_address,
"number_of_copies": value.number_of_copies
}
self.append("documents_required", doc_req)
Note:
Above code will display of document name and document address.
You can return value from python function and set it into custom script.
I will write more on this later