Merge pull request #2344 from nabinhait/fix1
cost center based on project
This commit is contained in:
commit
fbb994c731
@ -587,16 +587,18 @@ erpnext.selling.SellingController = erpnext.TransactionController.extend({
|
|||||||
});
|
});
|
||||||
|
|
||||||
frappe.ui.form.on(cur_frm.doctype,"project_name", function(frm) {
|
frappe.ui.form.on(cur_frm.doctype,"project_name", function(frm) {
|
||||||
frappe.call({
|
if(in_list(["Delivery Note", "Sales Invoice"], frm.doc.doctype)) {
|
||||||
method:'erpnext.projects.doctype.project.project.get_cost_center_name' ,
|
frappe.call({
|
||||||
args: { project_name: frm.doc.project_name },
|
method:'erpnext.projects.doctype.project.project.get_cost_center_name' ,
|
||||||
callback: function(r, rt) {
|
args: { project_name: frm.doc.project_name },
|
||||||
if(!r.exc) {
|
callback: function(r, rt) {
|
||||||
$.each(frm.doc[cur_frm.cscript.fname] || [], function(i, row) {
|
if(!r.exc) {
|
||||||
frappe.model.set_value(row.doctype, row.name, "cost_center", r.message);
|
$.each(frm.doc[cur_frm.cscript.fname] || [], function(i, row) {
|
||||||
msgprint(__("Cost Center For Item with Item Code '"+row.item_name+"' has been Changed to "+ r.message));
|
frappe.model.set_value(row.doctype, row.name, "cost_center", r.message);
|
||||||
})
|
msgprint(__("Cost Center For Item with Item Code '"+row.item_name+"' has been Changed to "+ r.message));
|
||||||
|
})
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
})
|
||||||
})
|
}
|
||||||
})
|
})
|
||||||
|
@ -52,6 +52,8 @@ class Address(Document):
|
|||||||
|
|
||||||
@frappe.whitelist()
|
@frappe.whitelist()
|
||||||
def get_address_display(address_dict):
|
def get_address_display(address_dict):
|
||||||
|
if not address_dict:
|
||||||
|
return
|
||||||
if not isinstance(address_dict, dict):
|
if not isinstance(address_dict, dict):
|
||||||
address_dict = frappe.db.get_value("Address", address_dict, "*", as_dict=True) or {}
|
address_dict = frappe.db.get_value("Address", address_dict, "*", as_dict=True) or {}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user