Merge pull request #11397 from rohitwaghchaure/delivery_note_issue_from_so

[Fix] Getting an error while making delivery note from sales order and sales order has no item code
This commit is contained in:
Saurabh 2017-11-02 12:06:08 +05:30 committed by GitHub
commit afb63af3b6
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -477,9 +477,11 @@ def make_delivery_note(source_name, target_doc=None):
target.qty = flt(source.qty) - flt(source.delivered_qty)
item = frappe.db.get_value("Item", target.item_code, ["item_group", "selling_cost_center"], as_dict=1)
target.cost_center = frappe.db.get_value("Project", source_parent.project, "cost_center") \
or item.selling_cost_center \
or frappe.db.get_value("Item Group", item.item_group, "default_cost_center")
if item:
target.cost_center = frappe.db.get_value("Project", source_parent.project, "cost_center") \
or item.selling_cost_center \
or frappe.db.get_value("Item Group", item.item_group, "default_cost_center")
target_doc = get_mapped_doc("Sales Order", source_name, {
"Sales Order": {