From 23942701f11fedb131310fa7e94cf465459c1adf Mon Sep 17 00:00:00 2001 From: Rohit Waghchaure Date: Wed, 16 May 2018 15:41:00 +0530 Subject: [PATCH] [Fix] 'PurchaseInvoiceItem' object has no attribute 'company' --- erpnext/buying/doctype/purchase_order/purchase_order.py | 2 +- erpnext/selling/doctype/sales_order/sales_order.py | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/erpnext/buying/doctype/purchase_order/purchase_order.py b/erpnext/buying/doctype/purchase_order/purchase_order.py index 846c5b491b..26864933ad 100644 --- a/erpnext/buying/doctype/purchase_order/purchase_order.py +++ b/erpnext/buying/doctype/purchase_order/purchase_order.py @@ -375,7 +375,7 @@ def make_purchase_invoice(source_name, target_doc=None): target.base_amount = target.amount * flt(source_parent.conversion_rate) target.qty = target.amount / flt(obj.rate) if (flt(obj.rate) and flt(obj.billed_amt)) else flt(obj.qty) - item = get_item_defaults(target.item_code, target.company) + item = get_item_defaults(target.item_code, source_parent.company) target.cost_center = frappe.db.get_value("Project", obj.project, "cost_center") \ or item.buying_cost_center \ or frappe.db.get_value("Item Group", item.item_group, "default_cost_center") diff --git a/erpnext/selling/doctype/sales_order/sales_order.py b/erpnext/selling/doctype/sales_order/sales_order.py index 5116725439..690ffa858f 100755 --- a/erpnext/selling/doctype/sales_order/sales_order.py +++ b/erpnext/selling/doctype/sales_order/sales_order.py @@ -495,7 +495,7 @@ def make_delivery_note(source_name, target_doc=None): target.amount = (flt(source.qty) - flt(source.delivered_qty)) * flt(source.rate) target.qty = flt(source.qty) - flt(source.delivered_qty) - item = get_item_defaults(target.item_code, target.company) + item = get_item_defaults(target.item_code, source_parent.company) if item: target.cost_center = frappe.db.get_value("Project", source_parent.project, "cost_center") \ @@ -559,7 +559,7 @@ def make_sales_invoice(source_name, target_doc=None, ignore_permissions=False): if source_parent.project: target.cost_center = frappe.db.get_value("Project", source_parent.project, "cost_center") if not target.cost_center and target.item_code: - item = get_item_defaults(target.item_code, target.company) + item = get_item_defaults(target.item_code, source_parent.company) target.cost_center = item.selling_cost_center \ or frappe.db.get_value("Item Group", item.item_group, "default_cost_center")