From 60117d6d625fe35538540fcc14d5d4583f2127e4 Mon Sep 17 00:00:00 2001 From: Rushabh Mehta Date: Thu, 25 Jul 2013 16:09:50 +0530 Subject: [PATCH 1/5] [minor] moved Debit To and Credit To in Sales / Purchase Invoice to More Info #645 --- .../purchase_invoice/purchase_invoice.txt | 32 +++++++++---------- .../doctype/sales_invoice/sales_invoice.txt | 32 +++++++++---------- 2 files changed, 32 insertions(+), 32 deletions(-) diff --git a/accounts/doctype/purchase_invoice/purchase_invoice.txt b/accounts/doctype/purchase_invoice/purchase_invoice.txt index 8d65281624..6ed049e86f 100755 --- a/accounts/doctype/purchase_invoice/purchase_invoice.txt +++ b/accounts/doctype/purchase_invoice/purchase_invoice.txt @@ -2,7 +2,7 @@ { "creation": "2013-05-21 16:16:39", "docstatus": 0, - "modified": "2013-07-24 21:44:41", + "modified": "2013-07-25 16:08:44", "modified_by": "Administrator", "owner": "Administrator" }, @@ -69,21 +69,6 @@ "report_hide": 0, "reqd": 1 }, - { - "description": "Supplier (Payable) Account", - "doctype": "DocField", - "fieldname": "credit_to", - "fieldtype": "Link", - "in_filter": 1, - "label": "Credit To", - "oldfieldname": "credit_to", - "oldfieldtype": "Link", - "options": "Account", - "print_hide": 1, - "read_only": 0, - "reqd": 1, - "search_index": 1 - }, { "doctype": "DocField", "fieldname": "supplier", @@ -675,6 +660,21 @@ "print_hide": 1, "read_only": 0 }, + { + "description": "Supplier (Payable) Account", + "doctype": "DocField", + "fieldname": "credit_to", + "fieldtype": "Link", + "in_filter": 1, + "label": "Credit To", + "oldfieldname": "credit_to", + "oldfieldtype": "Link", + "options": "Account", + "print_hide": 1, + "read_only": 0, + "reqd": 1, + "search_index": 1 + }, { "default": "No", "description": "Considered as Opening Balance", diff --git a/accounts/doctype/sales_invoice/sales_invoice.txt b/accounts/doctype/sales_invoice/sales_invoice.txt index 480f9fec35..625d2c9c1c 100644 --- a/accounts/doctype/sales_invoice/sales_invoice.txt +++ b/accounts/doctype/sales_invoice/sales_invoice.txt @@ -2,7 +2,7 @@ { "creation": "2013-05-24 19:29:05", "docstatus": 0, - "modified": "2013-07-24 21:44:15", + "modified": "2013-07-25 16:08:10", "modified_by": "Administrator", "owner": "Administrator" }, @@ -61,21 +61,6 @@ "read_only": 0, "reqd": 1 }, - { - "description": "Customer (Receivable) Account", - "doctype": "DocField", - "fieldname": "debit_to", - "fieldtype": "Link", - "in_filter": 1, - "label": "Debit To", - "oldfieldname": "debit_to", - "oldfieldtype": "Link", - "options": "Account", - "print_hide": 1, - "read_only": 0, - "reqd": 1, - "search_index": 1 - }, { "doctype": "DocField", "fieldname": "customer", @@ -821,6 +806,21 @@ "print_hide": 1, "read_only": 0 }, + { + "description": "Customer (Receivable) Account", + "doctype": "DocField", + "fieldname": "debit_to", + "fieldtype": "Link", + "in_filter": 1, + "label": "Debit To", + "oldfieldname": "debit_to", + "oldfieldtype": "Link", + "options": "Account", + "print_hide": 1, + "read_only": 0, + "reqd": 1, + "search_index": 1 + }, { "description": "Track this Sales Invoice against any Project", "doctype": "DocField", From 4dca40195ef1262d2d7a7b06436d99160c6a6a5e Mon Sep 17 00:00:00 2001 From: Rushabh Mehta Date: Thu, 25 Jul 2013 17:45:59 +0530 Subject: [PATCH 2/5] [feature] Ability to set UOM as Integer-only and related validations. --- .../purchase_invoice/purchase_invoice.py | 1 + .../doctype/sales_invoice/sales_invoice.py | 2 ++ .../sales_invoice_item/sales_invoice_item.txt | 5 ++-- .../doctype/purchase_order/purchase_order.py | 3 +++ .../purchase_order_item.txt | 5 ++-- .../purchase_order_item_supplied.txt | 5 ++-- .../purchase_receipt_item_supplied.txt | 5 ++-- .../supplier_quotation/supplier_quotation.py | 1 + controllers/accounts_controller.py | 3 +-- controllers/selling_controller.py | 2 +- manufacturing/doctype/bom/bom.py | 4 +++ manufacturing/doctype/bom/test_bom.py | 4 +-- manufacturing/doctype/bom_item/bom_item.txt | 5 ++-- .../production_order/production_order.py | 7 +++--- .../production_order/production_order.txt | 17 ++++--------- .../production_plan_item.txt | 5 ++-- .../production_planning_tool.py | 3 +++ selling/doctype/opportunity/opportunity.py | 2 ++ selling/doctype/quotation/quotation.py | 3 +++ .../doctype/quotation_item/quotation_item.txt | 5 ++-- selling/doctype/sales_bom/sales_bom.py | 3 +++ selling/doctype/sales_order/sales_order.py | 1 + .../sales_order_item/sales_order_item.txt | 5 ++-- setup/doctype/uom/uom.txt | 23 ++++++++--------- startup/install.py | 12 ++++----- stock/doctype/bin/bin.txt | 5 ++-- stock/doctype/delivery_note/delivery_note.py | 1 + .../delivery_note/test_delivery_note.py | 2 +- .../delivery_note_item/delivery_note_item.txt | 5 ++-- .../material_request/material_request.py | 1 + stock/doctype/packing_slip/packing_slip.py | 4 +++ .../packing_slip_item/packing_slip_item.txt | 5 ++-- .../purchase_receipt/purchase_receipt.py | 5 +++- .../purchase_receipt_item.txt | 5 ++-- stock/doctype/stock_entry/stock_entry.py | 3 +++ .../stock_ledger_entry/stock_ledger_entry.txt | 5 ++-- .../stock_uom_replace_utility.py | 20 ++++++++++++--- .../stock_uom_replace_utility.txt | 14 +++++------ utilities/transaction_base.py | 25 ++++++++++++++++++- 39 files changed, 153 insertions(+), 78 deletions(-) diff --git a/accounts/doctype/purchase_invoice/purchase_invoice.py b/accounts/doctype/purchase_invoice/purchase_invoice.py index aa82492baa..4a4a3f2e9a 100644 --- a/accounts/doctype/purchase_invoice/purchase_invoice.py +++ b/accounts/doctype/purchase_invoice/purchase_invoice.py @@ -58,6 +58,7 @@ class DocType(BuyingController): self.check_for_acc_head_of_supplier() self.check_for_stopped_status() self.validate_with_previous_doc() + self.validate_uom_is_integer("uom", "qty") if not self.doc.is_opening: self.doc.is_opening = 'No' diff --git a/accounts/doctype/sales_invoice/sales_invoice.py b/accounts/doctype/sales_invoice/sales_invoice.py index 3859595e33..ceab40ac12 100644 --- a/accounts/doctype/sales_invoice/sales_invoice.py +++ b/accounts/doctype/sales_invoice/sales_invoice.py @@ -60,6 +60,8 @@ class DocType(SellingController): self.so_dn_required() self.validate_proj_cust() self.validate_with_previous_doc() + self.validate_uom_is_integer("stock_uom", "qty") + sales_com_obj = get_obj('Sales Common') sales_com_obj.check_stop_sales_order(self) sales_com_obj.check_active_sales_items(self) diff --git a/accounts/doctype/sales_invoice_item/sales_invoice_item.txt b/accounts/doctype/sales_invoice_item/sales_invoice_item.txt index 03b9f8b9af..057f166d75 100644 --- a/accounts/doctype/sales_invoice_item/sales_invoice_item.txt +++ b/accounts/doctype/sales_invoice_item/sales_invoice_item.txt @@ -2,7 +2,7 @@ { "creation": "2013-06-04 11:02:19", "docstatus": 0, - "modified": "2013-07-10 14:54:19", + "modified": "2013-07-25 16:32:10", "modified_by": "Administrator", "owner": "Administrator" }, @@ -107,9 +107,10 @@ { "doctype": "DocField", "fieldname": "stock_uom", - "fieldtype": "Data", + "fieldtype": "Link", "in_list_view": 0, "label": "UOM", + "options": "UOM", "read_only": 1 }, { diff --git a/buying/doctype/purchase_order/purchase_order.py b/buying/doctype/purchase_order/purchase_order.py index e2d7a45a97..af61c69be1 100644 --- a/buying/doctype/purchase_order/purchase_order.py +++ b/buying/doctype/purchase_order/purchase_order.py @@ -58,6 +58,9 @@ class DocType(BuyingController): pc_obj.get_prevdoc_date(self) self.check_for_stopped_status(pc_obj) + self.validate_uom_is_integer("uom", "qty") + self.validate_uom_is_integer("stock_uom", ["qty", "required_qty"]) + self.validate_with_previous_doc() self.validate_for_subcontracting() self.update_raw_materials_supplied("po_raw_material_details") diff --git a/buying/doctype/purchase_order_item/purchase_order_item.txt b/buying/doctype/purchase_order_item/purchase_order_item.txt index c7233d0ecd..85abcb982e 100755 --- a/buying/doctype/purchase_order_item/purchase_order_item.txt +++ b/buying/doctype/purchase_order_item/purchase_order_item.txt @@ -2,7 +2,7 @@ { "creation": "2013-05-24 19:29:06", "docstatus": 0, - "modified": "2013-07-10 14:54:14", + "modified": "2013-07-25 16:32:51", "modified_by": "Administrator", "owner": "Administrator" }, @@ -265,12 +265,13 @@ { "doctype": "DocField", "fieldname": "stock_uom", - "fieldtype": "Data", + "fieldtype": "Link", "hidden": 0, "in_list_view": 0, "label": "Stock UOM", "oldfieldname": "stock_uom", "oldfieldtype": "Data", + "options": "UOM", "print_hide": 1, "print_width": "100px", "read_only": 1, diff --git a/buying/doctype/purchase_order_item_supplied/purchase_order_item_supplied.txt b/buying/doctype/purchase_order_item_supplied/purchase_order_item_supplied.txt index 1d91aa323d..05ea4e2863 100644 --- a/buying/doctype/purchase_order_item_supplied/purchase_order_item_supplied.txt +++ b/buying/doctype/purchase_order_item_supplied/purchase_order_item_supplied.txt @@ -2,7 +2,7 @@ { "creation": "2013-02-22 01:27:42", "docstatus": 0, - "modified": "2013-07-10 14:54:15", + "modified": "2013-07-25 16:33:05", "modified_by": "Administrator", "owner": "dhanalekshmi@webnotestech.com" }, @@ -111,10 +111,11 @@ { "doctype": "DocField", "fieldname": "stock_uom", - "fieldtype": "Data", + "fieldtype": "Link", "label": "Stock Uom", "oldfieldname": "stock_uom", "oldfieldtype": "Data", + "options": "UOM", "read_only": 1 } ] \ No newline at end of file diff --git a/buying/doctype/purchase_receipt_item_supplied/purchase_receipt_item_supplied.txt b/buying/doctype/purchase_receipt_item_supplied/purchase_receipt_item_supplied.txt index 0ee20a5776..15225103cd 100644 --- a/buying/doctype/purchase_receipt_item_supplied/purchase_receipt_item_supplied.txt +++ b/buying/doctype/purchase_receipt_item_supplied/purchase_receipt_item_supplied.txt @@ -2,7 +2,7 @@ { "creation": "2013-02-22 01:27:42", "docstatus": 0, - "modified": "2013-07-10 14:54:17", + "modified": "2013-07-25 16:34:11", "modified_by": "Administrator", "owner": "wasim@webnotestech.com" }, @@ -130,10 +130,11 @@ { "doctype": "DocField", "fieldname": "stock_uom", - "fieldtype": "Data", + "fieldtype": "Link", "label": "Stock Uom", "oldfieldname": "stock_uom", "oldfieldtype": "Data", + "options": "UOM", "read_only": 1 }, { diff --git a/buying/doctype/supplier_quotation/supplier_quotation.py b/buying/doctype/supplier_quotation/supplier_quotation.py index ae3fbd3dd9..61b8411beb 100644 --- a/buying/doctype/supplier_quotation/supplier_quotation.py +++ b/buying/doctype/supplier_quotation/supplier_quotation.py @@ -36,6 +36,7 @@ class DocType(BuyingController): self.validate_common() self.validate_with_previous_doc() + self.validate_uom_is_integer("uom", "qty") def on_submit(self): purchase_controller = webnotes.get_obj("Purchase Common") diff --git a/controllers/accounts_controller.py b/controllers/accounts_controller.py index abefb9bc3d..4e850ff8e0 100644 --- a/controllers/accounts_controller.py +++ b/controllers/accounts_controller.py @@ -20,7 +20,7 @@ from webnotes import _, msgprint from webnotes.utils import flt, cint, today, cstr from setup.utils import get_company_currency, get_price_list_currency from accounts.utils import get_fiscal_year, validate_fiscal_year -from utilities.transaction_base import TransactionBase, validate_conversion_rate +from utilities.transaction_base import TransactionBase, validate_conversion_rate, validate_uom_is_integer import json class AccountsController(TransactionBase): @@ -28,7 +28,6 @@ class AccountsController(TransactionBase): self.set_missing_values(for_validate=True) self.validate_date_with_fiscal_year() - if self.meta.get_field("currency"): self.calculate_taxes_and_totals() self.validate_value("grand_total", ">=", 0) diff --git a/controllers/selling_controller.py b/controllers/selling_controller.py index 2cd1be2067..60cb43c6c1 100644 --- a/controllers/selling_controller.py +++ b/controllers/selling_controller.py @@ -210,7 +210,7 @@ class SellingController(StockController): item.export_amount = flt(item.export_rate * item.qty, self.precision("export_amount", item)) - + self._set_in_company_currency(item, "ref_rate", "base_ref_rate") self._set_in_company_currency(item, "export_rate", "basic_rate") self._set_in_company_currency(item, "export_amount", "amount") diff --git a/manufacturing/doctype/bom/bom.py b/manufacturing/doctype/bom/bom.py index 94f3d20ec3..1dfb74636f 100644 --- a/manufacturing/doctype/bom/bom.py +++ b/manufacturing/doctype/bom/bom.py @@ -43,6 +43,10 @@ class DocType: def validate(self): self.clear_operations() self.validate_main_item() + + from utilities.transaction_base import validate_uom_is_integer + validate_uom_is_integer(self.doclist, "stock_uom", "qty") + self.validate_operations() self.validate_materials() self.set_bom_material_details() diff --git a/manufacturing/doctype/bom/test_bom.py b/manufacturing/doctype/bom/test_bom.py index cb91e78cc5..bc99b89059 100644 --- a/manufacturing/doctype/bom/test_bom.py +++ b/manufacturing/doctype/bom/test_bom.py @@ -36,7 +36,7 @@ test_records = [ "qty": 1.0, "rate": 5000.0, "amount": 5000.0, - "stock_uom": "No." + "stock_uom": "_Test UOM" }, { "doctype": "BOM Item", @@ -45,7 +45,7 @@ test_records = [ "qty": 2.0, "rate": 1000.0, "amount": 2000.0, - "stock_uom": "No." + "stock_uom": "_Test UOM" } ] ] \ No newline at end of file diff --git a/manufacturing/doctype/bom_item/bom_item.txt b/manufacturing/doctype/bom_item/bom_item.txt index a41ab65cb3..e498c71270 100644 --- a/manufacturing/doctype/bom_item/bom_item.txt +++ b/manufacturing/doctype/bom_item/bom_item.txt @@ -2,7 +2,7 @@ { "creation": "2013-02-22 01:27:49", "docstatus": 0, - "modified": "2013-07-22 15:28:20", + "modified": "2013-07-25 16:34:42", "modified_by": "Administrator", "owner": "Administrator" }, @@ -75,11 +75,12 @@ { "doctype": "DocField", "fieldname": "stock_uom", - "fieldtype": "Data", + "fieldtype": "Link", "in_list_view": 0, "label": "Stock UOM", "oldfieldname": "stock_uom", "oldfieldtype": "Data", + "options": "UOM", "read_only": 1, "reqd": 1 }, diff --git a/manufacturing/doctype/production_order/production_order.py b/manufacturing/doctype/production_order/production_order.py index 95a82720cd..625e567c7f 100644 --- a/manufacturing/doctype/production_order/production_order.py +++ b/manufacturing/doctype/production_order/production_order.py @@ -23,8 +23,6 @@ from webnotes import msgprint sql = webnotes.conn.sql - - class DocType: def __init__(self, doc, doclist=[]): self.doc = doc @@ -57,7 +55,10 @@ class DocType: msgprint("Sales Order: %s is not valid" % self.doc.sales_order, raise_exception=1) self.validate_production_order_against_so() - + + from utilities.transaction_base import validate_uom_is_integer + validate_uom_is_integer(self.doclist, "stock_uom", ["qty", "produced_qty"]) + def validate_production_order_against_so(self): # already ordered qty diff --git a/manufacturing/doctype/production_order/production_order.txt b/manufacturing/doctype/production_order/production_order.txt index 6e5e379a11..c546692a2f 100644 --- a/manufacturing/doctype/production_order/production_order.txt +++ b/manufacturing/doctype/production_order/production_order.txt @@ -2,7 +2,7 @@ { "creation": "2013-01-10 16:34:16", "docstatus": 0, - "modified": "2013-07-11 15:51:37", + "modified": "2013-07-25 16:38:37", "modified_by": "Administrator", "owner": "Administrator" }, @@ -35,6 +35,7 @@ "permlevel": 0, "read": 1, "report": 1, + "role": "Manufacturing User", "submit": 1, "write": 1 }, @@ -219,10 +220,11 @@ "depends_on": "production_item", "doctype": "DocField", "fieldname": "stock_uom", - "fieldtype": "Data", + "fieldtype": "Link", "label": "Stock UOM", "oldfieldname": "stock_uom", "oldfieldtype": "Data", + "options": "UOM", "read_only": 1 }, { @@ -247,15 +249,6 @@ "read_only": 1 }, { - "doctype": "DocPerm", - "role": "System Manager" - }, - { - "doctype": "DocPerm", - "role": "Manufacturing Manager" - }, - { - "doctype": "DocPerm", - "role": "Manufacturing User" + "doctype": "DocPerm" } ] \ No newline at end of file diff --git a/manufacturing/doctype/production_plan_item/production_plan_item.txt b/manufacturing/doctype/production_plan_item/production_plan_item.txt index 37f56c90a5..c4a5c23436 100644 --- a/manufacturing/doctype/production_plan_item/production_plan_item.txt +++ b/manufacturing/doctype/production_plan_item/production_plan_item.txt @@ -2,7 +2,7 @@ { "creation": "2013-02-22 01:27:49", "docstatus": 0, - "modified": "2013-07-10 14:54:12", + "modified": "2013-07-25 16:35:27", "modified_by": "Administrator", "owner": "Administrator" }, @@ -92,11 +92,12 @@ { "doctype": "DocField", "fieldname": "stock_uom", - "fieldtype": "Data", + "fieldtype": "Link", "in_list_view": 0, "label": "UOM", "oldfieldname": "stock_uom", "oldfieldtype": "Data", + "options": "UOM", "print_width": "80px", "read_only": 1, "reqd": 1, diff --git a/manufacturing/doctype/production_planning_tool/production_planning_tool.py b/manufacturing/doctype/production_planning_tool/production_planning_tool.py index 26644ad787..966fc53f3c 100644 --- a/manufacturing/doctype/production_planning_tool/production_planning_tool.py +++ b/manufacturing/doctype/production_planning_tool/production_planning_tool.py @@ -185,6 +185,9 @@ class DocType: self.validate_company() self.validate_data() + from utilities.transaction_base import validate_uom_is_integer + validate_uom_is_integer(self.doclist, "stock_uom", "planned_qty") + items = self.get_distinct_items_and_boms()[1] pro = self.create_production_order(items) if pro: diff --git a/selling/doctype/opportunity/opportunity.py b/selling/doctype/opportunity/opportunity.py index f31d53316f..e48fff9f90 100644 --- a/selling/doctype/opportunity/opportunity.py +++ b/selling/doctype/opportunity/opportunity.py @@ -24,6 +24,7 @@ from webnotes import msgprint sql = webnotes.conn.sql from utilities.transaction_base import TransactionBase + class DocType(TransactionBase): def __init__(self,doc,doclist): self.doc = doc @@ -138,6 +139,7 @@ class DocType(TransactionBase): def validate(self): self.set_last_contact_date() self.validate_item_details() + self.validate_uom_is_integer("uom", "qty") self.validate_lead_cust() from accounts.utils import validate_fiscal_year diff --git a/selling/doctype/quotation/quotation.py b/selling/doctype/quotation/quotation.py index 1b286d111b..abb1a1c24e 100644 --- a/selling/doctype/quotation/quotation.py +++ b/selling/doctype/quotation/quotation.py @@ -135,6 +135,9 @@ class DocType(SellingController): self.set_last_contact_date() self.validate_order_type() self.validate_for_items() + + self.validate_uom_is_integer("stock_uom", "qty") + sales_com_obj = get_obj('Sales Common') sales_com_obj.check_active_sales_items(self) sales_com_obj.validate_max_discount(self,'quotation_details') diff --git a/selling/doctype/quotation_item/quotation_item.txt b/selling/doctype/quotation_item/quotation_item.txt index 32b8421806..32a97c8582 100644 --- a/selling/doctype/quotation_item/quotation_item.txt +++ b/selling/doctype/quotation_item/quotation_item.txt @@ -2,7 +2,7 @@ { "creation": "2013-03-07 11:42:57", "docstatus": 0, - "modified": "2013-07-10 14:54:18", + "modified": "2013-07-25 16:35:50", "modified_by": "Administrator", "owner": "Administrator" }, @@ -110,11 +110,12 @@ { "doctype": "DocField", "fieldname": "stock_uom", - "fieldtype": "Data", + "fieldtype": "Link", "in_list_view": 0, "label": "UOM", "oldfieldname": "stock_uom", "oldfieldtype": "Data", + "options": "UOM", "print_hide": 0, "print_width": "100px", "read_only": 1, diff --git a/selling/doctype/sales_bom/sales_bom.py b/selling/doctype/sales_bom/sales_bom.py index 13f68aa78c..43ab040dc4 100644 --- a/selling/doctype/sales_bom/sales_bom.py +++ b/selling/doctype/sales_bom/sales_bom.py @@ -31,6 +31,9 @@ class DocType: self.check_duplicate() self.validate_main_item() + from utilities.transaction_base import validate_uom_is_integer + validate_uom_is_integer(self.doclist, "uom", "qty") + def validate_main_item(self): """main item must have Is Stock Item as No and Is Sales Item as Yes""" if not webnotes.conn.sql("""select name from tabItem where name=%s and diff --git a/selling/doctype/sales_order/sales_order.py b/selling/doctype/sales_order/sales_order.py index fb04714a07..55abf9dbfa 100644 --- a/selling/doctype/sales_order/sales_order.py +++ b/selling/doctype/sales_order/sales_order.py @@ -139,6 +139,7 @@ class DocType(SellingController): self.validate_mandatory() self.validate_proj_cust() self.validate_po() + self.validate_uom_is_integer("stock_uom", "qty") if self.doc.docstatus == 1: self.validate_for_items() diff --git a/selling/doctype/sales_order_item/sales_order_item.txt b/selling/doctype/sales_order_item/sales_order_item.txt index 84e44b0e2b..3211b2e2fb 100644 --- a/selling/doctype/sales_order_item/sales_order_item.txt +++ b/selling/doctype/sales_order_item/sales_order_item.txt @@ -2,7 +2,7 @@ { "creation": "2013-03-07 11:42:58", "docstatus": 0, - "modified": "2013-07-10 14:54:21", + "modified": "2013-07-25 16:36:10", "modified_by": "Administrator", "owner": "Administrator" }, @@ -104,12 +104,13 @@ { "doctype": "DocField", "fieldname": "stock_uom", - "fieldtype": "Data", + "fieldtype": "Link", "hidden": 0, "in_list_view": 0, "label": "UOM", "oldfieldname": "stock_uom", "oldfieldtype": "Data", + "options": "UOM", "print_width": "70px", "read_only": 1, "reqd": 0, diff --git a/setup/doctype/uom/uom.txt b/setup/doctype/uom/uom.txt index 0837558415..6577f6c005 100644 --- a/setup/doctype/uom/uom.txt +++ b/setup/doctype/uom/uom.txt @@ -2,7 +2,7 @@ { "creation": "2013-01-10 16:34:24", "docstatus": 0, - "modified": "2013-07-23 12:03:54", + "modified": "2013-07-25 16:18:17", "modified_by": "Administrator", "owner": "Administrator" }, @@ -23,6 +23,7 @@ "permlevel": 0 }, { + "amend": 0, "doctype": "DocPerm", "name": "__common__", "parent": "UOM", @@ -30,7 +31,8 @@ "parenttype": "DocType", "permlevel": 0, "read": 1, - "report": 1 + "report": 1, + "submit": 0 }, { "doctype": "DocType", @@ -62,34 +64,31 @@ "reqd": 1 }, { - "amend": 0, + "description": "Check this to disallow fractions. (for Nos)", + "doctype": "DocField", + "fieldname": "must_be_whole_number", + "fieldtype": "Check", + "label": "Must be Whole Number" + }, + { "cancel": 1, "create": 1, "doctype": "DocPerm", "role": "Material Master Manager", - "submit": 0, "write": 1 }, { - "amend": 0, "cancel": 0, "create": 0, "doctype": "DocPerm", "role": "Material Manager", - "submit": 0, "write": 0 }, { - "amend": 0, "cancel": 0, "create": 0, "doctype": "DocPerm", "role": "Material User", - "submit": 0, "write": 0 - }, - { - "doctype": "DocPerm", - "role": "All" } ] \ No newline at end of file diff --git a/startup/install.py b/startup/install.py index 896a6cdc72..9408c6177c 100644 --- a/startup/install.py +++ b/startup/install.py @@ -151,13 +151,13 @@ def import_defaults(): {'doctype': 'Sales Person', 'sales_person_name': 'Sales Team', 'is_group': "Yes", "parent_sales_person": ""}, # UOM - {'uom_name': 'Unit', 'doctype': 'UOM', 'name': 'Unit'}, - {'uom_name': 'Box', 'doctype': 'UOM', 'name': 'Box'}, + {'uom_name': 'Unit', 'doctype': 'UOM', 'name': 'Unit', "must_be_whole_number": 1}, + {'uom_name': 'Box', 'doctype': 'UOM', 'name': 'Box', "must_be_whole_number": 1}, {'uom_name': 'Kg', 'doctype': 'UOM', 'name': 'Kg'}, - {'uom_name': 'Nos', 'doctype': 'UOM', 'name': 'Nos'}, - {'uom_name': 'Pair', 'doctype': 'UOM', 'name': 'Pair'}, - {'uom_name': 'Set', 'doctype': 'UOM', 'name': 'Set'}, - {'uom_name': 'Hour', 'doctype': 'UOM', 'name': 'Hour'}, + {'uom_name': 'Nos', 'doctype': 'UOM', 'name': 'Nos', "must_be_whole_number": 1}, + {'uom_name': 'Pair', 'doctype': 'UOM', 'name': 'Pair', "must_be_whole_number": 1}, + {'uom_name': 'Set', 'doctype': 'UOM', 'name': 'Set', "must_be_whole_number": 1}, + {'uom_name': 'Hour', 'doctype': 'UOM', 'name': 'Hour'}, {'uom_name': 'Minute', 'doctype': 'UOM', 'name': 'Minute'}, ] diff --git a/stock/doctype/bin/bin.txt b/stock/doctype/bin/bin.txt index 676976aeb4..1455fa68a7 100644 --- a/stock/doctype/bin/bin.txt +++ b/stock/doctype/bin/bin.txt @@ -2,7 +2,7 @@ { "creation": "2013-01-10 16:34:25", "docstatus": 0, - "modified": "2013-07-10 18:32:13", + "modified": "2013-07-25 16:36:35", "modified_by": "Administrator", "owner": "Administrator" }, @@ -146,11 +146,12 @@ { "doctype": "DocField", "fieldname": "stock_uom", - "fieldtype": "Data", + "fieldtype": "Link", "in_filter": 1, "label": "UOM", "oldfieldname": "stock_uom", "oldfieldtype": "Data", + "options": "UOM", "search_index": 0 }, { diff --git a/stock/doctype/delivery_note/delivery_note.py b/stock/doctype/delivery_note/delivery_note.py index 8cd57563eb..f7283eb862 100644 --- a/stock/doctype/delivery_note/delivery_note.py +++ b/stock/doctype/delivery_note/delivery_note.py @@ -99,6 +99,7 @@ class DocType(SellingController): sales_com_obj.get_prevdoc_date(self) self.validate_for_items() self.validate_warehouse() + self.validate_uom_is_integer("stock_uom", "qty") sales_com_obj.validate_max_discount(self, 'delivery_note_details') sales_com_obj.check_conversion_rate(self) diff --git a/stock/doctype/delivery_note/test_delivery_note.py b/stock/doctype/delivery_note/test_delivery_note.py index f4b9bbb276..eac140d7d3 100644 --- a/stock/doctype/delivery_note/test_delivery_note.py +++ b/stock/doctype/delivery_note/test_delivery_note.py @@ -141,7 +141,7 @@ test_records = [ "export_rate": 100.0, "amount": 500.0, "warehouse": "_Test Warehouse - _TC", - "stock_uom": "No." + "stock_uom": "_Test UOM" } ] diff --git a/stock/doctype/delivery_note_item/delivery_note_item.txt b/stock/doctype/delivery_note_item/delivery_note_item.txt index 346673f46e..8f133d2df2 100644 --- a/stock/doctype/delivery_note_item/delivery_note_item.txt +++ b/stock/doctype/delivery_note_item/delivery_note_item.txt @@ -2,7 +2,7 @@ { "creation": "2013-04-22 13:15:44", "docstatus": 0, - "modified": "2013-07-10 14:54:07", + "modified": "2013-07-25 16:37:09", "modified_by": "Administrator", "owner": "Administrator" }, @@ -111,11 +111,12 @@ { "doctype": "DocField", "fieldname": "stock_uom", - "fieldtype": "Data", + "fieldtype": "Link", "in_list_view": 0, "label": "UOM", "oldfieldname": "stock_uom", "oldfieldtype": "Data", + "options": "UOM", "print_hide": 0, "print_width": "50px", "read_only": 1, diff --git a/stock/doctype/material_request/material_request.py b/stock/doctype/material_request/material_request.py index 0830fd451d..86de99e5c6 100644 --- a/stock/doctype/material_request/material_request.py +++ b/stock/doctype/material_request/material_request.py @@ -60,6 +60,7 @@ class DocType(BuyingController): super(DocType, self).validate() self.validate_schedule_date() + self.validate_uom_is_integer("uom", "qty") if not self.doc.status: self.doc.status = "Draft" diff --git a/stock/doctype/packing_slip/packing_slip.py b/stock/doctype/packing_slip/packing_slip.py index 63aa6a9431..9a0da823db 100644 --- a/stock/doctype/packing_slip/packing_slip.py +++ b/stock/doctype/packing_slip/packing_slip.py @@ -37,6 +37,10 @@ class DocType: self.validate_case_nos() self.validate_qty() + from utilities.transaction_base import validate_uom_is_integer + validate_uom_is_integer(self.doclist, "stock_uom", "qty") + validate_uom_is_integer(self.doclist, "weight_uom", "net_weight") + def validate_delivery_note(self): """ Validates if delivery note has status as draft diff --git a/stock/doctype/packing_slip_item/packing_slip_item.txt b/stock/doctype/packing_slip_item/packing_slip_item.txt index 8dea8779ac..41dd044c7c 100644 --- a/stock/doctype/packing_slip_item/packing_slip_item.txt +++ b/stock/doctype/packing_slip_item/packing_slip_item.txt @@ -2,7 +2,7 @@ { "creation": "2013-04-08 13:10:16", "docstatus": 0, - "modified": "2013-07-10 14:54:11", + "modified": "2013-07-25 16:37:30", "modified_by": "Administrator", "owner": "Administrator" }, @@ -61,9 +61,10 @@ { "doctype": "DocField", "fieldname": "stock_uom", - "fieldtype": "Data", + "fieldtype": "Link", "in_list_view": 0, "label": "UOM", + "options": "UOM", "print_width": "100px", "read_only": 1, "width": "100px" diff --git a/stock/doctype/purchase_receipt/purchase_receipt.py b/stock/doctype/purchase_receipt/purchase_receipt.py index 89a40e706c..744130a71b 100644 --- a/stock/doctype/purchase_receipt/purchase_receipt.py +++ b/stock/doctype/purchase_receipt/purchase_receipt.py @@ -120,7 +120,10 @@ class DocType(BuyingController): self.validate_with_previous_doc() self.validate_accepted_rejected_qty() - self.validate_inspection() # Validate Inspection + self.validate_inspection() + self.validate_uom_is_integer("uom", ["qty", "received_qty"]) + self.validate_uom_is_integer("stock_uom", "stock_qty") + get_obj('Stock Ledger').validate_serial_no(self, 'purchase_receipt_details') self.validate_challan_no() diff --git a/stock/doctype/purchase_receipt_item/purchase_receipt_item.txt b/stock/doctype/purchase_receipt_item/purchase_receipt_item.txt index 60b1b567ac..913cdf5bf2 100755 --- a/stock/doctype/purchase_receipt_item/purchase_receipt_item.txt +++ b/stock/doctype/purchase_receipt_item/purchase_receipt_item.txt @@ -2,7 +2,7 @@ { "creation": "2013-05-24 19:29:10", "docstatus": 0, - "modified": "2013-07-10 14:54:16", + "modified": "2013-07-25 16:30:24", "modified_by": "Administrator", "owner": "Administrator" }, @@ -267,11 +267,12 @@ { "doctype": "DocField", "fieldname": "stock_uom", - "fieldtype": "Data", + "fieldtype": "Link", "in_list_view": 0, "label": "Stock UOM", "oldfieldname": "stock_uom", "oldfieldtype": "Data", + "options": "UOM", "print_hide": 1, "print_width": "100px", "read_only": 1, diff --git a/stock/doctype/stock_entry/stock_entry.py b/stock/doctype/stock_entry/stock_entry.py index d38962005e..58f17c7401 100644 --- a/stock/doctype/stock_entry/stock_entry.py +++ b/stock/doctype/stock_entry/stock_entry.py @@ -49,6 +49,9 @@ class DocType(StockController): get_obj('Production Order', self.doc.production_order) or None self.validate_item() + self.validate_uom_is_integer("uom", "qty") + self.validate_uom_is_integer("stock_uom", "transfer_qty") + self.validate_warehouse(pro_obj) self.validate_production_order(pro_obj) self.get_stock_and_rate() diff --git a/stock/doctype/stock_ledger_entry/stock_ledger_entry.txt b/stock/doctype/stock_ledger_entry/stock_ledger_entry.txt index 6ca9cc629e..5b65e973d4 100644 --- a/stock/doctype/stock_ledger_entry/stock_ledger_entry.txt +++ b/stock/doctype/stock_ledger_entry/stock_ledger_entry.txt @@ -2,7 +2,7 @@ { "creation": "2013-01-29 19:25:42", "docstatus": 0, - "modified": "2013-07-10 18:34:09", + "modified": "2013-07-25 16:39:10", "modified_by": "Administrator", "owner": "Administrator" }, @@ -181,10 +181,11 @@ { "doctype": "DocField", "fieldname": "stock_uom", - "fieldtype": "Data", + "fieldtype": "Link", "label": "Stock UOM", "oldfieldname": "stock_uom", "oldfieldtype": "Data", + "options": "UOM", "print_width": "150px", "read_only": 1, "width": "150px" diff --git a/stock/doctype/stock_uom_replace_utility/stock_uom_replace_utility.py b/stock/doctype/stock_uom_replace_utility/stock_uom_replace_utility.py index f353629bae..7e5d972afd 100644 --- a/stock/doctype/stock_uom_replace_utility/stock_uom_replace_utility.py +++ b/stock/doctype/stock_uom_replace_utility/stock_uom_replace_utility.py @@ -17,15 +17,13 @@ from __future__ import unicode_literals import webnotes -from webnotes.utils import cstr, flt, now +from webnotes.utils import cstr, flt, now, cint from webnotes.model import db_exists from webnotes.model.bean import copy_doclist from webnotes.model.code import get_obj from webnotes import msgprint sql = webnotes.conn.sql - - class DocType: def __init__(self, d, dl=[]): @@ -97,7 +95,8 @@ class DocType: def update_stock_uom(self): # validate mandatory self.validate_mandatory() - + self.validate_uom_integer_type() + # update item master self.update_item_master() @@ -108,6 +107,19 @@ class DocType: self.update_bin() get_obj("Item", self.doc.item_code).on_update() + + def validate_uom_integer_type(self): + current_is_integer = webnotes.conn.get_value("UOM", self.doc.current_stock_uom, "must_be_whole_number") + new_is_integer = webnotes.conn.get_value("UOM", self.doc.new_stock_uom, "must_be_whole_number") + + if current_is_integer and not new_is_integer: + webnotes.msgprint("New UOM must be of type Whole Number", raise_exception=True) + + if not current_is_integer and new_is_integer: + webnotes.msgprint("New UOM must NOT be of type Whole Number", raise_exception=True) + + if current_is_integer and new_is_integer and cint(self.doc.conversion_factor)!=self.doc.conversion_factor: + webnotes.msgprint("Conversion Factor cannot be fraction", raise_exception=True) @webnotes.whitelist() def get_stock_uom(item_code): diff --git a/stock/doctype/stock_uom_replace_utility/stock_uom_replace_utility.txt b/stock/doctype/stock_uom_replace_utility/stock_uom_replace_utility.txt index d820b01649..6862a86ef5 100644 --- a/stock/doctype/stock_uom_replace_utility/stock_uom_replace_utility.txt +++ b/stock/doctype/stock_uom_replace_utility/stock_uom_replace_utility.txt @@ -2,7 +2,7 @@ { "creation": "2013-01-10 16:34:30", "docstatus": 0, - "modified": "2013-07-05 14:56:45", + "modified": "2013-07-25 17:39:14", "modified_by": "Administrator", "owner": "Administrator" }, @@ -62,6 +62,12 @@ "label": "New Stock UOM", "options": "UOM" }, + { + "doctype": "DocField", + "fieldname": "conversion_factor", + "fieldtype": "Float", + "label": "Conversion Factor" + }, { "doctype": "DocField", "fieldname": "update", @@ -69,12 +75,6 @@ "label": "Update", "options": "update_stock_uom" }, - { - "doctype": "DocField", - "fieldname": "conversion_factor", - "fieldtype": "Float", - "label": "Conversion Factor" - }, { "doctype": "DocPerm", "role": "Material Master Manager" diff --git a/utilities/transaction_base.py b/utilities/transaction_base.py index 2900bf6ec3..e9802364c6 100644 --- a/utilities/transaction_base.py +++ b/utilities/transaction_base.py @@ -17,7 +17,7 @@ from __future__ import unicode_literals import webnotes from webnotes import msgprint, _ -from webnotes.utils import load_json, cstr, flt, now_datetime +from webnotes.utils import load_json, cstr, flt, now_datetime, cint from webnotes.model.doc import addchild from controllers.status_updater import StatusUpdater @@ -276,6 +276,9 @@ class TransactionBase(StatusUpdater): webnotes.bean(event_doclist).insert() + def validate_uom_is_integer(self, uom_field, qty_fields): + validate_uom_is_integer(self.doclist, uom_field, qty_fields) + def validate_with_previous_doc(self, source_dt, ref): for key, val in ref.items(): is_child = val.get("is_child_table") @@ -482,3 +485,23 @@ def validate_currency(args, item, meta=None): def delete_events(ref_type, ref_name): webnotes.delete_doc("Event", webnotes.conn.sql_list("""select name from `tabEvent` where ref_type=%s and ref_name=%s""", (ref_type, ref_name)), for_reload=True) + +def validate_uom_is_integer(doclist, uom_field, qty_fields): + if isinstance(qty_fields, basestring): + qty_fields = [qty_fields] + + integer_uoms = filter(lambda uom: webnotes.conn.get_value("UOM", uom, + "must_be_whole_number") or None, doclist.get_distinct_values(uom_field)) + + if not integer_uoms: + return + + for d in doclist: + if d.fields.get(uom_field) in integer_uoms: + for f in qty_fields: + if d.fields.get(f): + if cint(d.fields[f])!=d.fields[f]: + webnotes.msgprint(_("For UOM") + " '" + d.fields[uom_field] \ + + "': " + _("Quantity cannot be a fraction.") \ + + " " + _("In Row") + ": " + str(d.idx), + raise_exception=True) From 60403b2d8f72e39e8d720b0ab07a412b6ba4ffa4 Mon Sep 17 00:00:00 2001 From: Anand Doshi Date: Thu, 25 Jul 2013 18:53:22 +0530 Subject: [PATCH 3/5] [fix] [minor] [grid] set_colum_disp should force refresh the whole grid --- accounts/doctype/sales_invoice/sales_invoice.js | 7 ++++--- buying/doctype/purchase_common/purchase_common.js | 8 ++++---- public/js/feature_setup.js | 3 +-- stock/doctype/delivery_note/delivery_note.js | 3 +-- 4 files changed, 10 insertions(+), 11 deletions(-) diff --git a/accounts/doctype/sales_invoice/sales_invoice.js b/accounts/doctype/sales_invoice/sales_invoice.js index 773956a67a..e4de474470 100644 --- a/accounts/doctype/sales_invoice/sales_invoice.js +++ b/accounts/doctype/sales_invoice/sales_invoice.js @@ -176,13 +176,14 @@ cur_frm.cscript.hide_fields = function(doc, cdt, cdn) { if(cint(doc.is_pos) == 1) { hide_field(par_flds); unhide_field('payments_section'); - for(f in item_flds_normal) cur_frm.fields_dict['entries'].grid.set_column_disp(item_flds_normal[f], false); + cur_frm.fields_dict['entries'].grid.set_column_disp(item_flds_normal, false); } else { hide_field('payments_section'); unhide_field(par_flds); - for(f in item_flds_normal) cur_frm.fields_dict['entries'].grid.set_column_disp(item_flds_normal[f], true); + cur_frm.fields_dict['entries'].grid.set_column_disp(item_flds_normal, true); } - for(f in item_flds_pos) cur_frm.fields_dict['entries'].grid.set_column_disp(item_flds_pos[f], (cint(doc.update_stock)==1?true:false)); + + cur_frm.fields_dict['entries'].grid.set_column_disp(item_flds_pos, (cint(doc.update_stock)==1?true:false)); // India related fields var cp = wn.control_panel; diff --git a/buying/doctype/purchase_common/purchase_common.js b/buying/doctype/purchase_common/purchase_common.js index 04263c3a5e..494a9dcb2c 100644 --- a/buying/doctype/purchase_common/purchase_common.js +++ b/buying/doctype/purchase_common/purchase_common.js @@ -485,12 +485,12 @@ erpnext.buying.BuyingController = erpnext.TransactionController.extend({ // toggle columns var item_grid = this.frm.fields_dict[this.fname].grid; - var show = this.frm.doc.currency != company_currency; - $.each(["purchase_rate", "purchase_ref_rate", "amount", "rate"], function(i, fname) { - if(wn.meta.get_docfield(item_grid.doctype, fname)) - item_grid.set_column_disp(fname, show); + var fieldnames = $.map(["purchase_rate", "purchase_ref_rate", "amount", "rate"], function(fname) { + return wn.meta.get_docfield(item_grid.doctype, fname, me.frm.docname) ? fname : null; }); + item_grid.set_column_disp(fieldnames, this.frm.doc.currency != company_currency); + // set labels var $wrapper = $(this.frm.wrapper); $.each(field_label_map, function(fname, label) { diff --git a/public/js/feature_setup.js b/public/js/feature_setup.js index abd3370d87..add4bfda9a 100644 --- a/public/js/feature_setup.js +++ b/public/js/feature_setup.js @@ -209,8 +209,7 @@ $(document).bind('form_refresh', function() { if(fort=='fields') { hide_field(pscript.feature_dict[sys_feat][cur_frm.doc.doctype][fort]); } else if(cur_frm.fields_dict[fort]) { - for(grid_field in pscript.feature_dict[sys_feat][cur_frm.doc.doctype][fort]) - cur_frm.fields_dict[fort].grid.set_column_disp(pscript.feature_dict[sys_feat][cur_frm.doc.doctype][fort][grid_field], false); + cur_frm.fields_dict[fort].grid.set_column_disp(pscript.feature_dict[sys_feat][cur_frm.doc.doctype][fort], false); } else { msgprint('Grid "'+fort+'" does not exists'); } diff --git a/stock/doctype/delivery_note/delivery_note.js b/stock/doctype/delivery_note/delivery_note.js index e93e6d3a78..a006766179 100644 --- a/stock/doctype/delivery_note/delivery_note.js +++ b/stock/doctype/delivery_note/delivery_note.js @@ -46,8 +46,7 @@ erpnext.stock.DeliveryNoteController = erpnext.selling.SellingController.extend( // unhide expense_account and cost_center is auto_inventory_accounting enabled var aii_enabled = cint(sys_defaults.auto_inventory_accounting) - cur_frm.fields_dict[cur_frm.cscript.fname].grid.set_column_disp("expense_account", aii_enabled); - cur_frm.fields_dict[cur_frm.cscript.fname].grid.set_column_disp("cost_center", aii_enabled); + cur_frm.fields_dict[cur_frm.cscript.fname].grid.set_column_disp(["expense_account", "cost_center"], aii_enabled); if (this.frm.doc.docstatus===0) { cur_frm.add_custom_button(wn._('From Sales Order'), From 52b049145bb5dce6cef0b178f91a839dfab2c166 Mon Sep 17 00:00:00 2001 From: Anand Doshi Date: Thu, 25 Jul 2013 19:13:45 +0530 Subject: [PATCH 4/5] [fix] [minor] call refresh_fields after cur_frm.call when doc is passed --- accounts/doctype/sales_invoice/sales_invoice.js | 5 ++++- buying/doctype/purchase_common/purchase_common.js | 1 - selling/doctype/installation_note/installation_note.js | 6 ------ selling/doctype/opportunity/opportunity.js | 4 ---- selling/doctype/sales_common/sales_common.js | 1 - support/doctype/customer_issue/customer_issue.js | 3 --- .../doctype/maintenance_schedule/maintenance_schedule.js | 3 --- support/doctype/maintenance_visit/maintenance_visit.js | 3 --- support/doctype/support_ticket/support_ticket.js | 3 --- 9 files changed, 4 insertions(+), 25 deletions(-) diff --git a/accounts/doctype/sales_invoice/sales_invoice.js b/accounts/doctype/sales_invoice/sales_invoice.js index b61cbb0b4a..aa21d5dd7e 100644 --- a/accounts/doctype/sales_invoice/sales_invoice.js +++ b/accounts/doctype/sales_invoice/sales_invoice.js @@ -120,6 +120,7 @@ erpnext.accounts.SalesInvoiceController = erpnext.selling.SellingController.exte } // TODO toggle display of fields + cur_frm.cscript.hide_fields(this.frm.doc); }, debit_to: function() { @@ -162,7 +163,7 @@ $.extend(cur_frm.cscript, new erpnext.accounts.SalesInvoiceController({frm: cur_ // Hide Fields // ------------ -cur_frm.cscript.hide_fields = function(doc, cdt, cdn) { +cur_frm.cscript.hide_fields = function(doc) { par_flds = ['project_name', 'due_date', 'is_opening', 'conversion_rate', 'source', 'total_advance', 'gross_profit', 'gross_profit_percent', 'get_advances_received', @@ -189,6 +190,8 @@ cur_frm.cscript.hide_fields = function(doc, cdt, cdn) { var cp = wn.control_panel; if (cp.country == 'India') unhide_field(['c_form_applicable', 'c_form_no']); else hide_field(['c_form_applicable', 'c_form_no']); + + cur_frm.refresh_fields(); } diff --git a/buying/doctype/purchase_common/purchase_common.js b/buying/doctype/purchase_common/purchase_common.js index 494a9dcb2c..148ba1c920 100644 --- a/buying/doctype/purchase_common/purchase_common.js +++ b/buying/doctype/purchase_common/purchase_common.js @@ -90,7 +90,6 @@ erpnext.buying.BuyingController = erpnext.TransactionController.extend({ freeze: true, callback: function(r) { if(!r.exc) { - me.frm.refresh_fields(); if(me.frm.doc.price_list_name !== price_list_name) me.price_list_name(); } } diff --git a/selling/doctype/installation_note/installation_note.js b/selling/doctype/installation_note/installation_note.js index dce0a31252..5ad698a0ca 100644 --- a/selling/doctype/installation_note/installation_note.js +++ b/selling/doctype/installation_note/installation_note.js @@ -81,9 +81,6 @@ erpnext.selling.InstallationNote = wn.ui.form.Controller.extend({ this.frm.call({ doc: this.frm.doc, method: "set_customer_defaults", - callback: function(r) { - if(!r.exc) me.frm.refresh_fields(); - } }); // TODO shift this to depends_on @@ -105,9 +102,6 @@ erpnext.selling.InstallationNote = wn.ui.form.Controller.extend({ }, method: "get_customer_address", freeze: true, - callback: function(r) { - me.frm.refresh_fields(); - } }); } }, diff --git a/selling/doctype/opportunity/opportunity.js b/selling/doctype/opportunity/opportunity.js index 7c647c3f76..0ac22a116d 100644 --- a/selling/doctype/opportunity/opportunity.js +++ b/selling/doctype/opportunity/opportunity.js @@ -89,9 +89,6 @@ erpnext.selling.Opportunity = wn.ui.form.Controller.extend({ this.frm.call({ doc: this.frm.doc, method: "set_customer_defaults", - callback: function(r) { - if(!r.exc) me.frm.refresh_fields(); - } }); // TODO shift this to depends_on @@ -208,7 +205,6 @@ cur_frm.cscript['Declare Opportunity Lost'] = function(){ return; } dialog.hide(); - cur_frm.refresh(); }, btn: this }) diff --git a/selling/doctype/sales_common/sales_common.js b/selling/doctype/sales_common/sales_common.js index 9a13c4f98c..246d4a1ad3 100644 --- a/selling/doctype/sales_common/sales_common.js +++ b/selling/doctype/sales_common/sales_common.js @@ -142,7 +142,6 @@ erpnext.selling.SellingController = erpnext.TransactionController.extend({ freeze: true, callback: function(r) { if(!r.exc) { - me.frm.refresh_fields(); (me.frm.doc.price_list_name !== price_list_name) ? me.price_list_name() : me.price_list_currency(); diff --git a/support/doctype/customer_issue/customer_issue.js b/support/doctype/customer_issue/customer_issue.js index 96662b95c7..3620c7e10a 100644 --- a/support/doctype/customer_issue/customer_issue.js +++ b/support/doctype/customer_issue/customer_issue.js @@ -29,9 +29,6 @@ erpnext.support.CustomerIssue = wn.ui.form.Controller.extend({ this.frm.call({ doc: this.frm.doc, method: "set_customer_defaults", - callback: function(r) { - if(!r.exc) me.frm.refresh_fields(); - } }); // TODO shift this to depends_on diff --git a/support/doctype/maintenance_schedule/maintenance_schedule.js b/support/doctype/maintenance_schedule/maintenance_schedule.js index d84726986a..f8652d7e16 100644 --- a/support/doctype/maintenance_schedule/maintenance_schedule.js +++ b/support/doctype/maintenance_schedule/maintenance_schedule.js @@ -47,9 +47,6 @@ erpnext.support.MaintenanceSchedule = wn.ui.form.Controller.extend({ this.frm.call({ doc: this.frm.doc, method: "set_customer_defaults", - callback: function(r) { - if(!r.exc) me.frm.refresh_fields(); - } }); } }, diff --git a/support/doctype/maintenance_visit/maintenance_visit.js b/support/doctype/maintenance_visit/maintenance_visit.js index f3faf3f292..9f5fc5d915 100644 --- a/support/doctype/maintenance_visit/maintenance_visit.js +++ b/support/doctype/maintenance_visit/maintenance_visit.js @@ -65,9 +65,6 @@ erpnext.support.MaintenanceVisit = wn.ui.form.Controller.extend({ this.frm.call({ doc: this.frm.doc, method: "set_customer_defaults", - callback: function(r) { - if(!r.exc) me.frm.refresh_fields(); - } }); // TODO shift this to depends_on diff --git a/support/doctype/support_ticket/support_ticket.js b/support/doctype/support_ticket/support_ticket.js index bd7e6ccf1f..d8cc798c95 100644 --- a/support/doctype/support_ticket/support_ticket.js +++ b/support/doctype/support_ticket/support_ticket.js @@ -26,9 +26,6 @@ erpnext.support.CustomerIssue = wn.ui.form.Controller.extend({ this.frm.call({ doc: this.frm.doc, method: "set_customer_defaults", - callback: function(r) { - if(!r.exc) me.frm.refresh_fields(); - } }); } } From 23de6df72efe90dc58e087f907aaf85ea1135a5a Mon Sep 17 00:00:00 2001 From: Anand Doshi Date: Thu, 25 Jul 2013 19:30:13 +0530 Subject: [PATCH 5/5] [fix] [minor] replace single quote in territory name while creating territories in setup control --- setup/doctype/setup_control/setup_control.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/setup/doctype/setup_control/setup_control.py b/setup/doctype/setup_control/setup_control.py index b029da3e2b..5a1840436e 100644 --- a/setup/doctype/setup_control/setup_control.py +++ b/setup/doctype/setup_control/setup_control.py @@ -256,7 +256,7 @@ def create_territories(): if name and not webnotes.conn.exists("Territory", name): webnotes.bean({ "doctype": "Territory", - "territory_name": name, + "territory_name": name.replace("'", ""), "parent_territory": root_territory, "is_group": "No" }).insert()