[minor] stopped or cancelled message

This commit is contained in:
Anand Doshi 2015-08-26 19:14:16 +05:30
parent 10fc83d369
commit fa65c7bf29
3 changed files with 12 additions and 9 deletions

View File

@ -227,7 +227,7 @@ class StockController(AccountsController):
incoming_rate = incoming_rate[0][0] if incoming_rate else 0.0 incoming_rate = incoming_rate[0][0] if incoming_rate else 0.0
return incoming_rate return incoming_rate
def update_reserved_qty(self): def update_reserved_qty(self):
so_map = {} so_map = {}
for d in self.get("items"): for d in self.get("items"):
@ -242,22 +242,23 @@ class StockController(AccountsController):
sales_order = frappe.get_doc("Sales Order", so) sales_order = frappe.get_doc("Sales Order", so)
if sales_order.status in ["Stopped", "Cancelled"]: 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) sales_order.update_reserved_qty(so_item_rows)
def update_stock_ledger(self): def update_stock_ledger(self):
self.update_reserved_qty() self.update_reserved_qty()
sl_entries = [] sl_entries = []
for d in self.get_item_list(): for d in self.get_item_list():
if frappe.db.get_value("Item", d.item_code, "is_stock_item") == 1 \ if frappe.db.get_value("Item", d.item_code, "is_stock_item") == 1 \
and d.warehouse and flt(d['qty']): and d.warehouse and flt(d['qty']):
incoming_rate = 0 incoming_rate = 0
if cint(self.is_return) and self.return_against and self.docstatus==1: 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) incoming_rate = self.get_incoming_rate_for_sales_return(d.item_code, self.return_against)
sl_entries.append(self.get_sl_entries(d, { sl_entries.append(self.get_sl_entries(d, {
"actual_qty": -1*flt(d['qty']), "actual_qty": -1*flt(d['qty']),
"stock_uom": frappe.db.get_value("Item", d.item_code, "stock_uom"), "stock_uom": frappe.db.get_value("Item", d.item_code, "stock_uom"),

View File

@ -162,7 +162,8 @@ def update_completed_and_requested_qty(stock_entry, method):
mr_obj = frappe.get_doc("Material Request", mr) mr_obj = frappe.get_doc("Material Request", mr)
if mr_obj.status in ["Stopped", "Cancelled"]: 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_completed_qty(mr_item_rows)
mr_obj.update_requested_qty(mr_item_rows) mr_obj.update_requested_qty(mr_item_rows)

View File

@ -183,7 +183,8 @@ class PurchaseReceipt(BuyingController):
po_obj = frappe.get_doc("Purchase Order", po) po_obj = frappe.get_doc("Purchase Order", po)
if po_obj.status in ["Stopped", "Cancelled"]: 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) po_obj.update_ordered_qty(po_item_rows)