From fa65c7bf29deba0c091b0488f640f325e90569c1 Mon Sep 17 00:00:00 2001 From: Anand Doshi Date: Wed, 26 Aug 2015 19:14:16 +0530 Subject: [PATCH] [minor] stopped or cancelled message --- erpnext/controllers/stock_controller.py | 15 ++++++++------- .../doctype/material_request/material_request.py | 3 ++- .../doctype/purchase_receipt/purchase_receipt.py | 3 ++- 3 files changed, 12 insertions(+), 9 deletions(-) diff --git a/erpnext/controllers/stock_controller.py b/erpnext/controllers/stock_controller.py index 396d088a53..19b5a9b403 100644 --- a/erpnext/controllers/stock_controller.py +++ b/erpnext/controllers/stock_controller.py @@ -227,7 +227,7 @@ class StockController(AccountsController): incoming_rate = incoming_rate[0][0] if incoming_rate else 0.0 return incoming_rate - + def update_reserved_qty(self): so_map = {} for d in self.get("items"): @@ -242,22 +242,23 @@ class StockController(AccountsController): sales_order = frappe.get_doc("Sales Order", so) if sales_order.status in ["Stopped", "Cancelled"]: - frappe.throw(_("Sales Order {0} is cancelled or stopped").format(so), frappe.InvalidStatusError) - + frappe.throw(_("{0} {1} is cancelled or stopped").format(_("Sales Order"), so), + frappe.InvalidStatusError) + sales_order.update_reserved_qty(so_item_rows) - + def update_stock_ledger(self): self.update_reserved_qty() - + sl_entries = [] for d in self.get_item_list(): if frappe.db.get_value("Item", d.item_code, "is_stock_item") == 1 \ and d.warehouse and flt(d['qty']): - + incoming_rate = 0 if cint(self.is_return) and self.return_against and self.docstatus==1: incoming_rate = self.get_incoming_rate_for_sales_return(d.item_code, self.return_against) - + sl_entries.append(self.get_sl_entries(d, { "actual_qty": -1*flt(d['qty']), "stock_uom": frappe.db.get_value("Item", d.item_code, "stock_uom"), diff --git a/erpnext/stock/doctype/material_request/material_request.py b/erpnext/stock/doctype/material_request/material_request.py index e4183669bf..38238c7ded 100644 --- a/erpnext/stock/doctype/material_request/material_request.py +++ b/erpnext/stock/doctype/material_request/material_request.py @@ -162,7 +162,8 @@ def update_completed_and_requested_qty(stock_entry, method): mr_obj = frappe.get_doc("Material Request", mr) if mr_obj.status in ["Stopped", "Cancelled"]: - frappe.throw(_("Material Request {0} is cancelled or stopped").format(mr), frappe.InvalidStatusError) + frappe.throw(_("{0} {1} is cancelled or stopped").format(_("Material Request"), mr), + frappe.InvalidStatusError) mr_obj.update_completed_qty(mr_item_rows) mr_obj.update_requested_qty(mr_item_rows) diff --git a/erpnext/stock/doctype/purchase_receipt/purchase_receipt.py b/erpnext/stock/doctype/purchase_receipt/purchase_receipt.py index 58f165c040..1ab866c773 100644 --- a/erpnext/stock/doctype/purchase_receipt/purchase_receipt.py +++ b/erpnext/stock/doctype/purchase_receipt/purchase_receipt.py @@ -183,7 +183,8 @@ class PurchaseReceipt(BuyingController): po_obj = frappe.get_doc("Purchase Order", po) if po_obj.status in ["Stopped", "Cancelled"]: - frappe.throw(_("Material Request {0} is cancelled or stopped").format(po), frappe.InvalidStatusError) + frappe.throw(_("{0} {1} is cancelled or stopped").format(_("Purchase Order"), po), + frappe.InvalidStatusError) po_obj.update_ordered_qty(po_item_rows)