Merge pull request #16964 from rohitwaghchaure/fix_cost_center_mapping_not_working
fix: Cost center from PO to PI is not mapping
This commit is contained in:
commit
f45db71ba2
@ -510,6 +510,15 @@ frappe.ui.form.on("Purchase Invoice", {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
frm.set_query("cost_center", function() {
|
||||||
|
return {
|
||||||
|
filters: {
|
||||||
|
company: frm.doc.company,
|
||||||
|
is_group: 0
|
||||||
|
}
|
||||||
|
};
|
||||||
|
});
|
||||||
},
|
},
|
||||||
|
|
||||||
onload: function(frm) {
|
onload: function(frm) {
|
||||||
|
@ -564,6 +564,15 @@ frappe.ui.form.on('Sales Invoice', {
|
|||||||
};
|
};
|
||||||
});
|
});
|
||||||
|
|
||||||
|
frm.set_query("cost_center", function() {
|
||||||
|
return {
|
||||||
|
filters: {
|
||||||
|
company: frm.doc.company,
|
||||||
|
is_group: 0
|
||||||
|
}
|
||||||
|
};
|
||||||
|
});
|
||||||
|
|
||||||
frm.custom_make_buttons = {
|
frm.custom_make_buttons = {
|
||||||
'Delivery Note': 'Delivery',
|
'Delivery Note': 'Delivery',
|
||||||
'Sales Invoice': 'Sales Return',
|
'Sales Invoice': 'Sales Return',
|
||||||
|
@ -388,9 +388,10 @@ def make_purchase_invoice(source_name, target_doc=None):
|
|||||||
|
|
||||||
item = get_item_defaults(target.item_code, source_parent.company)
|
item = get_item_defaults(target.item_code, source_parent.company)
|
||||||
item_group = get_item_group_defaults(target.item_code, source_parent.company)
|
item_group = get_item_group_defaults(target.item_code, source_parent.company)
|
||||||
target.cost_center = frappe.db.get_value("Project", obj.project, "cost_center") \
|
target.cost_center = (obj.cost_center
|
||||||
or item.get("buying_cost_center") \
|
or frappe.db.get_value("Project", obj.project, "cost_center")
|
||||||
or item_group.get("buying_cost_center")
|
or item.get("buying_cost_center")
|
||||||
|
or item_group.get("buying_cost_center"))
|
||||||
|
|
||||||
doc = get_mapped_doc("Purchase Order", source_name, {
|
doc = get_mapped_doc("Purchase Order", source_name, {
|
||||||
"Purchase Order": {
|
"Purchase Order": {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user