From bf2b5119882611eb7db7260b740c936e6d777297 Mon Sep 17 00:00:00 2001 From: patilsangram Date: Mon, 22 Feb 2016 16:24:23 +0530 Subject: [PATCH 1/2] [Removed Stop Button from SO and PO] --- .../doctype/journal_entry/journal_entry.py | 6 ++-- .../doctype/payment_tool/payment_tool.py | 2 +- .../purchase_invoice/purchase_invoice.js | 2 +- .../purchase_invoice/purchase_invoice.py | 8 ++--- .../doctype/sales_invoice/sales_invoice.js | 2 +- .../doctype/sales_invoice/sales_invoice.py | 4 +-- .../ordered_items_to_be_billed.json | 2 +- .../purchase_order_items_to_be_billed.json | 2 +- .../purchase_common/purchase_common.py | 4 +-- .../doctype/purchase_order/purchase_order.js | 18 +++++------- .../purchase_order/purchase_order.json | 2 +- .../doctype/purchase_order/purchase_order.py | 18 ++++++------ .../purchase_order/purchase_order_list.js | 24 ++++++--------- erpnext/controllers/recurring_document.py | 2 +- erpnext/controllers/selling_controller.py | 4 +-- erpnext/controllers/status_updater.py | 2 -- erpnext/controllers/stock_controller.py | 4 +-- .../doctype/sales_order/sales_order.js | 18 ++++-------- .../doctype/sales_order/sales_order.json | 2 +- .../doctype/sales_order/sales_order.py | 14 ++++----- .../sales_order/sales_order_calendar.js | 2 +- .../doctype/sales_order/sales_order_list.js | 29 +++++++------------ .../doctype/sales_order/test_sales_order.py | 12 ++++---- erpnext/startup/notifications.py | 4 +-- .../doctype/delivery_note/delivery_note.js | 2 +- .../doctype/delivery_note/delivery_note.py | 4 +-- .../material_request/material_request.js | 2 +- .../material_request/material_request.py | 2 +- .../purchase_receipt/purchase_receipt.js | 2 +- .../purchase_receipt/purchase_receipt.py | 14 ++++----- erpnext/stock/stock_balance.py | 6 ++-- 31 files changed, 97 insertions(+), 122 deletions(-) diff --git a/erpnext/accounts/doctype/journal_entry/journal_entry.py b/erpnext/accounts/doctype/journal_entry/journal_entry.py index 4b5ce43857..afb9b85fb9 100644 --- a/erpnext/accounts/doctype/journal_entry/journal_entry.py +++ b/erpnext/accounts/doctype/journal_entry/journal_entry.py @@ -203,7 +203,7 @@ class JournalEntry(AccountsController): self.validate_invoices() def validate_orders(self): - """Validate totals, stopped and docstatus for orders""" + """Validate totals, closed and docstatus for orders""" for reference_name, total in self.reference_totals.iteritems(): reference_type = self.reference_types[reference_name] account = self.reference_accounts[reference_name] @@ -217,8 +217,8 @@ class JournalEntry(AccountsController): if flt(order.per_billed) >= 100: frappe.throw(_("{0} {1} is fully billed").format(reference_type, reference_name)) - if cstr(order.status) == "Stopped": - frappe.throw(_("{0} {1} is stopped").format(reference_type, reference_name)) + if cstr(order.status) == "Closed": + frappe.throw(_("{0} {1} is closed").format(reference_type, reference_name)) account_currency = get_account_currency(account) if account_currency == self.company_currency: diff --git a/erpnext/accounts/doctype/payment_tool/payment_tool.py b/erpnext/accounts/doctype/payment_tool/payment_tool.py index 36483067a1..ef8ffb1b93 100644 --- a/erpnext/accounts/doctype/payment_tool/payment_tool.py +++ b/erpnext/accounts/doctype/payment_tool/payment_tool.py @@ -133,7 +133,7 @@ def get_orders_to_be_billed(party_type, party, party_account_currency, company_c where {party_type} = %s and docstatus = 1 - and ifnull(status, "") != "Stopped" + and ifnull(status, "") != "Closed" and {ref_field} > advance_paid and abs(100 - per_billed) > 0.01 """.format(**{ diff --git a/erpnext/accounts/doctype/purchase_invoice/purchase_invoice.js b/erpnext/accounts/doctype/purchase_invoice/purchase_invoice.js index d3a72d64d4..2de99930c2 100644 --- a/erpnext/accounts/doctype/purchase_invoice/purchase_invoice.js +++ b/erpnext/accounts/doctype/purchase_invoice/purchase_invoice.js @@ -39,7 +39,7 @@ erpnext.accounts.PurchaseInvoice = erpnext.buying.BuyingController.extend({ get_query_filters: { supplier: cur_frm.doc.supplier || undefined, docstatus: 1, - status: ["not in", ["Stopped", "Closed"]], + status: ["!=", "Closed"], per_billed: ["<", 99.99], company: cur_frm.doc.company } diff --git a/erpnext/accounts/doctype/purchase_invoice/purchase_invoice.py b/erpnext/accounts/doctype/purchase_invoice/purchase_invoice.py index 6d61abe4cc..d88a11e03d 100644 --- a/erpnext/accounts/doctype/purchase_invoice/purchase_invoice.py +++ b/erpnext/accounts/doctype/purchase_invoice/purchase_invoice.py @@ -49,7 +49,7 @@ class PurchaseInvoice(BuyingController): self.check_conversion_rate() self.validate_credit_to_acc() self.clear_unallocated_advances("Purchase Invoice Advance", "advances") - self.check_for_stopped_or_closed_status() + self.check_for_closed_status() self.validate_with_previous_doc() self.validate_uom_is_integer("uom", "qty") self.set_against_expense_account() @@ -104,14 +104,14 @@ class PurchaseInvoice(BuyingController): self.party_account_currency = account.account_currency - def check_for_stopped_or_closed_status(self): + def check_for_closed_status(self): check_list = [] pc_obj = frappe.get_doc('Purchase Common') for d in self.get('items'): if d.purchase_order and not d.purchase_order in check_list and not d.purchase_receipt: check_list.append(d.purchase_order) - pc_obj.check_for_stopped_or_closed_status('Purchase Order', d.purchase_order) + pc_obj.check_for_closed_status('Purchase Order', d.purchase_order) def validate_with_previous_doc(self): super(PurchaseInvoice, self).validate_with_previous_doc({ @@ -405,7 +405,7 @@ class PurchaseInvoice(BuyingController): make_gl_entries(gl_entries, cancel=(self.docstatus == 2)) def on_cancel(self): - self.check_for_stopped_or_closed_status() + self.check_for_closed_status() if not self.is_return: from erpnext.accounts.utils import remove_against_link_from_jv diff --git a/erpnext/accounts/doctype/sales_invoice/sales_invoice.js b/erpnext/accounts/doctype/sales_invoice/sales_invoice.js index 26a9fa61c9..e717089a1e 100644 --- a/erpnext/accounts/doctype/sales_invoice/sales_invoice.js +++ b/erpnext/accounts/doctype/sales_invoice/sales_invoice.js @@ -114,7 +114,7 @@ erpnext.accounts.SalesInvoiceController = erpnext.selling.SellingController.exte source_doctype: "Sales Order", get_query_filters: { docstatus: 1, - status: ["not in", ["Stopped", "Closed"]], + status: ["!=", "Closed"], per_billed: ["<", 99.99], customer: cur_frm.doc.customer || undefined, company: cur_frm.doc.company diff --git a/erpnext/accounts/doctype/sales_invoice/sales_invoice.py b/erpnext/accounts/doctype/sales_invoice/sales_invoice.py index 3c60bfbb70..e120f18b3a 100644 --- a/erpnext/accounts/doctype/sales_invoice/sales_invoice.py +++ b/erpnext/accounts/doctype/sales_invoice/sales_invoice.py @@ -53,7 +53,7 @@ class SalesInvoice(SellingController): self.validate_proj_cust() self.validate_with_previous_doc() self.validate_uom_is_integer("stock_uom", "qty") - self.check_stop_or_close_sales_order("sales_order") + self.check_close_sales_order("sales_order") self.validate_debit_to_acc() self.validate_fixed_asset_account() self.clear_unallocated_advances("Sales Invoice Advance", "advances") @@ -121,7 +121,7 @@ class SalesInvoice(SellingController): if cint(self.update_stock) == 1: self.update_stock_ledger() - self.check_stop_or_close_sales_order("sales_order") + self.check_close_sales_order("sales_order") from erpnext.accounts.utils import remove_against_link_from_jv remove_against_link_from_jv(self.doctype, self.name) diff --git a/erpnext/accounts/report/ordered_items_to_be_billed/ordered_items_to_be_billed.json b/erpnext/accounts/report/ordered_items_to_be_billed/ordered_items_to_be_billed.json index cdbd5c1c01..f50d334d63 100644 --- a/erpnext/accounts/report/ordered_items_to_be_billed/ordered_items_to_be_billed.json +++ b/erpnext/accounts/report/ordered_items_to_be_billed/ordered_items_to_be_billed.json @@ -12,7 +12,7 @@ "module": "Accounts", "name": "Ordered Items To Be Billed", "owner": "Administrator", - "query": "select \n `tabSales Order`.`name` as \"Sales Order:Link/Sales Order:120\",\n `tabSales Order`.`customer` as \"Customer:Link/Customer:120\",\n `tabSales Order`.`status` as \"Status\",\n `tabSales Order`.`transaction_date` as \"Date:Date\",\n `tabSales Order`.`project_name` as \"Project\",\n `tabSales Order Item`.item_code as \"Item:Link/Item:120\",\n `tabSales Order Item`.base_amount as \"Amount:Currency:110\",\n (`tabSales Order Item`.billed_amt * ifnull(`tabSales Order`.conversion_rate, 1)) as \"Billed Amount:Currency:110\",\n (ifnull(`tabSales Order Item`.base_amount, 0) - (ifnull(`tabSales Order Item`.billed_amt, 0) * ifnull(`tabSales Order`.conversion_rate, 1))) as \"Pending Amount:Currency:120\",\n `tabSales Order Item`.item_name as \"Item Name::150\",\n `tabSales Order Item`.description as \"Description::200\",\n `tabSales Order`.`company` as \"Company:Link/Company:\"\nfrom\n `tabSales Order`, `tabSales Order Item`\nwhere\n `tabSales Order Item`.`parent` = `tabSales Order`.`name`\n and `tabSales Order`.docstatus = 1\n and `tabSales Order`.status not in (\"Stopped\", \"Closed\")\n and ifnull(`tabSales Order Item`.billed_amt,0) < ifnull(`tabSales Order Item`.amount,0)\norder by `tabSales Order`.transaction_date asc", + "query": "select \n `tabSales Order`.`name` as \"Sales Order:Link/Sales Order:120\",\n `tabSales Order`.`customer` as \"Customer:Link/Customer:120\",\n `tabSales Order`.`status` as \"Status\",\n `tabSales Order`.`transaction_date` as \"Date:Date\",\n `tabSales Order`.`project_name` as \"Project\",\n `tabSales Order Item`.item_code as \"Item:Link/Item:120\",\n `tabSales Order Item`.base_amount as \"Amount:Currency:110\",\n (`tabSales Order Item`.billed_amt * ifnull(`tabSales Order`.conversion_rate, 1)) as \"Billed Amount:Currency:110\",\n (ifnull(`tabSales Order Item`.base_amount, 0) - (ifnull(`tabSales Order Item`.billed_amt, 0) * ifnull(`tabSales Order`.conversion_rate, 1))) as \"Pending Amount:Currency:120\",\n `tabSales Order Item`.item_name as \"Item Name::150\",\n `tabSales Order Item`.description as \"Description::200\",\n `tabSales Order`.`company` as \"Company:Link/Company:\"\nfrom\n `tabSales Order`, `tabSales Order Item`\nwhere\n `tabSales Order Item`.`parent` = `tabSales Order`.`name`\n and `tabSales Order`.docstatus = 1\n and `tabSales Order`.status not in (\"Closed\")\n and ifnull(`tabSales Order Item`.billed_amt,0) < ifnull(`tabSales Order Item`.amount,0)\norder by `tabSales Order`.transaction_date asc", "ref_doctype": "Sales Invoice", "report_name": "Ordered Items To Be Billed", "report_type": "Query Report" diff --git a/erpnext/accounts/report/purchase_order_items_to_be_billed/purchase_order_items_to_be_billed.json b/erpnext/accounts/report/purchase_order_items_to_be_billed/purchase_order_items_to_be_billed.json index 38361fb19b..991e5994f3 100644 --- a/erpnext/accounts/report/purchase_order_items_to_be_billed/purchase_order_items_to_be_billed.json +++ b/erpnext/accounts/report/purchase_order_items_to_be_billed/purchase_order_items_to_be_billed.json @@ -12,7 +12,7 @@ "module": "Accounts", "name": "Purchase Order Items To Be Billed", "owner": "Administrator", - "query": "select \n `tabPurchase Order`.`name` as \"Purchase Order:Link/Purchase Order:120\",\n `tabPurchase Order`.`transaction_date` as \"Date:Date:100\",\n\t`tabPurchase Order`.`supplier` as \"Supplier:Link/Supplier:120\",\n\t`tabPurchase Order Item`.`project_name` as \"Project\",\n\t`tabPurchase Order Item`.item_code as \"Item Code:Link/Item:120\",\n\t`tabPurchase Order Item`.base_amount as \"Amount:Currency:100\",\n\t(`tabPurchase Order Item`.billed_amt * ifnull(`tabPurchase Order`.conversion_rate, 1)) as \"Billed Amount:Currency:100\", \n\t(`tabPurchase Order Item`.base_amount - (ifnull(`tabPurchase Order Item`.billed_amt, 0) * ifnull(`tabPurchase Order`.conversion_rate, 1))) as \"Amount to Bill:Currency:100\",\n\t`tabPurchase Order Item`.item_name as \"Item Name::150\",\n\t`tabPurchase Order Item`.description as \"Description::200\",\n\t`tabPurchase Order`.company as \"Company:Link/Company:\"\nfrom\n\t`tabPurchase Order`, `tabPurchase Order Item`\nwhere\n\t`tabPurchase Order Item`.`parent` = `tabPurchase Order`.`name`\n\tand `tabPurchase Order`.docstatus = 1\n\tand `tabPurchase Order`.status not in (\"Stopped\", \"Closed\")\n\tand (ifnull(`tabPurchase Order Item`.billed_amt, 0) * ifnull(`tabPurchase Order`.conversion_rate, 1)) < ifnull(`tabPurchase Order Item`.base_amount, 0)\norder by `tabPurchase Order`.transaction_date asc", + "query": "select \n `tabPurchase Order`.`name` as \"Purchase Order:Link/Purchase Order:120\",\n `tabPurchase Order`.`transaction_date` as \"Date:Date:100\",\n\t`tabPurchase Order`.`supplier` as \"Supplier:Link/Supplier:120\",\n\t`tabPurchase Order Item`.`project_name` as \"Project\",\n\t`tabPurchase Order Item`.item_code as \"Item Code:Link/Item:120\",\n\t`tabPurchase Order Item`.base_amount as \"Amount:Currency:100\",\n\t(`tabPurchase Order Item`.billed_amt * ifnull(`tabPurchase Order`.conversion_rate, 1)) as \"Billed Amount:Currency:100\", \n\t(`tabPurchase Order Item`.base_amount - (ifnull(`tabPurchase Order Item`.billed_amt, 0) * ifnull(`tabPurchase Order`.conversion_rate, 1))) as \"Amount to Bill:Currency:100\",\n\t`tabPurchase Order Item`.item_name as \"Item Name::150\",\n\t`tabPurchase Order Item`.description as \"Description::200\",\n\t`tabPurchase Order`.company as \"Company:Link/Company:\"\nfrom\n\t`tabPurchase Order`, `tabPurchase Order Item`\nwhere\n\t`tabPurchase Order Item`.`parent` = `tabPurchase Order`.`name`\n\tand `tabPurchase Order`.docstatus = 1\n\tand `tabPurchase Order`.status not in (\"Closed\")\n\tand (ifnull(`tabPurchase Order Item`.billed_amt, 0) * ifnull(`tabPurchase Order`.conversion_rate, 1)) < ifnull(`tabPurchase Order Item`.base_amount, 0)\norder by `tabPurchase Order`.transaction_date asc", "ref_doctype": "Purchase Invoice", "report_name": "Purchase Order Items To Be Billed", "report_type": "Query Report" diff --git a/erpnext/buying/doctype/purchase_common/purchase_common.py b/erpnext/buying/doctype/purchase_common/purchase_common.py index a86b330630..df63e291ba 100644 --- a/erpnext/buying/doctype/purchase_common/purchase_common.py +++ b/erpnext/buying/doctype/purchase_common/purchase_common.py @@ -80,10 +80,10 @@ class PurchaseCommon(BuyingController): frappe.msgprint(_("Warning: Same item has been entered multiple times.")) - def check_for_stopped_or_closed_status(self, doctype, docname): + def check_for_closed_status(self, doctype, docname): status = frappe.db.get_value(doctype, docname, "status") - if status in ("Stopped", "Closed"): + if status == "Closed": frappe.throw(_("{0} {1} status is {2}").format(doctype, docname, status), frappe.InvalidStatusError) def check_docstatus(self, check, doctype, docname, detail_doctype = ''): diff --git a/erpnext/buying/doctype/purchase_order/purchase_order.js b/erpnext/buying/doctype/purchase_order/purchase_order.js index e23b0d440a..2c1d709043 100644 --- a/erpnext/buying/doctype/purchase_order/purchase_order.js +++ b/erpnext/buying/doctype/purchase_order/purchase_order.js @@ -38,13 +38,13 @@ erpnext.buying.PurchaseOrderController = erpnext.buying.BuyingController.extend( cur_frm.set_df_property("drop_ship", "hidden", !is_drop_ship); - if(doc.docstatus == 1 && !in_list(["Stopped", "Closed", "Delivered"], doc.status)) { + if(doc.docstatus == 1 && !in_list(["Closed", "Delivered"], doc.status)) { if (this.frm.has_perm("submit")) { if(flt(doc.per_billed, 2) < 100 || doc.per_received < 100) { - cur_frm.add_custom_button(__('Stop'), this.stop_purchase_order, __("Status")); + cur_frm.add_custom_button(__('Close'), this.close_purchase_order, __("Status")); } - cur_frm.add_custom_button(__('Close'), this.close_purchase_order, __("Status")); + } @@ -58,13 +58,13 @@ erpnext.buying.PurchaseOrderController = erpnext.buying.BuyingController.extend( cur_frm.cscript.add_from_mappers(); } - if(doc.docstatus == 1 && in_list(["Stopped", "Closed", "Delivered"], doc.status)) { + if(doc.docstatus == 1 && in_list(["Closed", "Delivered"], doc.status)) { if (this.frm.has_perm("submit")) { - cur_frm.add_custom_button(__('Re-open'), this.unstop_purchase_order, __("Status")); + cur_frm.add_custom_button(__('Re-open'), this.unclose_purchase_order, __("Status")); } } - if(doc.docstatus == 1 && !in_list(["Stopped", "Closed"], doc.status)) { + if(doc.docstatus == 1 && !in_list(["Closed"], doc.status)) { if(flt(doc.per_received, 2) < 100 && allow_receipt) { cur_frm.add_custom_button(__('Receive'), this.make_purchase_receipt, __("Make")); @@ -192,11 +192,7 @@ erpnext.buying.PurchaseOrderController = erpnext.buying.BuyingController.extend( }); }, - stop_purchase_order: function(){ - cur_frm.cscript.update_status('Stop', 'Stopped') - }, - - unstop_purchase_order: function(){ + unclose_purchase_order: function(){ cur_frm.cscript.update_status('Re-open', 'Submitted') }, diff --git a/erpnext/buying/doctype/purchase_order/purchase_order.json b/erpnext/buying/doctype/purchase_order/purchase_order.json index 70070cc104..a3628be922 100644 --- a/erpnext/buying/doctype/purchase_order/purchase_order.json +++ b/erpnext/buying/doctype/purchase_order/purchase_order.json @@ -1907,7 +1907,7 @@ "no_copy": 1, "oldfieldname": "status", "oldfieldtype": "Select", - "options": "\nDraft\nTo Receive and Bill\nTo Bill\nTo Receive\nCompleted\nStopped\nCancelled\nClosed\nDelivered", + "options": "\nDraft\nTo Receive and Bill\nTo Bill\nTo Receive\nCompleted\nCancelled\nClosed\nDelivered", "permlevel": 0, "print_hide": 1, "print_hide_if_no_value": 0, diff --git a/erpnext/buying/doctype/purchase_order/purchase_order.py b/erpnext/buying/doctype/purchase_order/purchase_order.py index caefe53ac3..d4474b657b 100644 --- a/erpnext/buying/doctype/purchase_order/purchase_order.py +++ b/erpnext/buying/doctype/purchase_order/purchase_order.py @@ -39,7 +39,7 @@ class PurchaseOrder(BuyingController): self.set_status() pc_obj = frappe.get_doc('Purchase Common') pc_obj.validate_for_items(self) - self.check_for_stopped_or_closed_status(pc_obj) + self.check_for_closed_status(pc_obj) self.validate_uom_is_integer("uom", "qty") self.validate_uom_is_integer("stock_uom", ["qty", "required_qty"]) @@ -113,13 +113,13 @@ class PurchaseOrder(BuyingController): d.base_price_list_rate = d.base_rate = d.price_list_rate \ = d.rate = item_last_purchase_rate - # Check for Stopped status - def check_for_stopped_or_closed_status(self, pc_obj): + # Check for Closed status + def check_for_closed_status(self, pc_obj): check_list =[] for d in self.get('items'): if d.meta.get_field('prevdoc_docname') and d.prevdoc_docname and d.prevdoc_docname not in check_list: check_list.append(d.prevdoc_docname) - pc_obj.check_for_stopped_or_closed_status( d.prevdoc_doctype, d.prevdoc_docname) + pc_obj.check_for_closed_status( d.prevdoc_doctype, d.prevdoc_docname) def update_requested_qty(self): material_request_map = {} @@ -193,7 +193,7 @@ class PurchaseOrder(BuyingController): self.update_delivered_qty_in_sales_order() pc_obj = frappe.get_doc('Purchase Common') - self.check_for_stopped_or_closed_status(pc_obj) + self.check_for_closed_status(pc_obj) # Check if Purchase Receipt has been submitted against current Purchase Order pc_obj.check_docstatus(check = 'Next', doctype = 'Purchase Receipt', docname = self.name, detail_doctype = 'Purchase Receipt Item') @@ -253,7 +253,7 @@ class PurchaseOrder(BuyingController): item.received_qty = item.qty @frappe.whitelist() -def stop_or_unstop_purchase_orders(names, status): +def close_or_unclose_purchase_orders(names, status): if not frappe.has_permission("Purchase Order", "write"): frappe.throw(_("Not permitted"), frappe.PermissionError) @@ -261,11 +261,11 @@ def stop_or_unstop_purchase_orders(names, status): for name in names: po = frappe.get_doc("Purchase Order", name) if po.docstatus == 1: - if status in ("Stopped", "Closed"): - if po.status not in ("Stopped", "Cancelled", "Closed") and (po.per_received < 100 or po.per_billed < 100): + if status == "Closed": + if po.status not in ( "Cancelled", "Closed") and (po.per_received < 100 or po.per_billed < 100): po.update_status(status) else: - if po.status in ("Stopped", "Closed"): + if po.status == "Closed": po.update_status("Draft") frappe.local.message_log = [] diff --git a/erpnext/buying/doctype/purchase_order/purchase_order_list.js b/erpnext/buying/doctype/purchase_order/purchase_order_list.js index 253eb4bccd..f6e7eeba27 100644 --- a/erpnext/buying/doctype/purchase_order/purchase_order_list.js +++ b/erpnext/buying/doctype/purchase_order/purchase_order_list.js @@ -2,37 +2,31 @@ frappe.listview_settings['Purchase Order'] = { add_fields: ["base_grand_total", "company", "currency", "supplier", "supplier_name", "per_received", "per_billed", "status"], get_indicator: function(doc) { - if(doc.status==="Stopped") { - return [__("Stopped"), "darkgrey", "status,=,Stopped"]; - } else if(doc.status==="Closed"){ + if(doc.status==="Closed"){ return [__("Closed"), "green", "status,=,Closed"]; } else if (doc.status==="Delivered") { return [__("Delivered"), "green", "status,=,Closed"]; - }else if(flt(doc.per_received, 2) < 100 && doc.status!=="Stopped") { + }else if(flt(doc.per_received, 2) < 100 && doc.status!=="Closed") { if(flt(doc.per_billed, 2) < 100) { return [__("To Receive and Bill"), "orange", - "per_received,<,100|per_billed,<,100|status,!=,Stopped"]; + "per_received,<,100|per_billed,<,100|status,!=,Closed"]; } else { return [__("To Receive"), "orange", - "per_received,<,100|per_billed,=,100|status,!=,Stopped"]; + "per_received,<,100|per_billed,=,100|status,!=,Closed"]; } - } else if(flt(doc.per_received, 2) == 100 && flt(doc.per_billed, 2) < 100 && doc.status!=="Stopped") { - return [__("To Bill"), "orange", "per_received,=,100|per_billed,<,100|status,!=,Stopped"]; - } else if(flt(doc.per_received, 2) == 100 && flt(doc.per_billed, 2) == 100 && doc.status!=="Stopped") { - return [__("Completed"), "green", "per_received,=,100|per_billed,=,100|status,!=,Stopped"]; + } else if(flt(doc.per_received, 2) == 100 && flt(doc.per_billed, 2) < 100 && doc.status!=="Closed") { + return [__("To Bill"), "orange", "per_received,=,100|per_billed,<,100|status,!=,Closed"]; + } else if(flt(doc.per_received, 2) == 100 && flt(doc.per_billed, 2) == 100 && doc.status!=="Closed") { + return [__("Completed"), "green", "per_received,=,100|per_billed,=,100|status,!=,Closed"]; } }, onload: function(listview) { - var method = "erpnext.buying.doctype.purchase_order.purchase_order.stop_or_unstop_purchase_orders"; + var method = "erpnext.buying.doctype.purchase_order.purchase_order.close_or_unclose_purchase_orders"; listview.page.add_menu_item(__("Close"), function() { listview.call_for_selected_items(method, {"status": "Closed"}); }); - listview.page.add_menu_item(__("Stop"), function() { - listview.call_for_selected_items(method, {"status": "Stopped"}); - }); - listview.page.add_menu_item(__("Re-open"), function() { listview.call_for_selected_items(method, {"status": "Submitted"}); }); diff --git a/erpnext/controllers/recurring_document.py b/erpnext/controllers/recurring_document.py index 013a70e0ac..3ecbe5f119 100644 --- a/erpnext/controllers/recurring_document.py +++ b/erpnext/controllers/recurring_document.py @@ -34,7 +34,7 @@ def manage_recurring_documents(doctype, next_date=None, commit=True): date_field = date_field_map[doctype] - condition = " and ifnull(status, '') != 'Stopped'" if doctype in ("Sales Order", "Purchase Order") else "" + condition = " and ifnull(status, '') != 'Closed'" if doctype in ("Sales Order", "Purchase Order") else "" recurring_documents = frappe.db.sql("""select name, recurring_id from `tab{0}` where is_recurring=1 diff --git a/erpnext/controllers/selling_controller.py b/erpnext/controllers/selling_controller.py index f340f91104..09a8c94b9e 100644 --- a/erpnext/controllers/selling_controller.py +++ b/erpnext/controllers/selling_controller.py @@ -219,11 +219,11 @@ class SellingController(StockController): so_warehouse = so_item and so_item[0]["warehouse"] or "" return so_qty, so_warehouse - def check_stop_or_close_sales_order(self, ref_fieldname): + def check_close_sales_order(self, ref_fieldname): for d in self.get("items"): if d.get(ref_fieldname): status = frappe.db.get_value("Sales Order", d.get(ref_fieldname), "status") - if status in ("Stopped", "Closed"): + if status == "Closed": frappe.throw(_("Sales Order {0} is {1}").format(d.get(ref_fieldname), status)) def check_active_sales_items(obj): diff --git a/erpnext/controllers/status_updater.py b/erpnext/controllers/status_updater.py index 32724a9f95..5c5719e7be 100644 --- a/erpnext/controllers/status_updater.py +++ b/erpnext/controllers/status_updater.py @@ -35,7 +35,6 @@ status_map = { ["To Deliver", "eval:self.per_delivered < 100 and self.per_billed == 100 and self.docstatus == 1"], ["Completed", "eval:self.per_delivered == 100 and self.per_billed == 100 and self.docstatus == 1"], ["Completed", "eval:self.order_type == 'Maintenance' and self.per_billed == 100 and self.docstatus == 1"], - ["Stopped", "eval:self.status=='Stopped'"], ["Cancelled", "eval:self.docstatus==2"], ["Closed", "eval:self.status=='Closed'"], ], @@ -46,7 +45,6 @@ status_map = { ["To Receive", "eval:self.per_received < 100 and self.per_billed == 100 and self.docstatus == 1"], ["Completed", "eval:self.per_received == 100 and self.per_billed == 100 and self.docstatus == 1"], ["Delivered", "eval:self.status=='Delivered'"], - ["Stopped", "eval:self.status=='Stopped'"], ["Cancelled", "eval:self.docstatus==2"], ["Closed", "eval:self.status=='Closed'"], ], diff --git a/erpnext/controllers/stock_controller.py b/erpnext/controllers/stock_controller.py index 4c6a320158..10bf2f2b74 100644 --- a/erpnext/controllers/stock_controller.py +++ b/erpnext/controllers/stock_controller.py @@ -243,8 +243,8 @@ class StockController(AccountsController): if so and so_item_rows: sales_order = frappe.get_doc("Sales Order", so) - if sales_order.status in ["Stopped", "Cancelled"]: - frappe.throw(_("{0} {1} is cancelled or stopped").format(_("Sales Order"), so), + if sales_order.status in ["Closed", "Cancelled"]: + frappe.throw(_("{0} {1} is cancelled or closed").format(_("Sales Order"), so), frappe.InvalidStatusError) sales_order.update_reserved_qty(so_item_rows) diff --git a/erpnext/selling/doctype/sales_order/sales_order.js b/erpnext/selling/doctype/sales_order/sales_order.js index 9dae2b974d..b7dff77a6d 100644 --- a/erpnext/selling/doctype/sales_order/sales_order.js +++ b/erpnext/selling/doctype/sales_order/sales_order.js @@ -19,7 +19,7 @@ erpnext.selling.SalesOrderController = erpnext.selling.SellingController.extend( var allow_delivery = false; if(doc.docstatus==1) { - if(doc.status != 'Stopped' && doc.status != 'Closed') { + if(doc.status != 'Closed') { for (var i in cur_frm.doc.items) { var item = cur_frm.doc.items[i]; @@ -42,13 +42,10 @@ erpnext.selling.SalesOrderController = erpnext.selling.SellingController.extend( } if (this.frm.has_perm("submit")) { - // stop + // close if(flt(doc.per_delivered, 2) < 100 || flt(doc.per_billed) < 100) { - cur_frm.add_custom_button(__('Stop'), this.stop_sales_order, __("Status")) + cur_frm.add_custom_button(__('Close'), this.close_sales_order, __("Status")) } - - - cur_frm.add_custom_button(__('Close'), this.close_sales_order, __("Status")) } // delivery note @@ -87,8 +84,8 @@ erpnext.selling.SalesOrderController = erpnext.selling.SellingController.extend( } else { if (this.frm.has_perm("submit")) { - // un-stop - cur_frm.add_custom_button(__('Re-open'), cur_frm.cscript['Unstop Sales Order'], __("Status")); + // un-close + cur_frm.add_custom_button(__('Re-open'), cur_frm.cscript['Unclose Sales Order'], __("Status")); } } } @@ -220,9 +217,6 @@ erpnext.selling.SalesOrderController = erpnext.selling.SellingController.extend( }); dialog.show(); }, - stop_sales_order: function(){ - cur_frm.cscript.update_status("Stop", "Stopped") - }, close_sales_order: function(){ cur_frm.cscript.update_status("Close", "Closed") } @@ -263,7 +257,7 @@ cur_frm.cscript.update_status = function(label, status){ }); } -cur_frm.cscript['Unstop Sales Order'] = function() { +cur_frm.cscript['Unclose Sales Order'] = function() { cur_frm.cscript.update_status('Re-open', 'Draft') } diff --git a/erpnext/selling/doctype/sales_order/sales_order.json b/erpnext/selling/doctype/sales_order/sales_order.json index 8049a674a1..5c57f4584f 100644 --- a/erpnext/selling/doctype/sales_order/sales_order.json +++ b/erpnext/selling/doctype/sales_order/sales_order.json @@ -2201,7 +2201,7 @@ "no_copy": 1, "oldfieldname": "status", "oldfieldtype": "Select", - "options": "\nDraft\nTo Deliver and Bill\nTo Bill\nTo Deliver\nCompleted\nStopped\nCancelled\nClosed", + "options": "\nDraft\nTo Deliver and Bill\nTo Bill\nTo Deliver\nCompleted\nCancelled\nClosed", "permlevel": 0, "print_hide": 1, "print_hide_if_no_value": 0, diff --git a/erpnext/selling/doctype/sales_order/sales_order.py b/erpnext/selling/doctype/sales_order/sales_order.py index e692d6bb0e..d735bea01b 100644 --- a/erpnext/selling/doctype/sales_order/sales_order.py +++ b/erpnext/selling/doctype/sales_order/sales_order.py @@ -160,9 +160,9 @@ class SalesOrder(SellingController): self.update_prevdoc_status('submit') def on_cancel(self): - # Cannot cancel stopped SO - if self.status == 'Stopped': - frappe.throw(_("Stopped order cannot be cancelled. Unstop to cancel.")) + # Cannot cancel closed SO + if self.status == 'Closed': + frappe.throw(_("Closed order cannot be cancelled. Unclose to cancel.")) self.check_nextdoc_docstatus() self.update_reserved_qty() @@ -317,7 +317,7 @@ def get_list_context(context=None): return list_context @frappe.whitelist() -def stop_or_unstop_sales_orders(names, status): +def close_or_unclose_sales_orders(names, status): if not frappe.has_permission("Sales Order", "write"): frappe.throw(_("Not permitted"), frappe.PermissionError) @@ -325,11 +325,11 @@ def stop_or_unstop_sales_orders(names, status): for name in names: so = frappe.get_doc("Sales Order", name) if so.docstatus == 1: - if status in ("Stopped", "Closed"): - if so.status not in ("Stopped", "Cancelled", "Closed") and (so.per_delivered < 100 or so.per_billed < 100): + if status == "Closed": + if so.status not in ("Cancelled", "Closed") and (so.per_delivered < 100 or so.per_billed < 100): so.update_status(status) else: - if so.status in ("Stopped", "Closed"): + if so.status == "Closed": so.update_status('Draft') frappe.local.message_log = [] diff --git a/erpnext/selling/doctype/sales_order/sales_order_calendar.js b/erpnext/selling/doctype/sales_order/sales_order_calendar.js index 8724daae80..7a38f90079 100644 --- a/erpnext/selling/doctype/sales_order/sales_order_calendar.js +++ b/erpnext/selling/doctype/sales_order/sales_order_calendar.js @@ -32,7 +32,7 @@ frappe.views.calendar["Sales Order"] = { ], get_events_method: "erpnext.selling.doctype.sales_order.sales_order.get_events", get_css_class: function(data) { - if(data.status=="Stopped") { + if(data.status=="Closed") { return ""; } if(data.delivery_status=="Not Delivered") { return "danger"; diff --git a/erpnext/selling/doctype/sales_order/sales_order_list.js b/erpnext/selling/doctype/sales_order/sales_order_list.js index ff9ff91beb..3b60af4672 100644 --- a/erpnext/selling/doctype/sales_order/sales_order_list.js +++ b/erpnext/selling/doctype/sales_order/sales_order_list.js @@ -2,58 +2,51 @@ frappe.listview_settings['Sales Order'] = { add_fields: ["base_grand_total", "customer_name", "currency", "delivery_date", "per_delivered", "per_billed", "status", "order_type"], get_indicator: function(doc) { - if(doc.status==="Stopped") { - return [__("Stopped"), "darkgrey", "status,=,Stopped"]; - - } else if(doc.status==="Closed"){ + if(doc.status==="Closed"){ return [__("Closed"), "green", "status,=,Closed"]; } else if (doc.order_type !== "Maintenance" && flt(doc.per_delivered, 2) < 100 && frappe.datetime.get_diff(doc.delivery_date) < 0) { // to bill & overdue - return [__("Overdue"), "red", "per_delivered,<,100|delivery_date,<,Today|status,!=,Stopped"]; + return [__("Overdue"), "red", "per_delivered,<,100|delivery_date,<,Today|status,!=,Closed"]; } else if (doc.order_type !== "Maintenance" - && flt(doc.per_delivered, 2) < 100 && doc.status!=="Stopped") { + && flt(doc.per_delivered, 2) < 100 && doc.status!=="Closed") { // not delivered if(flt(doc.per_billed, 2) < 100) { // not delivered & not billed return [__("To Deliver and Bill"), "orange", - "per_delivered,<,100|per_billed,<,100|status,!=,Stopped"]; + "per_delivered,<,100|per_billed,<,100|status,!=,Closed"]; } else { // not billed return [__("To Deliver"), "orange", - "per_delivered,<,100|per_billed,=,100|status,!=,Stopped"]; + "per_delivered,<,100|per_billed,=,100|status,!=,Closed"]; } } else if ((doc.order_type === "Maintenance" || flt(doc.per_delivered, 2) == 100) - && flt(doc.per_billed, 2) < 100 && doc.status!=="Stopped") { + && flt(doc.per_billed, 2) < 100 && doc.status!=="Closed") { // to bill - return [__("To Bill"), "orange", "per_delivered,=,100|per_billed,<,100|status,!=,Stopped"]; + return [__("To Bill"), "orange", "per_delivered,=,100|per_billed,<,100|status,!=,Closed"]; } else if((doc.order_type === "Maintenance" || flt(doc.per_delivered, 2) == 100) - && flt(doc.per_billed, 2) == 100 && doc.status!=="Stopped") { + && flt(doc.per_billed, 2) == 100 && doc.status!=="Closed") { - return [__("Completed"), "green", "per_delivered,=,100|per_billed,=,100|status,!=,Stopped"]; + return [__("Completed"), "green", "per_delivered,=,100|per_billed,=,100|status,!=,Closed"]; } }, onload: function(listview) { - var method = "erpnext.selling.doctype.sales_order.sales_order.stop_or_unstop_sales_orders"; + var method = "erpnext.selling.doctype.sales_order.sales_order.close_or_unclose_sales_orders"; listview.page.add_menu_item(__("Close"), function() { listview.call_for_selected_items(method, {"status": "Closed"}); }); - listview.page.add_menu_item(__("Stop"), function() { - listview.call_for_selected_items(method, {"status": "Stoped"}); - }); - listview.page.add_menu_item(__("Re-open"), function() { - listview.call_for_selected_items(method, {"status": "Unstop"}); + listview.call_for_selected_items(method, {"status": "Unclose"}); }); } diff --git a/erpnext/selling/doctype/sales_order/test_sales_order.py b/erpnext/selling/doctype/sales_order/test_sales_order.py index c6ea618eb0..edd7cdfc4d 100644 --- a/erpnext/selling/doctype/sales_order/test_sales_order.py +++ b/erpnext/selling/doctype/sales_order/test_sales_order.py @@ -93,12 +93,12 @@ class TestSalesOrder(unittest.TestCase): dn = create_dn_against_so(so.name) self.assertEqual(get_reserved_qty(), existing_reserved_qty + 5) - # stop so + # close so so.load_from_db() - so.update_status("Stopped") + so.update_status("Closed") self.assertEqual(get_reserved_qty(), existing_reserved_qty) - # unstop so + # unclose so so.load_from_db() so.update_status('Draft') self.assertEqual(get_reserved_qty(), existing_reserved_qty + 5) @@ -143,14 +143,14 @@ class TestSalesOrder(unittest.TestCase): self.assertEqual(get_reserved_qty("_Test Item Home Desktop 100"), existing_reserved_qty_item2 + 10) - # stop so + # close so so.load_from_db() - so.update_status("Stopped") + so.update_status("Closed") self.assertEqual(get_reserved_qty("_Test Item"), existing_reserved_qty_item1) self.assertEqual(get_reserved_qty("_Test Item Home Desktop 100"), existing_reserved_qty_item2) - # unstop so + # unclose so so.load_from_db() so.update_status('Draft') diff --git a/erpnext/startup/notifications.py b/erpnext/startup/notifications.py index 3acf63c5f0..181a969aaf 100644 --- a/erpnext/startup/notifications.py +++ b/erpnext/startup/notifications.py @@ -15,7 +15,7 @@ def get_notification_config(): "Opportunity": {"status": "Open"}, "Quotation": {"docstatus": 0}, "Sales Order": { - "status": ("not in", ("Stopped", "Completed", "Closed")), + "status": ("not in", ("Completed", "Closed")), "docstatus": ("<", 2) }, "Journal Entry": {"docstatus": 0}, @@ -29,7 +29,7 @@ def get_notification_config(): "Stock Entry": {"docstatus": 0}, "Material Request": {"docstatus": 0}, "Purchase Order": { - "status": ("not in", ("Stopped", "Completed", "Closed")), + "status": ("not in", ("Completed", "Closed")), "docstatus": ("<", 2) }, "Production Order": { "status": "In Process" }, diff --git a/erpnext/stock/doctype/delivery_note/delivery_note.js b/erpnext/stock/doctype/delivery_note/delivery_note.js index 0b6f47e09f..679d9105f7 100644 --- a/erpnext/stock/doctype/delivery_note/delivery_note.js +++ b/erpnext/stock/doctype/delivery_note/delivery_note.js @@ -34,7 +34,7 @@ erpnext.stock.DeliveryNoteController = erpnext.selling.SellingController.extend( source_doctype: "Sales Order", get_query_filters: { docstatus: 1, - status: ["not in", ["Stopped", "Closed"]], + status: ["!=", "Closed"], per_delivered: ["<", 99.99], project_name: cur_frm.doc.project_name || undefined, customer: cur_frm.doc.customer || undefined, diff --git a/erpnext/stock/doctype/delivery_note/delivery_note.py b/erpnext/stock/doctype/delivery_note/delivery_note.py index 0dabfa13e1..2db350974c 100644 --- a/erpnext/stock/doctype/delivery_note/delivery_note.py +++ b/erpnext/stock/doctype/delivery_note/delivery_note.py @@ -98,7 +98,7 @@ class DeliveryNote(SellingController): self.set_status() self.so_required() self.validate_proj_cust() - self.check_stop_or_close_sales_order("against_sales_order") + self.check_close_sales_order("against_sales_order") self.validate_for_items() self.validate_warehouse() self.validate_uom_is_integer("stock_uom", "qty") @@ -195,7 +195,7 @@ class DeliveryNote(SellingController): self.make_gl_entries() def on_cancel(self): - self.check_stop_or_close_sales_order("against_sales_order") + self.check_close_sales_order("against_sales_order") self.check_next_docstatus() self.update_prevdoc_status() diff --git a/erpnext/stock/doctype/material_request/material_request.js b/erpnext/stock/doctype/material_request/material_request.js index 922eb5a435..e22e3cd6c5 100644 --- a/erpnext/stock/doctype/material_request/material_request.js +++ b/erpnext/stock/doctype/material_request/material_request.js @@ -70,7 +70,7 @@ erpnext.buying.MaterialRequestController = erpnext.buying.BuyingController.exten source_doctype: "Sales Order", get_query_filters: { docstatus: 1, - status: ["!=", "Stopped"], + status: ["!=", "Closed"], per_delivered: ["<", 99.99], company: cur_frm.doc.company } diff --git a/erpnext/stock/doctype/material_request/material_request.py b/erpnext/stock/doctype/material_request/material_request.py index 6f6f78e2a0..60bfb8cf46 100644 --- a/erpnext/stock/doctype/material_request/material_request.py +++ b/erpnext/stock/doctype/material_request/material_request.py @@ -101,7 +101,7 @@ class MaterialRequest(BuyingController): def on_cancel(self): pc_obj = frappe.get_doc('Purchase Common') - pc_obj.check_for_stopped_or_closed_status(self.doctype, self.name) + pc_obj.check_for_closed_status(self.doctype, self.name) pc_obj.check_docstatus(check = 'Next', doctype = 'Purchase Order', docname = self.name, detail_doctype = 'Purchase Order Item') self.update_requested_qty() diff --git a/erpnext/stock/doctype/purchase_receipt/purchase_receipt.js b/erpnext/stock/doctype/purchase_receipt/purchase_receipt.js index 7cf7ae9f88..a4df2d8c76 100644 --- a/erpnext/stock/doctype/purchase_receipt/purchase_receipt.js +++ b/erpnext/stock/doctype/purchase_receipt/purchase_receipt.js @@ -46,7 +46,7 @@ erpnext.stock.PurchaseReceiptController = erpnext.buying.BuyingController.extend get_query_filters: { supplier: cur_frm.doc.supplier || undefined, docstatus: 1, - status: ["not in", ["Stopped", "Closed"]], + status: ["!=", "Closed"], per_received: ["<", 99.99], company: cur_frm.doc.company } diff --git a/erpnext/stock/doctype/purchase_receipt/purchase_receipt.py b/erpnext/stock/doctype/purchase_receipt/purchase_receipt.py index 1d872388f3..454b386948 100644 --- a/erpnext/stock/doctype/purchase_receipt/purchase_receipt.py +++ b/erpnext/stock/doctype/purchase_receipt/purchase_receipt.py @@ -61,7 +61,7 @@ class PurchaseReceipt(BuyingController): pc_obj = frappe.get_doc('Purchase Common') pc_obj.validate_for_items(self) - self.check_for_stopped_or_closed_status(pc_obj) + self.check_for_closed_status(pc_obj) # sub-contracting self.validate_for_subcontracting() @@ -177,8 +177,8 @@ class PurchaseReceipt(BuyingController): if po and po_item_rows: po_obj = frappe.get_doc("Purchase Order", po) - if po_obj.status in ["Stopped", "Cancelled"]: - frappe.throw(_("{0} {1} is cancelled or stopped").format(_("Purchase Order"), po), + if po_obj.status in ["Closed", "Cancelled"]: + frappe.throw(_("{0} {1} is cancelled or closed").format(_("Purchase Order"), po), frappe.InvalidStatusError) po_obj.update_ordered_qty(po_item_rows) @@ -212,13 +212,13 @@ class PurchaseReceipt(BuyingController): if self.docstatus==1: raise frappe.ValidationError - # Check for Stopped status - def check_for_stopped_or_closed_status(self, pc_obj): + # Check for Closed status + def check_for_closed_status(self, pc_obj): check_list =[] for d in self.get('items'): if d.meta.get_field('prevdoc_docname') and d.prevdoc_docname and d.prevdoc_docname not in check_list: check_list.append(d.prevdoc_docname) - pc_obj.check_for_stopped_or_closed_status(d.prevdoc_doctype, d.prevdoc_docname) + pc_obj.check_for_closed_status(d.prevdoc_doctype, d.prevdoc_docname) # on submit def on_submit(self): @@ -256,7 +256,7 @@ class PurchaseReceipt(BuyingController): def on_cancel(self): pc_obj = frappe.get_doc('Purchase Common') - self.check_for_stopped_or_closed_status(pc_obj) + self.check_for_closed_status(pc_obj) # Check if Purchase Invoice has been submitted against current Purchase Order submitted = frappe.db.sql("""select t1.name from `tabPurchase Invoice` t1,`tabPurchase Invoice Item` t2 diff --git a/erpnext/stock/stock_balance.py b/erpnext/stock/stock_balance.py index b9e3cd2e82..24c23d4d3c 100644 --- a/erpnext/stock/stock_balance.py +++ b/erpnext/stock/stock_balance.py @@ -92,7 +92,7 @@ def get_reserved_qty(item_code, warehouse): and parenttype="Sales Order" and item_code != parent_item and exists (select * from `tabSales Order` so - where name = dnpi_in.parent and docstatus = 1 and status not in ('Stopped','Closed')) + where name = dnpi_in.parent and docstatus = 1 and status not in ('Closed')) ) dnpi) union (select qty as dnpi_qty, qty as so_item_qty, @@ -102,7 +102,7 @@ def get_reserved_qty(item_code, warehouse): and (so_item.delivered_by_supplier is null or so_item.delivered_by_supplier = 0) and exists(select * from `tabSales Order` so where so.name = so_item.parent and so.docstatus = 1 - and so.status not in ('Stopped','Closed'))) + and so.status not in ('Closed'))) ) tab where so_item_qty >= so_item_delivered_qty @@ -125,7 +125,7 @@ def get_ordered_qty(item_code, warehouse): from `tabPurchase Order Item` po_item, `tabPurchase Order` po where po_item.item_code=%s and po_item.warehouse=%s and po_item.qty > po_item.received_qty and po_item.parent=po.name - and po.status not in ('Stopped', 'Closed', 'Delivered') and po.docstatus=1 + and po.status not in ('Closed', 'Delivered') and po.docstatus=1 and po_item.delivered_by_supplier = 0""", (item_code, warehouse)) return flt(ordered_qty[0][0]) if ordered_qty else 0 From a812d67837ea97309ad3cd76c997fa2e56410f3e Mon Sep 17 00:00:00 2001 From: patilsangram Date: Tue, 23 Feb 2016 19:04:29 +0530 Subject: [PATCH 2/2] [fixes] --- .../ordered_items_to_be_billed.json | 4 ++-- .../purchase_order_items_to_be_billed.json | 4 ++-- erpnext/buying/doctype/purchase_order/purchase_order.js | 2 +- erpnext/selling/doctype/sales_order/sales_order_list.js | 2 +- erpnext/stock/stock_balance.py | 4 ++-- 5 files changed, 8 insertions(+), 8 deletions(-) diff --git a/erpnext/accounts/report/ordered_items_to_be_billed/ordered_items_to_be_billed.json b/erpnext/accounts/report/ordered_items_to_be_billed/ordered_items_to_be_billed.json index f50d334d63..a0be2571f2 100644 --- a/erpnext/accounts/report/ordered_items_to_be_billed/ordered_items_to_be_billed.json +++ b/erpnext/accounts/report/ordered_items_to_be_billed/ordered_items_to_be_billed.json @@ -7,12 +7,12 @@ "doctype": "Report", "idx": 1, "is_standard": "Yes", - "modified": "2015-11-04 11:56:32.699103", + "modified": "2016-02-23 18:48:42.372321", "modified_by": "Administrator", "module": "Accounts", "name": "Ordered Items To Be Billed", "owner": "Administrator", - "query": "select \n `tabSales Order`.`name` as \"Sales Order:Link/Sales Order:120\",\n `tabSales Order`.`customer` as \"Customer:Link/Customer:120\",\n `tabSales Order`.`status` as \"Status\",\n `tabSales Order`.`transaction_date` as \"Date:Date\",\n `tabSales Order`.`project_name` as \"Project\",\n `tabSales Order Item`.item_code as \"Item:Link/Item:120\",\n `tabSales Order Item`.base_amount as \"Amount:Currency:110\",\n (`tabSales Order Item`.billed_amt * ifnull(`tabSales Order`.conversion_rate, 1)) as \"Billed Amount:Currency:110\",\n (ifnull(`tabSales Order Item`.base_amount, 0) - (ifnull(`tabSales Order Item`.billed_amt, 0) * ifnull(`tabSales Order`.conversion_rate, 1))) as \"Pending Amount:Currency:120\",\n `tabSales Order Item`.item_name as \"Item Name::150\",\n `tabSales Order Item`.description as \"Description::200\",\n `tabSales Order`.`company` as \"Company:Link/Company:\"\nfrom\n `tabSales Order`, `tabSales Order Item`\nwhere\n `tabSales Order Item`.`parent` = `tabSales Order`.`name`\n and `tabSales Order`.docstatus = 1\n and `tabSales Order`.status not in (\"Closed\")\n and ifnull(`tabSales Order Item`.billed_amt,0) < ifnull(`tabSales Order Item`.amount,0)\norder by `tabSales Order`.transaction_date asc", + "query": "select \n `tabSales Order`.`name` as \"Sales Order:Link/Sales Order:120\",\n `tabSales Order`.`customer` as \"Customer:Link/Customer:120\",\n `tabSales Order`.`status` as \"Status\",\n `tabSales Order`.`transaction_date` as \"Date:Date\",\n `tabSales Order`.`project_name` as \"Project\",\n `tabSales Order Item`.item_code as \"Item:Link/Item:120\",\n `tabSales Order Item`.base_amount as \"Amount:Currency:110\",\n (`tabSales Order Item`.billed_amt * ifnull(`tabSales Order`.conversion_rate, 1)) as \"Billed Amount:Currency:110\",\n (ifnull(`tabSales Order Item`.base_amount, 0) - (ifnull(`tabSales Order Item`.billed_amt, 0) * ifnull(`tabSales Order`.conversion_rate, 1))) as \"Pending Amount:Currency:120\",\n `tabSales Order Item`.item_name as \"Item Name::150\",\n `tabSales Order Item`.description as \"Description::200\",\n `tabSales Order`.`company` as \"Company:Link/Company:\"\nfrom\n `tabSales Order`, `tabSales Order Item`\nwhere\n `tabSales Order Item`.`parent` = `tabSales Order`.`name`\n and `tabSales Order`.docstatus = 1\n and `tabSales Order`.status != \"Closed\"\n and ifnull(`tabSales Order Item`.billed_amt,0) < ifnull(`tabSales Order Item`.amount,0)\norder by `tabSales Order`.transaction_date asc", "ref_doctype": "Sales Invoice", "report_name": "Ordered Items To Be Billed", "report_type": "Query Report" diff --git a/erpnext/accounts/report/purchase_order_items_to_be_billed/purchase_order_items_to_be_billed.json b/erpnext/accounts/report/purchase_order_items_to_be_billed/purchase_order_items_to_be_billed.json index 991e5994f3..5f67309db4 100644 --- a/erpnext/accounts/report/purchase_order_items_to_be_billed/purchase_order_items_to_be_billed.json +++ b/erpnext/accounts/report/purchase_order_items_to_be_billed/purchase_order_items_to_be_billed.json @@ -7,12 +7,12 @@ "doctype": "Report", "idx": 1, "is_standard": "Yes", - "modified": "2015-11-04 11:56:14.321664", + "modified": "2016-02-23 18:51:21.968327", "modified_by": "Administrator", "module": "Accounts", "name": "Purchase Order Items To Be Billed", "owner": "Administrator", - "query": "select \n `tabPurchase Order`.`name` as \"Purchase Order:Link/Purchase Order:120\",\n `tabPurchase Order`.`transaction_date` as \"Date:Date:100\",\n\t`tabPurchase Order`.`supplier` as \"Supplier:Link/Supplier:120\",\n\t`tabPurchase Order Item`.`project_name` as \"Project\",\n\t`tabPurchase Order Item`.item_code as \"Item Code:Link/Item:120\",\n\t`tabPurchase Order Item`.base_amount as \"Amount:Currency:100\",\n\t(`tabPurchase Order Item`.billed_amt * ifnull(`tabPurchase Order`.conversion_rate, 1)) as \"Billed Amount:Currency:100\", \n\t(`tabPurchase Order Item`.base_amount - (ifnull(`tabPurchase Order Item`.billed_amt, 0) * ifnull(`tabPurchase Order`.conversion_rate, 1))) as \"Amount to Bill:Currency:100\",\n\t`tabPurchase Order Item`.item_name as \"Item Name::150\",\n\t`tabPurchase Order Item`.description as \"Description::200\",\n\t`tabPurchase Order`.company as \"Company:Link/Company:\"\nfrom\n\t`tabPurchase Order`, `tabPurchase Order Item`\nwhere\n\t`tabPurchase Order Item`.`parent` = `tabPurchase Order`.`name`\n\tand `tabPurchase Order`.docstatus = 1\n\tand `tabPurchase Order`.status not in (\"Closed\")\n\tand (ifnull(`tabPurchase Order Item`.billed_amt, 0) * ifnull(`tabPurchase Order`.conversion_rate, 1)) < ifnull(`tabPurchase Order Item`.base_amount, 0)\norder by `tabPurchase Order`.transaction_date asc", + "query": "select \n `tabPurchase Order`.`name` as \"Purchase Order:Link/Purchase Order:120\",\n `tabPurchase Order`.`transaction_date` as \"Date:Date:100\",\n\t`tabPurchase Order`.`supplier` as \"Supplier:Link/Supplier:120\",\n\t`tabPurchase Order Item`.`project_name` as \"Project\",\n\t`tabPurchase Order Item`.item_code as \"Item Code:Link/Item:120\",\n\t`tabPurchase Order Item`.base_amount as \"Amount:Currency:100\",\n\t(`tabPurchase Order Item`.billed_amt * ifnull(`tabPurchase Order`.conversion_rate, 1)) as \"Billed Amount:Currency:100\", \n\t(`tabPurchase Order Item`.base_amount - (ifnull(`tabPurchase Order Item`.billed_amt, 0) * ifnull(`tabPurchase Order`.conversion_rate, 1))) as \"Amount to Bill:Currency:100\",\n\t`tabPurchase Order Item`.item_name as \"Item Name::150\",\n\t`tabPurchase Order Item`.description as \"Description::200\",\n\t`tabPurchase Order`.company as \"Company:Link/Company:\"\nfrom\n\t`tabPurchase Order`, `tabPurchase Order Item`\nwhere\n\t`tabPurchase Order Item`.`parent` = `tabPurchase Order`.`name`\n\tand `tabPurchase Order`.docstatus = 1\n\tand `tabPurchase Order`.status != \"Closed\"\n\tand (ifnull(`tabPurchase Order Item`.billed_amt, 0) * ifnull(`tabPurchase Order`.conversion_rate, 1)) < ifnull(`tabPurchase Order Item`.base_amount, 0)\norder by `tabPurchase Order`.transaction_date asc", "ref_doctype": "Purchase Invoice", "report_name": "Purchase Order Items To Be Billed", "report_type": "Query Report" diff --git a/erpnext/buying/doctype/purchase_order/purchase_order.js b/erpnext/buying/doctype/purchase_order/purchase_order.js index 2c1d709043..40a1c8bd9e 100644 --- a/erpnext/buying/doctype/purchase_order/purchase_order.js +++ b/erpnext/buying/doctype/purchase_order/purchase_order.js @@ -64,7 +64,7 @@ erpnext.buying.PurchaseOrderController = erpnext.buying.BuyingController.extend( } } - if(doc.docstatus == 1 && !in_list(["Closed"], doc.status)) { + if(doc.docstatus == 1 && doc.status != "Closed") { if(flt(doc.per_received, 2) < 100 && allow_receipt) { cur_frm.add_custom_button(__('Receive'), this.make_purchase_receipt, __("Make")); diff --git a/erpnext/selling/doctype/sales_order/sales_order_list.js b/erpnext/selling/doctype/sales_order/sales_order_list.js index 3b60af4672..53b2818274 100644 --- a/erpnext/selling/doctype/sales_order/sales_order_list.js +++ b/erpnext/selling/doctype/sales_order/sales_order_list.js @@ -46,7 +46,7 @@ frappe.listview_settings['Sales Order'] = { }); listview.page.add_menu_item(__("Re-open"), function() { - listview.call_for_selected_items(method, {"status": "Unclose"}); + listview.call_for_selected_items(method, {"status": "Submitted"}); }); } diff --git a/erpnext/stock/stock_balance.py b/erpnext/stock/stock_balance.py index 24c23d4d3c..708552c2ff 100644 --- a/erpnext/stock/stock_balance.py +++ b/erpnext/stock/stock_balance.py @@ -92,7 +92,7 @@ def get_reserved_qty(item_code, warehouse): and parenttype="Sales Order" and item_code != parent_item and exists (select * from `tabSales Order` so - where name = dnpi_in.parent and docstatus = 1 and status not in ('Closed')) + where name = dnpi_in.parent and docstatus = 1 and status != 'Closed') ) dnpi) union (select qty as dnpi_qty, qty as so_item_qty, @@ -102,7 +102,7 @@ def get_reserved_qty(item_code, warehouse): and (so_item.delivered_by_supplier is null or so_item.delivered_by_supplier = 0) and exists(select * from `tabSales Order` so where so.name = so_item.parent and so.docstatus = 1 - and so.status not in ('Closed'))) + and so.status != 'Closed')) ) tab where so_item_qty >= so_item_delivered_qty