From eb7eb43dfce3b9f78934d496e5654b9b6282ef14 Mon Sep 17 00:00:00 2001 From: Rohit Waghchaure Date: Tue, 27 Jun 2017 17:34:44 +0530 Subject: [PATCH] [fix] Billed Amt does not get updated in Purchase Receipt, if Invoice exists and item has been returned once before --- erpnext/buying/doctype/purchase_order/purchase_order.py | 3 +++ erpnext/stock/doctype/purchase_receipt/purchase_receipt.py | 3 ++- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/erpnext/buying/doctype/purchase_order/purchase_order.py b/erpnext/buying/doctype/purchase_order/purchase_order.py index b3bbb92e73..7e5020a08d 100644 --- a/erpnext/buying/doctype/purchase_order/purchase_order.py +++ b/erpnext/buying/doctype/purchase_order/purchase_order.py @@ -270,6 +270,9 @@ def make_purchase_receipt(source_name, target_doc=None): doc = get_mapped_doc("Purchase Order", source_name, { "Purchase Order": { "doctype": "Purchase Receipt", + "field_map": { + "per_billed": "per_billed" + }, "validation": { "docstatus": ["=", 1], } diff --git a/erpnext/stock/doctype/purchase_receipt/purchase_receipt.py b/erpnext/stock/doctype/purchase_receipt/purchase_receipt.py index 647eb67a45..f60eb6aa7c 100644 --- a/erpnext/stock/doctype/purchase_receipt/purchase_receipt.py +++ b/erpnext/stock/doctype/purchase_receipt/purchase_receipt.py @@ -119,7 +119,8 @@ class PurchaseReceipt(BuyingController): frappe.db.set(self, 'status', 'Submitted') self.update_prevdoc_status() - self.update_billing_status() + if self.per_billed < 100: + self.update_billing_status() if not self.is_return: update_last_purchase_rate(self, 1)