From b7b3944ceff2e7fddbe350d6d7fa56968de2b769 Mon Sep 17 00:00:00 2001 From: Deepesh Garg Date: Sun, 27 Dec 2020 19:45:27 +0530 Subject: [PATCH] fix: Internal sales item link in Purchase Invoice --- .../accounts/doctype/sales_invoice/sales_invoice.py | 11 ++++------- erpnext/controllers/buying_controller.py | 2 +- 2 files changed, 5 insertions(+), 8 deletions(-) diff --git a/erpnext/accounts/doctype/sales_invoice/sales_invoice.py b/erpnext/accounts/doctype/sales_invoice/sales_invoice.py index 5b1d5e1de7c..c0fe57336e1 100644 --- a/erpnext/accounts/doctype/sales_invoice/sales_invoice.py +++ b/erpnext/accounts/doctype/sales_invoice/sales_invoice.py @@ -1630,15 +1630,12 @@ def make_inter_company_transaction(doctype, source_name, target_doc=None): } if source_doc.get('update_stock'): - item_field_map.update({ - 'field_map': { - source_document_warehouse_field: target_document_warehouse_field, - 'batch_no': 'batch_no', - 'serial_no': 'serial_no', - } + item_field_map["field_map"].update({ + source_document_warehouse_field: target_document_warehouse_field, + 'batch_no': 'batch_no', + 'serial_no': 'serial_no' }) - doclist = get_mapped_doc(doctype, source_name, { doctype: { "doctype": target_doctype, diff --git a/erpnext/controllers/buying_controller.py b/erpnext/controllers/buying_controller.py index 296928974a0..d444c739089 100644 --- a/erpnext/controllers/buying_controller.py +++ b/erpnext/controllers/buying_controller.py @@ -229,7 +229,7 @@ class BuyingController(StockController): if not cint(self.get("is_return")) and d.get("from_warehouse"): # Get outgoing rate based on original item cost based on valuation method - if not d.get('sales_invoice_item'): + if not d.get(frappe.scrub(ref_doctype)): outgoing_rate = get_incoming_rate({ "item_code": d.item_code, "warehouse": d.from_warehouse,