From b327429db7509ff07a1d06bfdb5b207273a13641 Mon Sep 17 00:00:00 2001 From: Rohit Waghchaure Date: Mon, 30 Jan 2017 11:34:29 +0530 Subject: [PATCH 01/25] [Fix] Allow data import tool for cost center --- erpnext/accounts/doctype/cost_center/cost_center.json | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/erpnext/accounts/doctype/cost_center/cost_center.json b/erpnext/accounts/doctype/cost_center/cost_center.json index f590b5d5fa1..9aaaed2e623 100644 --- a/erpnext/accounts/doctype/cost_center/cost_center.json +++ b/erpnext/accounts/doctype/cost_center/cost_center.json @@ -278,14 +278,14 @@ "icon": "fa fa-money", "idx": 1, "image_view": 0, - "in_create": 1, + "in_create": 0, "in_dialog": 0, "is_submittable": 0, "issingle": 0, "istable": 0, "max_attachments": 0, "menu_index": 0, - "modified": "2016-11-07 05:20:40.282432", + "modified": "2017-01-30 11:27:36.615323", "modified_by": "Administrator", "module": "Accounts", "name": "Cost Center", From 3e2ecc342345021db6b4bcd6644da812c333ebd9 Mon Sep 17 00:00:00 2001 From: Kanchan Chauhan Date: Mon, 30 Jan 2017 16:42:35 +0530 Subject: [PATCH 02/25] [Fix] Account filter in Process Payroll and Salary Component --- .../process_payroll/process_payroll.js | 23 +++++++++++-------- .../salary_component/salary_component.js | 14 +++++++++-- 2 files changed, 25 insertions(+), 12 deletions(-) diff --git a/erpnext/hr/doctype/process_payroll/process_payroll.js b/erpnext/hr/doctype/process_payroll/process_payroll.js index cfb646d033f..128e533ba53 100644 --- a/erpnext/hr/doctype/process_payroll/process_payroll.js +++ b/erpnext/hr/doctype/process_payroll/process_payroll.js @@ -10,6 +10,19 @@ frappe.ui.form.on("Process Payroll", { frm.toggle_reqd(['payroll_frequency'], !frm.doc.salary_slip_based_on_timesheet); }, + setup: function(frm) { + frm.set_query("payment_account", function() { + var account_types = ["Bank", "Cash"]; + return { + filters: { + "account_type": ["in", account_types], + "is_group": 0, + "company": frm.doc.company + } + } + }) + }, + refresh: function(frm) { frm.disable_save(); }, @@ -50,16 +63,6 @@ frappe.ui.form.on("Process Payroll", { } }) } - }, - account: function(frm) { - var account_types = ["Bank", "Cash"]; - return { - filters: { - "account_type": ["in", account_types], - "is_group": 0, - "company": frm.doc.company - } - } } }) diff --git a/erpnext/hr/doctype/salary_component/salary_component.js b/erpnext/hr/doctype/salary_component/salary_component.js index 3ed566e41dd..870503753b9 100644 --- a/erpnext/hr/doctype/salary_component/salary_component.js +++ b/erpnext/hr/doctype/salary_component/salary_component.js @@ -2,7 +2,17 @@ // For license information, please see license.txt frappe.ui.form.on('Salary Component', { - refresh: function(frm) { - + setup: function(frm) { + frm.set_query("default_account", "accounts", function(doc, cdt, cdn) { + var d = locals[cdt][cdn]; + return { + filters: { + "account_type": "Expense Account", + "root_type": "Expense", + "is_group": 0, + "company": d.company + } + } + }) } }); From 20d2d7548a917718a7b3243f52df2bbfe5c557ff Mon Sep 17 00:00:00 2001 From: Nabin Hait Date: Mon, 6 Feb 2017 11:36:38 +0530 Subject: [PATCH 03/25] Update salary_component.js --- erpnext/hr/doctype/salary_component/salary_component.js | 1 - 1 file changed, 1 deletion(-) diff --git a/erpnext/hr/doctype/salary_component/salary_component.js b/erpnext/hr/doctype/salary_component/salary_component.js index 870503753b9..3a2492ca171 100644 --- a/erpnext/hr/doctype/salary_component/salary_component.js +++ b/erpnext/hr/doctype/salary_component/salary_component.js @@ -7,7 +7,6 @@ frappe.ui.form.on('Salary Component', { var d = locals[cdt][cdn]; return { filters: { - "account_type": "Expense Account", "root_type": "Expense", "is_group": 0, "company": d.company From c874a82559d19f8006703abfffcfaa1ebcbe38ae Mon Sep 17 00:00:00 2001 From: mbauskar Date: Mon, 6 Feb 2017 15:41:06 +0530 Subject: [PATCH 04/25] [minor] index out of range fixes for JE --- erpnext/accounts/doctype/journal_entry/journal_entry.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/erpnext/accounts/doctype/journal_entry/journal_entry.py b/erpnext/accounts/doctype/journal_entry/journal_entry.py index b31a304afb7..5cf2d9277cb 100644 --- a/erpnext/accounts/doctype/journal_entry/journal_entry.py +++ b/erpnext/accounts/doctype/journal_entry/journal_entry.py @@ -45,6 +45,9 @@ class JournalEntry(AccountsController): self.accounts = [account for account in self.accounts if not (account.debit_in_account_currency==0.0 and account.credit_in_account_currency==0.0)] + if not self.accounts: + frappe.throw("Debit or Credit amount is not found in account table") + def on_submit(self): self.check_credit_limit() self.make_gl_entries() From ea8fab52c6ec0a272b54e61f08bd089af3eab18f Mon Sep 17 00:00:00 2001 From: Nabin Hait Date: Mon, 6 Feb 2017 17:13:39 +0530 Subject: [PATCH 05/25] Get standard/historical valuation rate where missing, if item is not a sample item --- .../purchase_invoice_item.json | 30 +++++++- .../sales_invoice_item.json | 30 +++++++- erpnext/controllers/stock_controller.py | 54 +++++++++---- .../delivery_note_item.json | 30 +++++++- .../purchase_receipt_item.json | 30 +++++++- .../stock_entry_detail.json | 77 ++++++++++++++++++- erpnext/stock/stock_ledger.py | 19 +++-- 7 files changed, 238 insertions(+), 32 deletions(-) diff --git a/erpnext/accounts/doctype/purchase_invoice_item/purchase_invoice_item.json b/erpnext/accounts/doctype/purchase_invoice_item/purchase_invoice_item.json index 6f8e219f88e..eff5df58496 100755 --- a/erpnext/accounts/doctype/purchase_invoice_item/purchase_invoice_item.json +++ b/erpnext/accounts/doctype/purchase_invoice_item/purchase_invoice_item.json @@ -1315,6 +1315,34 @@ "set_only_once": 0, "unique": 0 }, + { + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fieldname": "is_sample_item", + "fieldtype": "Check", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "Is Sample Item", + "length": 0, + "no_copy": 1, + "permlevel": 0, + "precision": "", + "print_hide": 1, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "unique": 0 + }, { "allow_on_submit": 0, "bold": 0, @@ -1788,7 +1816,7 @@ "issingle": 0, "istable": 1, "max_attachments": 0, - "modified": "2016-11-16 16:04:52.465169", + "modified": "2017-02-06 17:05:03.737297", "modified_by": "Administrator", "module": "Accounts", "name": "Purchase Invoice Item", diff --git a/erpnext/accounts/doctype/sales_invoice_item/sales_invoice_item.json b/erpnext/accounts/doctype/sales_invoice_item/sales_invoice_item.json index 944230b1d00..c36f001e288 100644 --- a/erpnext/accounts/doctype/sales_invoice_item/sales_invoice_item.json +++ b/erpnext/accounts/doctype/sales_invoice_item/sales_invoice_item.json @@ -1381,6 +1381,34 @@ "set_only_once": 0, "unique": 0 }, + { + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fieldname": "is_sample_item", + "fieldtype": "Check", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "Is Sample Item", + "length": 0, + "no_copy": 1, + "permlevel": 0, + "precision": "", + "print_hide": 1, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "unique": 0 + }, { "allow_on_submit": 0, "bold": 0, @@ -1882,7 +1910,7 @@ "issingle": 0, "istable": 1, "max_attachments": 0, - "modified": "2016-11-16 16:04:02.438952", + "modified": "2017-02-06 17:01:16.812686", "modified_by": "Administrator", "module": "Accounts", "name": "Sales Invoice Item", diff --git a/erpnext/controllers/stock_controller.py b/erpnext/controllers/stock_controller.py index 9a3d82ee910..6e3047c3e16 100644 --- a/erpnext/controllers/stock_controller.py +++ b/erpnext/controllers/stock_controller.py @@ -53,9 +53,15 @@ class StockController(AccountsController): self.check_expense_account(item_row) - if not sle.stock_value_difference: - self.update_stock_ledger_entries(sle) - self.validate_negative_stock(sle) + # If item is not a sample item + # and ( valuation rate not mentioned in an incoming entry + # or incoming entry not found while delivering the item), + # try to pick valuation rate from previous sle or Item master and update in SLE + # Otherwise, throw an exception + + if not sle.stock_value_difference and sle.voucher_type != "Stock Reconciliation" \ + and not item_row.get("is_sample_item"): + sle = self.update_stock_ledger_entries(sle) gl_list.append(self.get_gl_dict({ "account": warehouse_account[sle.warehouse]["name"], @@ -90,18 +96,23 @@ class StockController(AccountsController): def update_stock_ledger_entries(self, sle): sle.valuation_rate = get_valuation_rate(sle.item_code, sle.warehouse, sle.voucher_type, sle.voucher_no) + sle.stock_value = flt(sle.qty_after_transaction) * flt(sle.valuation_rate) - sle.stock_value_difference = sle.stock_value + sle.stock_value_difference = flt(sle.actual_qty) * flt(sle.valuation_rate) + if sle.name: - frappe.db.sql(""" update `tabStock Ledger Entry` set stock_value = %(stock_value)s, - valuation_rate = %(valuation_rate)s, stock_value_difference = %(stock_value_difference)s - where name = %(name)s""", (sle)) - - def validate_negative_stock(self, sle): - if sle.qty_after_transaction < 0 and sle.actual_qty < 0: - frappe.throw(_("Valuation rate not found for the Item {0}, which is required to do accounting entries (for booking expenses). Please create an incoming stock transaction or mention valuation rate in Item record, and then try submiting {1} {2}") - .format(sle.item_code, sle.voucher_type, sle.voucher_no)) - + frappe.db.sql(""" + update + `tabStock Ledger Entry` + set + stock_value = %(stock_value)s, + valuation_rate = %(valuation_rate)s, + stock_value_difference = %(stock_value_difference)s + where + name = %(name)s""", (sle)) + + return sle + def get_voucher_details(self, default_expense_account, default_cost_center, sle_map): if self.doctype == "Stock Reconciliation": return [frappe._dict({ "name": voucher_detail_no, "expense_account": default_expense_account, @@ -149,11 +160,20 @@ class StockController(AccountsController): def get_stock_ledger_details(self): stock_ledger = {} - for sle in frappe.db.sql("""select name, warehouse, stock_value_difference, - voucher_detail_no, item_code, posting_date, posting_time, actual_qty, qty_after_transaction - from `tabStock Ledger Entry` where voucher_type=%s and voucher_no=%s""", - (self.doctype, self.name), as_dict=True): + stock_ledger_entries = frappe.db.sql(""" + select + name, warehouse, stock_value_difference, valuation_rate + voucher_detail_no, item_code, posting_date, posting_time, + actual_qty, qty_after_transaction, voucher_type, voucher_no + from + `tabStock Ledger Entry` + where + voucher_type=%s and voucher_no=%s + """, (self.doctype, self.name), as_dict=True) + + for sle in stock_ledger_entries: stock_ledger.setdefault(sle.voucher_detail_no, []).append(sle) + return stock_ledger def make_adjustment_entry(self, expected_gle, voucher_obj): diff --git a/erpnext/stock/doctype/delivery_note_item/delivery_note_item.json b/erpnext/stock/doctype/delivery_note_item/delivery_note_item.json index e1ac06e1131..9108edd7c0c 100644 --- a/erpnext/stock/doctype/delivery_note_item/delivery_note_item.json +++ b/erpnext/stock/doctype/delivery_note_item/delivery_note_item.json @@ -1476,6 +1476,34 @@ "unique": 0, "width": "120px" }, + { + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fieldname": "is_sample_item", + "fieldtype": "Check", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "Is Sample Item", + "length": 0, + "no_copy": 1, + "permlevel": 0, + "precision": "", + "print_hide": 1, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "unique": 0 + }, { "allow_on_submit": 0, "bold": 0, @@ -1691,7 +1719,7 @@ "issingle": 0, "istable": 1, "max_attachments": 0, - "modified": "2016-12-24 12:33:37.728117", + "modified": "2017-02-06 17:00:24.354000", "modified_by": "Administrator", "module": "Stock", "name": "Delivery Note Item", diff --git a/erpnext/stock/doctype/purchase_receipt_item/purchase_receipt_item.json b/erpnext/stock/doctype/purchase_receipt_item/purchase_receipt_item.json index d8449f1ebb8..43e2f3be788 100755 --- a/erpnext/stock/doctype/purchase_receipt_item/purchase_receipt_item.json +++ b/erpnext/stock/doctype/purchase_receipt_item/purchase_receipt_item.json @@ -1574,6 +1574,34 @@ "set_only_once": 0, "unique": 0 }, + { + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fieldname": "is_sample_item", + "fieldtype": "Check", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "Is Sample Item", + "length": 0, + "no_copy": 1, + "permlevel": 0, + "precision": "", + "print_hide": 1, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "unique": 0 + }, { "allow_on_submit": 0, "bold": 0, @@ -1885,7 +1913,7 @@ "issingle": 0, "istable": 1, "max_attachments": 0, - "modified": "2016-11-16 16:04:21.778869", + "modified": "2017-02-06 17:04:23.305884", "modified_by": "Administrator", "module": "Stock", "name": "Purchase Receipt Item", diff --git a/erpnext/stock/doctype/stock_entry_detail/stock_entry_detail.json b/erpnext/stock/doctype/stock_entry_detail/stock_entry_detail.json index ed1843e75d7..fadaeb09fdc 100644 --- a/erpnext/stock/doctype/stock_entry_detail/stock_entry_detail.json +++ b/erpnext/stock/doctype/stock_entry_detail/stock_entry_detail.json @@ -10,6 +10,7 @@ "doctype": "DocType", "document_type": "Other", "editable_grid": 1, + "engine": "InnoDB", "fields": [ { "allow_on_submit": 0, @@ -23,6 +24,7 @@ "ignore_xss_filter": 0, "in_filter": 0, "in_list_view": 0, + "in_standard_filter": 0, "label": "Barcode", "length": 0, "no_copy": 0, @@ -50,6 +52,7 @@ "ignore_xss_filter": 0, "in_filter": 0, "in_list_view": 0, + "in_standard_filter": 0, "length": 0, "no_copy": 0, "permlevel": 0, @@ -76,6 +79,7 @@ "ignore_xss_filter": 0, "in_filter": 1, "in_list_view": 1, + "in_standard_filter": 0, "label": "Source Warehouse", "length": 0, "no_copy": 0, @@ -105,6 +109,7 @@ "ignore_xss_filter": 0, "in_filter": 0, "in_list_view": 0, + "in_standard_filter": 0, "length": 0, "no_copy": 0, "permlevel": 0, @@ -130,6 +135,7 @@ "ignore_xss_filter": 0, "in_filter": 1, "in_list_view": 1, + "in_standard_filter": 0, "label": "Target Warehouse", "length": 0, "no_copy": 0, @@ -159,6 +165,7 @@ "ignore_xss_filter": 0, "in_filter": 0, "in_list_view": 0, + "in_standard_filter": 0, "length": 0, "no_copy": 0, "permlevel": 0, @@ -184,6 +191,7 @@ "ignore_xss_filter": 0, "in_filter": 1, "in_list_view": 1, + "in_standard_filter": 0, "label": "Item Code", "length": 0, "no_copy": 0, @@ -213,6 +221,7 @@ "ignore_xss_filter": 0, "in_filter": 0, "in_list_view": 0, + "in_standard_filter": 0, "length": 0, "no_copy": 0, "permlevel": 0, @@ -238,6 +247,7 @@ "ignore_xss_filter": 0, "in_filter": 0, "in_list_view": 0, + "in_standard_filter": 0, "label": "Item Name", "length": 0, "no_copy": 0, @@ -264,6 +274,7 @@ "ignore_xss_filter": 0, "in_filter": 0, "in_list_view": 0, + "in_standard_filter": 0, "label": "Description", "length": 0, "no_copy": 0, @@ -291,6 +302,7 @@ "ignore_xss_filter": 0, "in_filter": 0, "in_list_view": 0, + "in_standard_filter": 0, "label": "Description", "length": 0, "no_copy": 0, @@ -321,6 +333,7 @@ "ignore_xss_filter": 0, "in_filter": 0, "in_list_view": 0, + "in_standard_filter": 0, "length": 0, "no_copy": 0, "permlevel": 0, @@ -347,6 +360,7 @@ "ignore_xss_filter": 0, "in_filter": 0, "in_list_view": 0, + "in_standard_filter": 0, "label": "Image", "length": 0, "no_copy": 0, @@ -374,6 +388,7 @@ "ignore_xss_filter": 0, "in_filter": 0, "in_list_view": 0, + "in_standard_filter": 0, "label": "Image View", "length": 0, "no_copy": 0, @@ -402,6 +417,7 @@ "ignore_xss_filter": 0, "in_filter": 0, "in_list_view": 0, + "in_standard_filter": 0, "label": "Quantity and Rate", "length": 0, "no_copy": 0, @@ -420,7 +436,7 @@ "allow_on_submit": 0, "bold": 1, "collapsible": 0, - "columns": 1, + "columns": 3, "fieldname": "qty", "fieldtype": "Float", "hidden": 0, @@ -428,6 +444,7 @@ "ignore_xss_filter": 0, "in_filter": 0, "in_list_view": 1, + "in_standard_filter": 0, "label": "Qty", "length": 0, "no_copy": 0, @@ -448,14 +465,15 @@ "allow_on_submit": 0, "bold": 1, "collapsible": 0, - "columns": 2, + "columns": 0, "fieldname": "basic_rate", "fieldtype": "Currency", "hidden": 0, "ignore_user_permissions": 0, "ignore_xss_filter": 0, "in_filter": 0, - "in_list_view": 1, + "in_list_view": 0, + "in_standard_filter": 0, "label": "Basic Rate (as per Stock UOM)", "length": 0, "no_copy": 0, @@ -485,6 +503,7 @@ "ignore_xss_filter": 0, "in_filter": 0, "in_list_view": 0, + "in_standard_filter": 0, "label": "Basic Amount", "length": 0, "no_copy": 0, @@ -513,6 +532,7 @@ "ignore_xss_filter": 0, "in_filter": 0, "in_list_view": 0, + "in_standard_filter": 0, "label": "Additional Cost", "length": 0, "no_copy": 0, @@ -541,6 +561,7 @@ "ignore_xss_filter": 0, "in_filter": 0, "in_list_view": 0, + "in_standard_filter": 0, "label": "Amount", "length": 0, "no_copy": 0, @@ -570,6 +591,7 @@ "ignore_xss_filter": 0, "in_filter": 0, "in_list_view": 0, + "in_standard_filter": 0, "label": "Valuation Rate", "length": 0, "no_copy": 0, @@ -598,6 +620,7 @@ "ignore_xss_filter": 0, "in_filter": 0, "in_list_view": 0, + "in_standard_filter": 0, "length": 0, "no_copy": 0, "permlevel": 0, @@ -623,6 +646,7 @@ "ignore_xss_filter": 0, "in_filter": 0, "in_list_view": 0, + "in_standard_filter": 0, "label": "UOM", "length": 0, "no_copy": 0, @@ -652,6 +676,7 @@ "ignore_xss_filter": 0, "in_filter": 0, "in_list_view": 0, + "in_standard_filter": 0, "label": "Conversion Factor", "length": 0, "no_copy": 0, @@ -680,6 +705,7 @@ "ignore_xss_filter": 0, "in_filter": 0, "in_list_view": 0, + "in_standard_filter": 0, "label": "Stock UOM", "length": 0, "no_copy": 0, @@ -709,6 +735,7 @@ "ignore_xss_filter": 0, "in_filter": 0, "in_list_view": 0, + "in_standard_filter": 0, "label": "Qty as per Stock UOM", "length": 0, "no_copy": 0, @@ -737,6 +764,7 @@ "ignore_xss_filter": 0, "in_filter": 0, "in_list_view": 0, + "in_standard_filter": 0, "label": "Serial No / Batch", "length": 0, "no_copy": 0, @@ -763,6 +791,7 @@ "ignore_xss_filter": 0, "in_filter": 0, "in_list_view": 0, + "in_standard_filter": 0, "label": "Serial No", "length": 0, "no_copy": 1, @@ -791,6 +820,7 @@ "ignore_xss_filter": 0, "in_filter": 0, "in_list_view": 0, + "in_standard_filter": 0, "length": 0, "no_copy": 0, "permlevel": 0, @@ -816,6 +846,7 @@ "ignore_xss_filter": 0, "in_filter": 0, "in_list_view": 0, + "in_standard_filter": 0, "label": "Batch No", "length": 0, "no_copy": 0, @@ -845,6 +876,7 @@ "ignore_xss_filter": 0, "in_filter": 0, "in_list_view": 0, + "in_standard_filter": 0, "label": "Accounting", "length": 0, "no_copy": 0, @@ -872,6 +904,7 @@ "ignore_xss_filter": 0, "in_filter": 0, "in_list_view": 0, + "in_standard_filter": 0, "label": "Difference Account", "length": 0, "no_copy": 0, @@ -899,6 +932,7 @@ "ignore_xss_filter": 0, "in_filter": 0, "in_list_view": 0, + "in_standard_filter": 0, "length": 0, "no_copy": 0, "permlevel": 0, @@ -926,6 +960,7 @@ "ignore_xss_filter": 0, "in_filter": 0, "in_list_view": 0, + "in_standard_filter": 0, "label": "Cost Center", "length": 0, "no_copy": 0, @@ -953,6 +988,7 @@ "ignore_xss_filter": 0, "in_filter": 0, "in_list_view": 0, + "in_standard_filter": 0, "label": "More Information", "length": 0, "no_copy": 0, @@ -967,6 +1003,34 @@ "set_only_once": 0, "unique": 0 }, + { + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fieldname": "is_sample_item", + "fieldtype": "Check", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "Is Sample Item", + "length": 0, + "no_copy": 1, + "permlevel": 0, + "precision": "", + "print_hide": 1, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "unique": 0 + }, { "allow_on_submit": 1, "bold": 0, @@ -979,6 +1043,7 @@ "ignore_xss_filter": 0, "in_filter": 1, "in_list_view": 0, + "in_standard_filter": 0, "label": "Actual Qty (at source/target)", "length": 0, "no_copy": 1, @@ -1008,6 +1073,7 @@ "ignore_xss_filter": 0, "in_filter": 0, "in_list_view": 0, + "in_standard_filter": 0, "label": "BOM No", "length": 0, "no_copy": 0, @@ -1035,6 +1101,7 @@ "ignore_xss_filter": 0, "in_filter": 0, "in_list_view": 0, + "in_standard_filter": 0, "length": 0, "no_copy": 0, "permlevel": 0, @@ -1061,6 +1128,7 @@ "ignore_xss_filter": 0, "in_filter": 0, "in_list_view": 0, + "in_standard_filter": 0, "label": "Material Request", "length": 0, "no_copy": 1, @@ -1088,6 +1156,7 @@ "ignore_xss_filter": 0, "in_filter": 0, "in_list_view": 0, + "in_standard_filter": 0, "label": "Material Request Item", "length": 0, "no_copy": 1, @@ -1114,7 +1183,7 @@ "issingle": 0, "istable": 1, "max_attachments": 0, - "modified": "2016-11-27 15:19:26.597414", + "modified": "2017-02-06 17:08:06.841514", "modified_by": "Administrator", "module": "Stock", "name": "Stock Entry Detail", diff --git a/erpnext/stock/stock_ledger.py b/erpnext/stock/stock_ledger.py index a4cc512c9f1..c387e0f05a5 100644 --- a/erpnext/stock/stock_ledger.py +++ b/erpnext/stock/stock_ledger.py @@ -258,11 +258,17 @@ class update_entries_after(object): if not self.valuation_rate and actual_qty > 0: self.valuation_rate = sle.incoming_rate + + # Get valuation rate from previous SLE or Item master, if item is not a sample item + if not self.valuation_rate and sle.voucher_detail_no: + ref_item_dt = sle.voucher_type + " Detail" if sle.voucher_type == "Stock Entry" else " Item" + + is_sample_item = frappe.db.get_value(ref_item_dt, sle.voucher_detail_no, "is_sample_item") + + if not is_sample_item: + self.valuation_rate = get_valuation_rate(sle.item_code, sle.warehouse, + sle.voucher_type, sle.voucher_no, self.allow_zero_rate) - if not self.valuation_rate: - self.valuation_rate = get_valuation_rate(sle.item_code, sle.warehouse, - sle.voucher_type, sle.voucher_no, self.allow_zero_rate) - def get_fifo_values(self, sle): incoming_rate = flt(sle.incoming_rate) actual_qty = flt(sle.actual_qty) @@ -287,7 +293,7 @@ class update_entries_after(object): if not self.stock_queue: # Get valuation rate from last sle if exists or from valuation rate field in item master _rate = get_valuation_rate(sle.item_code, sle.warehouse, - sle.voucher_type, sle.voucher_no, self.allow_zero_rate) + sle.voucher_type, sle.voucher_no, self.allow_zero_rate) self.stock_queue.append([0, _rate]) index = None @@ -432,7 +438,6 @@ def get_valuation_rate(item_code, warehouse, voucher_type, voucher_no, allow_zer if not allow_zero_rate and not valuation_rate \ and cint(frappe.db.get_value("Accounts Settings", None, "auto_accounting_for_stock")): - frappe.throw(_("Valuation rate not found for the Item {0}, which is required to do accounting entries (for booking expenses). Please create an incoming stock transaction or mention valuation rate in Item record, and then try submiting {1} {2}") - .format(item_code, voucher_type, voucher_no)) + frappe.throw(_("Valuation rate not found for the Item {0}, which is required to do accounting entries. If the item is transacting as a sample item in {1} {2}, please mention that in the {1} Item table. Otherwise, please create an incoming stock transaction for the item or mention valuation rate in the Item record, and then try submiting this entry").format(item_code, voucher_type, voucher_no)) return valuation_rate From 0a6aaf42573f7968f619b89d9eb17c3cf3ff0466 Mon Sep 17 00:00:00 2001 From: Nabin Hait Date: Tue, 7 Feb 2017 01:23:26 +0530 Subject: [PATCH 06/25] Get standard/historical valuation rate where missing: some minor fixes --- .../purchase_invoice_item.json | 4 ++-- .../sales_invoice_item.json | 4 ++-- erpnext/controllers/stock_controller.py | 16 +++++++------- .../delivery_note_item.json | 4 ++-- .../purchase_receipt_item.json | 4 ++-- .../stock_entry_detail.json | 4 ++-- erpnext/stock/stock_ledger.py | 22 ++++++++++++------- 7 files changed, 32 insertions(+), 26 deletions(-) diff --git a/erpnext/accounts/doctype/purchase_invoice_item/purchase_invoice_item.json b/erpnext/accounts/doctype/purchase_invoice_item/purchase_invoice_item.json index eff5df58496..a91d97409cd 100755 --- a/erpnext/accounts/doctype/purchase_invoice_item/purchase_invoice_item.json +++ b/erpnext/accounts/doctype/purchase_invoice_item/purchase_invoice_item.json @@ -1316,7 +1316,7 @@ "unique": 0 }, { - "allow_on_submit": 0, + "allow_on_submit": 1, "bold": 0, "collapsible": 0, "columns": 0, @@ -1816,7 +1816,7 @@ "issingle": 0, "istable": 1, "max_attachments": 0, - "modified": "2017-02-06 17:05:03.737297", + "modified": "2017-02-07 01:21:03.737800", "modified_by": "Administrator", "module": "Accounts", "name": "Purchase Invoice Item", diff --git a/erpnext/accounts/doctype/sales_invoice_item/sales_invoice_item.json b/erpnext/accounts/doctype/sales_invoice_item/sales_invoice_item.json index c36f001e288..bf6d9868a2c 100644 --- a/erpnext/accounts/doctype/sales_invoice_item/sales_invoice_item.json +++ b/erpnext/accounts/doctype/sales_invoice_item/sales_invoice_item.json @@ -1382,7 +1382,7 @@ "unique": 0 }, { - "allow_on_submit": 0, + "allow_on_submit": 1, "bold": 0, "collapsible": 0, "columns": 0, @@ -1910,7 +1910,7 @@ "issingle": 0, "istable": 1, "max_attachments": 0, - "modified": "2017-02-06 17:01:16.812686", + "modified": "2017-02-07 01:21:47.142162", "modified_by": "Administrator", "module": "Accounts", "name": "Sales Invoice Item", diff --git a/erpnext/controllers/stock_controller.py b/erpnext/controllers/stock_controller.py index 6e3047c3e16..b08826a5c95 100644 --- a/erpnext/controllers/stock_controller.py +++ b/erpnext/controllers/stock_controller.py @@ -43,7 +43,7 @@ class StockController(AccountsController): gl_list = [] warehouse_with_no_account = [] - + for item_row in voucher_details: sle_list = sle_map.get(item_row.name) if sle_list: @@ -58,9 +58,10 @@ class StockController(AccountsController): # or incoming entry not found while delivering the item), # try to pick valuation rate from previous sle or Item master and update in SLE # Otherwise, throw an exception - - if not sle.stock_value_difference and sle.voucher_type != "Stock Reconciliation" \ + + if not sle.stock_value_difference and self.doctype != "Stock Reconciliation" \ and not item_row.get("is_sample_item"): + sle = self.update_stock_ledger_entries(sle) gl_list.append(self.get_gl_dict({ @@ -95,7 +96,7 @@ class StockController(AccountsController): def update_stock_ledger_entries(self, sle): sle.valuation_rate = get_valuation_rate(sle.item_code, sle.warehouse, - sle.voucher_type, sle.voucher_no) + self.doctype, self.name) sle.stock_value = flt(sle.qty_after_transaction) * flt(sle.valuation_rate) sle.stock_value_difference = flt(sle.actual_qty) * flt(sle.valuation_rate) @@ -162,18 +163,17 @@ class StockController(AccountsController): stock_ledger = {} stock_ledger_entries = frappe.db.sql(""" select - name, warehouse, stock_value_difference, valuation_rate + name, warehouse, stock_value_difference, valuation_rate, voucher_detail_no, item_code, posting_date, posting_time, - actual_qty, qty_after_transaction, voucher_type, voucher_no + actual_qty, qty_after_transaction from `tabStock Ledger Entry` where voucher_type=%s and voucher_no=%s """, (self.doctype, self.name), as_dict=True) - + for sle in stock_ledger_entries: stock_ledger.setdefault(sle.voucher_detail_no, []).append(sle) - return stock_ledger def make_adjustment_entry(self, expected_gle, voucher_obj): diff --git a/erpnext/stock/doctype/delivery_note_item/delivery_note_item.json b/erpnext/stock/doctype/delivery_note_item/delivery_note_item.json index 9108edd7c0c..1147d8d5e01 100644 --- a/erpnext/stock/doctype/delivery_note_item/delivery_note_item.json +++ b/erpnext/stock/doctype/delivery_note_item/delivery_note_item.json @@ -1477,7 +1477,7 @@ "width": "120px" }, { - "allow_on_submit": 0, + "allow_on_submit": 1, "bold": 0, "collapsible": 0, "columns": 0, @@ -1719,7 +1719,7 @@ "issingle": 0, "istable": 1, "max_attachments": 0, - "modified": "2017-02-06 17:00:24.354000", + "modified": "2017-02-07 01:22:03.047137", "modified_by": "Administrator", "module": "Stock", "name": "Delivery Note Item", diff --git a/erpnext/stock/doctype/purchase_receipt_item/purchase_receipt_item.json b/erpnext/stock/doctype/purchase_receipt_item/purchase_receipt_item.json index 43e2f3be788..590371397e2 100755 --- a/erpnext/stock/doctype/purchase_receipt_item/purchase_receipt_item.json +++ b/erpnext/stock/doctype/purchase_receipt_item/purchase_receipt_item.json @@ -1575,7 +1575,7 @@ "unique": 0 }, { - "allow_on_submit": 0, + "allow_on_submit": 1, "bold": 0, "collapsible": 0, "columns": 0, @@ -1913,7 +1913,7 @@ "issingle": 0, "istable": 1, "max_attachments": 0, - "modified": "2017-02-06 17:04:23.305884", + "modified": "2017-02-07 01:21:36.348032", "modified_by": "Administrator", "module": "Stock", "name": "Purchase Receipt Item", diff --git a/erpnext/stock/doctype/stock_entry_detail/stock_entry_detail.json b/erpnext/stock/doctype/stock_entry_detail/stock_entry_detail.json index fadaeb09fdc..34b3c85f716 100644 --- a/erpnext/stock/doctype/stock_entry_detail/stock_entry_detail.json +++ b/erpnext/stock/doctype/stock_entry_detail/stock_entry_detail.json @@ -1004,7 +1004,7 @@ "unique": 0 }, { - "allow_on_submit": 0, + "allow_on_submit": 1, "bold": 0, "collapsible": 0, "columns": 0, @@ -1183,7 +1183,7 @@ "issingle": 0, "istable": 1, "max_attachments": 0, - "modified": "2017-02-06 17:08:06.841514", + "modified": "2017-02-07 01:21:14.367586", "modified_by": "Administrator", "module": "Stock", "name": "Stock Entry Detail", diff --git a/erpnext/stock/stock_ledger.py b/erpnext/stock/stock_ledger.py index c387e0f05a5..10722cc0d9b 100644 --- a/erpnext/stock/stock_ledger.py +++ b/erpnext/stock/stock_ledger.py @@ -261,10 +261,7 @@ class update_entries_after(object): # Get valuation rate from previous SLE or Item master, if item is not a sample item if not self.valuation_rate and sle.voucher_detail_no: - ref_item_dt = sle.voucher_type + " Detail" if sle.voucher_type == "Stock Entry" else " Item" - - is_sample_item = frappe.db.get_value(ref_item_dt, sle.voucher_detail_no, "is_sample_item") - + is_sample_item = self.check_if_sample_item(sle.voucher_type, sle.voucher_detail_no) if not is_sample_item: self.valuation_rate = get_valuation_rate(sle.item_code, sle.warehouse, sle.voucher_type, sle.voucher_no, self.allow_zero_rate) @@ -292,8 +289,13 @@ class update_entries_after(object): while qty_to_pop: if not self.stock_queue: # Get valuation rate from last sle if exists or from valuation rate field in item master - _rate = get_valuation_rate(sle.item_code, sle.warehouse, - sle.voucher_type, sle.voucher_no, self.allow_zero_rate) + is_sample_item = self.check_if_sample_item(sle.voucher_type, sle.voucher_detail_no) + if not is_sample_item: + _rate = get_valuation_rate(sle.item_code, sle.warehouse, + sle.voucher_type, sle.voucher_no, self.allow_zero_rate) + else: + _rate = 0 + self.stock_queue.append([0, _rate]) index = None @@ -339,7 +341,11 @@ class update_entries_after(object): if not self.stock_queue: self.stock_queue.append([0, sle.incoming_rate or sle.outgoing_rate or self.valuation_rate]) - + + def check_if_sample_item(self, voucher_type, voucher_detail_no): + ref_item_dt = voucher_type + (" Detail" if voucher_type == "Stock Entry" else " Item") + return frappe.db.get_value(ref_item_dt, voucher_detail_no, "is_sample_item") + def get_sle_before_datetime(self): """get previous stock ledger entry before current time-bucket""" return get_stock_ledger_entries(self.args, "<", "desc", "limit 1", for_update=False) @@ -438,6 +444,6 @@ def get_valuation_rate(item_code, warehouse, voucher_type, voucher_no, allow_zer if not allow_zero_rate and not valuation_rate \ and cint(frappe.db.get_value("Accounts Settings", None, "auto_accounting_for_stock")): - frappe.throw(_("Valuation rate not found for the Item {0}, which is required to do accounting entries. If the item is transacting as a sample item in {1} {2}, please mention that in the {1} Item table. Otherwise, please create an incoming stock transaction for the item or mention valuation rate in the Item record, and then try submiting this entry").format(item_code, voucher_type, voucher_no)) + frappe.throw(_("Valuation rate not found for the Item {0}, which is required to do accounting entries for {1} {2}. If the item is transacting as a sample item in the {1}, please mention that in the {1} Item table. Otherwise, please create an incoming stock transaction for the item or mention valuation rate in the Item record, and then try submiting/cancelling this entry").format(item_code, voucher_type, voucher_no)) return valuation_rate From b3489548a98685a959b5d027d1f5e071acf9cce4 Mon Sep 17 00:00:00 2001 From: Rohit Waghchaure Date: Wed, 8 Feb 2017 11:20:04 +0530 Subject: [PATCH 07/25] minor fix --- .../bank_reconciliation/bank_reconciliation.py | 3 +++ .../profitability_analysis.py | 18 ++++++++++-------- erpnext/config/learn.py | 7 +------ 3 files changed, 14 insertions(+), 14 deletions(-) diff --git a/erpnext/accounts/doctype/bank_reconciliation/bank_reconciliation.py b/erpnext/accounts/doctype/bank_reconciliation/bank_reconciliation.py index abc6ebaf9c0..11dcfe7537f 100644 --- a/erpnext/accounts/doctype/bank_reconciliation/bank_reconciliation.py +++ b/erpnext/accounts/doctype/bank_reconciliation/bank_reconciliation.py @@ -74,6 +74,9 @@ class BankReconciliation(Document): clearance_date_updated = False for d in self.get('payment_entries'): if d.clearance_date: + if not d.payment_document: + frappe.throw(_("Row #{0}: Payment document is required to complete the trasaction")) + if d.cheque_date and getdate(d.clearance_date) < getdate(d.cheque_date): frappe.throw(_("Row #{0}: Clearance date {1} cannot be before Cheque Date {2}") .format(d.idx, d.clearance_date, d.cheque_date)) diff --git a/erpnext/accounts/report/profitability_analysis/profitability_analysis.py b/erpnext/accounts/report/profitability_analysis/profitability_analysis.py index 4f9fd15f666..6d952374af8 100644 --- a/erpnext/accounts/report/profitability_analysis/profitability_analysis.py +++ b/erpnext/accounts/report/profitability_analysis/profitability_analysis.py @@ -11,9 +11,11 @@ from erpnext.accounts.report.trial_balance.trial_balance import validate_filters value_fields = ("income", "expense", "gross_profit_loss") def execute(filters=None): + if not filters.get('based_on'): filters["based_on"] = 'Cost Center' + based_on = filters.based_on.replace(' ', '_').lower() validate_filters(filters) - accounts = get_accounts_data(based_on, filters.company) + accounts = get_accounts_data(based_on, filters.get("company")) data = get_data(accounts, filters, based_on) columns = get_columns(filters) return columns, data @@ -27,14 +29,14 @@ def get_accounts_data(based_on, company): def get_data(accounts, filters, based_on): if not accounts: - return None + return [] accounts, accounts_by_name, parent_children_map = filter_accounts(accounts) gl_entries_by_account = {} - set_gl_entries_by_account(filters.company, filters.from_date, - filters.to_date, based_on, gl_entries_by_account, ignore_closing_entries=not flt(filters.with_period_closing_entry)) + set_gl_entries_by_account(filters.get("company"), filters.get("from_date"), + filters.get("to_date"), based_on, gl_entries_by_account, ignore_closing_entries=not flt(filters.get("with_period_closing_entry"))) total_row = calculate_values(accounts, gl_entries_by_account, filters) accumulate_values_into_parents(accounts, accounts_by_name) @@ -90,7 +92,7 @@ def accumulate_values_into_parents(accounts, accounts_by_name): def prepare_data(accounts, filters, total_row, parent_children_map, based_on): data = [] - company_currency = frappe.db.get_value("Company", filters.company, "default_currency") + company_currency = frappe.db.get_value("Company", filters.get("company"), "default_currency") for d in accounts: has_value = False @@ -99,7 +101,7 @@ def prepare_data(accounts, filters, total_row, parent_children_map, based_on): "account": d.name, "parent_account": d.parent_account, "indent": d.indent, - "fiscal_year": filters.fiscal_year, + "fiscal_year": filters.get("fiscal_year"), "currency": company_currency, "based_on": based_on } @@ -122,9 +124,9 @@ def get_columns(filters): return [ { "fieldname": "account", - "label": _(filters.based_on), + "label": _(filters.get("based_on")), "fieldtype": "Link", - "options": filters.based_on, + "options": filters.get("based_on"), "width": 300 }, { diff --git a/erpnext/config/learn.py b/erpnext/config/learn.py index 426449ba69c..86db8081d75 100644 --- a/erpnext/config/learn.py +++ b/erpnext/config/learn.py @@ -44,7 +44,7 @@ def get_data(): }, { "type": "help", - "label": _("Setting up Email"), + "label": _("Setting up Email Account"), "youtube_id": "YFYe0DrB95o" }, { @@ -62,11 +62,6 @@ def get_data(): "label": _("Workflow"), "youtube_id": "yObJUg9FxFs" }, - { - "type": "help", - "label": _("Email Account"), - "youtube_id": "YFYe0DrB95o" - }, { "type": "help", "label": _("File Manager"), From 57e97c06e6982f2ce89815529d4f8d0d12ae7c8b Mon Sep 17 00:00:00 2001 From: Nabin Hait Date: Wed, 8 Feb 2017 12:02:47 +0600 Subject: [PATCH 08/25] bumped to version 7.2.19 --- erpnext/__init__.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/erpnext/__init__.py b/erpnext/__init__.py index 360c4c70d41..706a8e5b2af 100644 --- a/erpnext/__init__.py +++ b/erpnext/__init__.py @@ -2,7 +2,7 @@ from __future__ import unicode_literals import frappe -__version__ = '7.2.18' +__version__ = '7.2.19' def get_default_company(user=None): '''Get default company for user''' From d487bf77e1d483c54bd1a5f6f30c9c60b20f4840 Mon Sep 17 00:00:00 2001 From: mbauskar Date: Thu, 9 Feb 2017 12:36:44 +0530 Subject: [PATCH 09/25] [minor] payment entry company trigger --- erpnext/accounts/doctype/payment_entry/payment_entry.js | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/erpnext/accounts/doctype/payment_entry/payment_entry.js b/erpnext/accounts/doctype/payment_entry/payment_entry.js index d3dbd314cc7..2a2f9fff55c 100644 --- a/erpnext/accounts/doctype/payment_entry/payment_entry.js +++ b/erpnext/accounts/doctype/payment_entry/payment_entry.js @@ -79,8 +79,13 @@ frappe.ui.form.on('Payment Entry', { frm.events.show_general_ledger(frm); }, + company: function(frm) { + frm.events.hide_unhide_fields(frm); + frm.events.set_dynamic_labels(frm); + }, + hide_unhide_fields: function(frm) { - var company_currency = frappe.get_doc(":Company", frm.doc.company).default_currency; + var company_currency = frm.doc.company? frappe.get_doc(":Company", frm.doc.company).default_currency: ""; frm.toggle_display("source_exchange_rate", (frm.doc.paid_amount && frm.doc.paid_from_account_currency != company_currency)); @@ -118,7 +123,7 @@ frappe.ui.form.on('Payment Entry', { }, set_dynamic_labels: function(frm) { - var company_currency = frappe.get_doc(":Company", frm.doc.company).default_currency; + var company_currency = frm.doc.company? frappe.get_doc(":Company", frm.doc.company).default_currency: ""; frm.set_currency_labels(["base_paid_amount", "base_received_amount", "base_total_allocated_amount", "difference_amount"], company_currency); From 2f09dc0e62e8c1008d7cc0f956ebf38c4e7df20c Mon Sep 17 00:00:00 2001 From: Rohit Waghchaure Date: Fri, 10 Feb 2017 12:44:04 +0530 Subject: [PATCH 10/25] [Fix] Valuation method changing issue in the item --- erpnext/stock/doctype/item/item.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/erpnext/stock/doctype/item/item.py b/erpnext/stock/doctype/item/item.py index 53faa43f24c..ad1407a3de9 100644 --- a/erpnext/stock/doctype/item/item.py +++ b/erpnext/stock/doctype/item/item.py @@ -451,6 +451,8 @@ class Item(WebsiteGenerator): "valuation_method", "has_batch_no", "is_fixed_asset") vals = frappe.db.get_value("Item", self.name, to_check, as_dict=True) + if not vals.get('valuation_method'): + vals['valuation_method'] = frappe.db.get_single_value("Stock Settings", "valuation_method") or "FIFO" if vals: for key in to_check: From bdd470a6d13eefbf8c993ddea75f6e2417407632 Mon Sep 17 00:00:00 2001 From: Nabin Hait Date: Fri, 10 Feb 2017 17:12:48 +0530 Subject: [PATCH 11/25] Update item.py --- erpnext/stock/doctype/item/item.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/erpnext/stock/doctype/item/item.py b/erpnext/stock/doctype/item/item.py index ad1407a3de9..4d5265f72ac 100644 --- a/erpnext/stock/doctype/item/item.py +++ b/erpnext/stock/doctype/item/item.py @@ -451,7 +451,7 @@ class Item(WebsiteGenerator): "valuation_method", "has_batch_no", "is_fixed_asset") vals = frappe.db.get_value("Item", self.name, to_check, as_dict=True) - if not vals.get('valuation_method'): + if not vals.get('valuation_method') and self.get('valuation_method'): vals['valuation_method'] = frappe.db.get_single_value("Stock Settings", "valuation_method") or "FIFO" if vals: From 1cd5e583badc4368be627f2ac49c059ca2017910 Mon Sep 17 00:00:00 2001 From: Kanchan Chauhan Date: Fri, 10 Feb 2017 17:58:41 +0530 Subject: [PATCH 12/25] [Fix] Apply Now button redirect fixed for Job Opening --- erpnext/templates/generators/job_opening.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/erpnext/templates/generators/job_opening.html b/erpnext/templates/generators/job_opening.html index 5998e3f8784..f92e72eaa7e 100644 --- a/erpnext/templates/generators/job_opening.html +++ b/erpnext/templates/generators/job_opening.html @@ -15,7 +15,7 @@ {% endif %}

+ href='/job_application?new=1&job_title={{ doc.name }}'> {{ _("Apply Now") }}

From 99dfa3060a9dd703434892602def94f2e99b2254 Mon Sep 17 00:00:00 2001 From: Nabin Hait Date: Mon, 13 Feb 2017 16:06:02 +0530 Subject: [PATCH 13/25] Check existing SO, PO and MR for disabling 'Is Stock Item' checkbox --- erpnext/stock/doctype/item/item.py | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/erpnext/stock/doctype/item/item.py b/erpnext/stock/doctype/item/item.py index 4d5265f72ac..f8d6606b74e 100644 --- a/erpnext/stock/doctype/item/item.py +++ b/erpnext/stock/doctype/item/item.py @@ -457,7 +457,7 @@ class Item(WebsiteGenerator): if vals: for key in to_check: if self.get(key) != vals.get(key): - if not self.check_if_linked_document_exists(): + if not self.check_if_linked_document_exists(key): break # no linked document, allowed else: frappe.throw(_("As there are existing transactions for this item, you can not change the value of {0}").format(frappe.bold(self.meta.get_label(key)))) @@ -467,10 +467,16 @@ class Item(WebsiteGenerator): if asset: frappe.throw(_('"Is Fixed Asset" cannot be unchecked, as Asset record exists against the item')) - def check_if_linked_document_exists(self): - for doctype in ("Sales Order Item", "Delivery Note Item", "Sales Invoice Item", - "Material Request Item", "Purchase Order Item", "Purchase Receipt Item", - "Purchase Invoice Item", "Stock Entry Detail", "Stock Reconciliation Item"): + def check_if_linked_document_exists(self, key): + linked_doctypes = ["Delivery Note Item", "Sales Invoice Item", "Purchase Receipt Item", + "Purchase Invoice Item", "Stock Entry Detail", "Stock Reconciliation Item"] + + # For "Is Stock Item", following doctypes is important + # because reserved_qty, ordered_qty and requested_qty updated from these doctypes + if key == "is_stock_item": + linked_doctypes += ["Sales Order Item", "Purchase Order Item", "Material Request Item"] + + for doctype in linked_doctypes: if frappe.db.get_value(doctype, filters={"item_code": self.name, "docstatus": 1}) or \ frappe.db.get_value("Production Order", filters={"production_item": self.name, "docstatus": 1}): From ff41c82c2bddf96a877046a3c77a333e76a5c316 Mon Sep 17 00:00:00 2001 From: Rohit Waghchaure Date: Tue, 14 Feb 2017 16:02:18 +0530 Subject: [PATCH 14/25] [Fix] Payment Entry currency symbol issue --- erpnext/accounts/doctype/payment_entry/payment_entry.js | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/erpnext/accounts/doctype/payment_entry/payment_entry.js b/erpnext/accounts/doctype/payment_entry/payment_entry.js index 2a2f9fff55c..4cd86c6033d 100644 --- a/erpnext/accounts/doctype/payment_entry/payment_entry.js +++ b/erpnext/accounts/doctype/payment_entry/payment_entry.js @@ -136,6 +136,10 @@ frappe.ui.form.on('Payment Entry', { frm.set_currency_labels(["total_allocated_amount", "unallocated_amount"], party_account_currency); + currency_field = (frm.doc.payment_type=="Receive") ? "paid_from_account_currency" : "paid_to_account_currency" + frm.set_df_property("total_allocated_amount", "options", currency_field); + frm.set_df_property("unallocated_amount", "options", currency_field); + frm.set_currency_labels(["total_amount", "outstanding_amount", "allocated_amount"], party_account_currency, "references"); From 3437a9a123861ccb765d6ba9bdf2a6819449ab9f Mon Sep 17 00:00:00 2001 From: Nabin Hait Date: Thu, 16 Feb 2017 12:14:14 +0530 Subject: [PATCH 15/25] minor fix --- erpnext/stock/doctype/item/item.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/erpnext/stock/doctype/item/item.py b/erpnext/stock/doctype/item/item.py index f8d6606b74e..d20ba497637 100644 --- a/erpnext/stock/doctype/item/item.py +++ b/erpnext/stock/doctype/item/item.py @@ -456,11 +456,11 @@ class Item(WebsiteGenerator): if vals: for key in to_check: - if self.get(key) != vals.get(key): + if cstr(self.get(key)) != cstr(vals.get(key)): if not self.check_if_linked_document_exists(key): break # no linked document, allowed else: - frappe.throw(_("As there are existing transactions for this item, you can not change the value of {0}").format(frappe.bold(self.meta.get_label(key)))) + frappe.throw(_("As there are existing transactions against item {0}, you can not change the value of {1}").format(self.name, frappe.bold(self.meta.get_label(key)))) if vals and not self.is_fixed_asset and self.is_fixed_asset != vals.is_fixed_asset: asset = frappe.db.get_all("Asset", filters={"item_code": self.name, "docstatus": 1}, limit=1) From 99c6c798345bab3499edf431ea0c6515339066c0 Mon Sep 17 00:00:00 2001 From: Nabin Hait Date: Thu, 16 Feb 2017 14:21:04 +0530 Subject: [PATCH 16/25] Update payment_entry.js --- erpnext/accounts/doctype/payment_entry/payment_entry.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/erpnext/accounts/doctype/payment_entry/payment_entry.js b/erpnext/accounts/doctype/payment_entry/payment_entry.js index 4cd86c6033d..1bbe2006514 100644 --- a/erpnext/accounts/doctype/payment_entry/payment_entry.js +++ b/erpnext/accounts/doctype/payment_entry/payment_entry.js @@ -136,7 +136,7 @@ frappe.ui.form.on('Payment Entry', { frm.set_currency_labels(["total_allocated_amount", "unallocated_amount"], party_account_currency); - currency_field = (frm.doc.payment_type=="Receive") ? "paid_from_account_currency" : "paid_to_account_currency" + var currency_field = (frm.doc.payment_type=="Receive") ? "paid_from_account_currency" : "paid_to_account_currency" frm.set_df_property("total_allocated_amount", "options", currency_field); frm.set_df_property("unallocated_amount", "options", currency_field); @@ -750,4 +750,4 @@ frappe.ui.form.on('Payment Entry Deduction', { deductions_remove: function(frm) { frm.events.set_difference_amount(frm); } -}) \ No newline at end of file +}) From 7677b56f7cb7f2940ae73f0b3504b4d357e4447a Mon Sep 17 00:00:00 2001 From: Nabin Hait Date: Thu, 16 Feb 2017 15:07:48 +0600 Subject: [PATCH 17/25] bumped to version 7.2.20 --- erpnext/__init__.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/erpnext/__init__.py b/erpnext/__init__.py index 706a8e5b2af..7ec8430f543 100644 --- a/erpnext/__init__.py +++ b/erpnext/__init__.py @@ -2,7 +2,7 @@ from __future__ import unicode_literals import frappe -__version__ = '7.2.19' +__version__ = '7.2.20' def get_default_company(user=None): '''Get default company for user''' From 6dd461fec480f17e148fb4254b5aa35fc187ee98 Mon Sep 17 00:00:00 2001 From: Rushabh Mehta Date: Thu, 16 Feb 2017 14:51:48 +0530 Subject: [PATCH 18/25] [add] site activation level --- erpnext/utilities/__init__.py | 4 +++- erpnext/utilities/activation.py | 36 +++++++++++++++++++++++++++++++++ 2 files changed, 39 insertions(+), 1 deletion(-) create mode 100644 erpnext/utilities/activation.py diff --git a/erpnext/utilities/__init__.py b/erpnext/utilities/__init__.py index bba21e6f119..b94061c29c0 100644 --- a/erpnext/utilities/__init__.py +++ b/erpnext/utilities/__init__.py @@ -1,6 +1,7 @@ ## temp utility import frappe +from erpnext.utilities.activation import get_level def update_doctypes(): for d in frappe.db.sql("""select df.parent, df.fieldname @@ -29,5 +30,6 @@ def get_site_info(site_info): return { 'company': company, - 'domain': domain + 'domain': domain, + 'activation': get_level() } diff --git a/erpnext/utilities/activation.py b/erpnext/utilities/activation.py new file mode 100644 index 00000000000..563f71ea2b4 --- /dev/null +++ b/erpnext/utilities/activation.py @@ -0,0 +1,36 @@ +import frappe + +def get_level(): + activation_level = 0 + if frappe.db.get_single_value('System Settings', 'setup_complete'): + activation_level = 1 + + if frappe.db.count('Item') > 5: + activation_level += 1 + + if frappe.db.count('Customer') > 5: + activation_level += 1 + + if frappe.db.count('Sales Order') > 2: + activation_level += 1 + + if frappe.db.count('Purchase Order') > 2: + activation_level += 1 + + if frappe.db.count('Employee') > 3: + activation_level += 1 + + if frappe.db.count('Payment Entry') > 2: + activation_level += 1 + + if frappe.db.count('Communication', dict(communication_medium='Email')) > 10: + activation_level += 1 + + if frappe.db.count('User') > 5: + activation_level += 1 + + # recent login + if frappe.db.sql('select name from tabUser where last_login > date_sub(now(), interval 2 day) limit 1'): + activation_level += 1 + + return activation_level \ No newline at end of file From a7d6b68bc011467a49c8b6050c805a941f2131b6 Mon Sep 17 00:00:00 2001 From: Nabin Hait Date: Thu, 16 Feb 2017 16:29:58 +0600 Subject: [PATCH 19/25] bumped to version 7.2.21 --- erpnext/__init__.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/erpnext/__init__.py b/erpnext/__init__.py index 7ec8430f543..4f53d0daba8 100644 --- a/erpnext/__init__.py +++ b/erpnext/__init__.py @@ -2,7 +2,7 @@ from __future__ import unicode_literals import frappe -__version__ = '7.2.20' +__version__ = '7.2.21' def get_default_company(user=None): '''Get default company for user''' From e7b87ad071ddeb68cef5238271dd902e18dbf5fe Mon Sep 17 00:00:00 2001 From: mbauskar Date: Thu, 16 Feb 2017 13:12:29 +0530 Subject: [PATCH 20/25] [minor] timestamp fixes for heatmap --- erpnext/accounts/party.py | 15 ++++++++++++--- erpnext/stock/doctype/item/item.py | 11 +++++++++-- 2 files changed, 21 insertions(+), 5 deletions(-) diff --git a/erpnext/accounts/party.py b/erpnext/accounts/party.py index c65a845deb8..e8070554bbe 100644 --- a/erpnext/accounts/party.py +++ b/erpnext/accounts/party.py @@ -7,7 +7,7 @@ import frappe import datetime from frappe import _, msgprint, scrub from frappe.defaults import get_user_permissions -from frappe.utils import add_days, getdate, formatdate, get_first_day, date_diff, add_years +from frappe.utils import add_days, getdate, formatdate, get_first_day, date_diff, add_years, get_timestamp from erpnext.utilities.doctype.address.address import get_address_display from erpnext.utilities.doctype.contact.contact import get_contact_details from erpnext.exceptions import PartyFrozen, InvalidCurrency, PartyDisabled, InvalidAccountCurrency @@ -351,8 +351,17 @@ def validate_party_frozen_disabled(party_type, party_name): def get_timeline_data(doctype, name): '''returns timeline data for the past one year''' from frappe.desk.form.load import get_communication_data + + out = {} data = get_communication_data(doctype, name, - fields = 'unix_timestamp(date(creation)), count(name)', + fields = 'date(creation), count(name)', after = add_years(None, -1).strftime('%Y-%m-%d'), group_by='group by date(creation)', as_dict=False) - return dict(data) \ No newline at end of file + + timeline_items = dict(data) + + for date, count in timeline_items.iteritems(): + timestamp = get_timestamp(date) + out.update({ timestamp: count }) + + return out \ No newline at end of file diff --git a/erpnext/stock/doctype/item/item.py b/erpnext/stock/doctype/item/item.py index d20ba497637..f9938ab9cc6 100644 --- a/erpnext/stock/doctype/item/item.py +++ b/erpnext/stock/doctype/item/item.py @@ -7,7 +7,7 @@ import erpnext import json import itertools from frappe import msgprint, _ -from frappe.utils import cstr, flt, cint, getdate, now_datetime, formatdate, strip +from frappe.utils import cstr, flt, cint, getdate, now_datetime, formatdate, strip, get_timestamp from frappe.website.website_generator import WebsiteGenerator from erpnext.setup.doctype.item_group.item_group import invalidate_cache_for, get_parent_item_groups from frappe.website.render import clear_cache @@ -667,10 +667,17 @@ class Item(WebsiteGenerator): def get_timeline_data(doctype, name): '''returns timeline data based on stock ledger entry''' - return dict(frappe.db.sql('''select unix_timestamp(posting_date), count(*) + out = {} + items = dict(frappe.db.sql('''select posting_date, count(*) from `tabStock Ledger Entry` where item_code=%s and posting_date > date_sub(curdate(), interval 1 year) group by posting_date''', name)) + + for date, count in items.iteritems(): + timestamp = get_timestamp(date) + out.update({ timestamp: count }) + + return out def validate_end_of_life(item_code, end_of_life=None, disabled=None, verbose=1): if (not end_of_life) or (disabled is None): From 4b9d2f27336caffab98966b333a268dee408dcba Mon Sep 17 00:00:00 2001 From: Rohit Waghchaure Date: Thu, 16 Feb 2017 15:53:40 +0530 Subject: [PATCH 21/25] [Fix] Cleanup supplied items if supply raw material is set as No --- erpnext/controllers/buying_controller.py | 3 +++ erpnext/patches.txt | 3 ++- .../empty_supplied_items_for_non_subcontracted.py | 14 ++++++++++++++ 3 files changed, 19 insertions(+), 1 deletion(-) create mode 100644 erpnext/patches/v7_2/empty_supplied_items_for_non_subcontracted.py diff --git a/erpnext/controllers/buying_controller.py b/erpnext/controllers/buying_controller.py index c4ba9e7b1dd..1d1b4e21989 100644 --- a/erpnext/controllers/buying_controller.py +++ b/erpnext/controllers/buying_controller.py @@ -178,6 +178,9 @@ class BuyingController(StockController): for item in self.get("items"): item.rm_supp_cost = 0.0 + if self.is_subcontracted == "No" and self.get("supplied_items"): + self.set('supplied_items', []) + def update_raw_materials_supplied(self, item, raw_material_table): bom_items = self.get_items_from_bom(item.item_code, item.bom) raw_materials_cost = 0 diff --git a/erpnext/patches.txt b/erpnext/patches.txt index b997dfc13b2..6563dfb3ee0 100644 --- a/erpnext/patches.txt +++ b/erpnext/patches.txt @@ -363,4 +363,5 @@ erpnext.patches.v7_2.update_website_for_variant erpnext.patches.v7_2.update_doctype_status erpnext.patches.v7_2.update_salary_slips erpnext.patches.v7_2.set_null_value_to_fields -erpnext.patches.v7_2.update_abbr_in_salary_slips \ No newline at end of file +erpnext.patches.v7_2.update_abbr_in_salary_slips +erpnext.patches.v7_2.empty_supplied_items_for_non_subcontracted \ No newline at end of file diff --git a/erpnext/patches/v7_2/empty_supplied_items_for_non_subcontracted.py b/erpnext/patches/v7_2/empty_supplied_items_for_non_subcontracted.py new file mode 100644 index 00000000000..ec6f8afc3a5 --- /dev/null +++ b/erpnext/patches/v7_2/empty_supplied_items_for_non_subcontracted.py @@ -0,0 +1,14 @@ +# Copyright (c) 2013, Web Notes Technologies Pvt. Ltd. and Contributors +# License: GNU General Public License v3. See license.txt + +from __future__ import unicode_literals +import frappe + +def execute(): + for doctype in ["Purchase Order", "Purchase Invoice", "Purchase Receipt"]: + child_table = 'Purchase Receipt Item Supplied' if doctype != 'Purchase Order' else 'Purchase Order Item Supplied' + for data in frappe.db.sql(""" select distinct `tab{doctype}`.name from `tab{doctype}` , `tab{child_table}` + where `tab{doctype}`.name = `tab{child_table}`.parent and `tab{doctype}`.docstatus != 2 + and `tab{doctype}`.is_subcontracted = 'No' """.format(doctype = doctype, child_table = child_table), as_dict=1): + frappe.db.sql(""" delete from `tab{child_table}` + where parent = %s and parenttype = %s""".format(child_table= child_table), (data.name, doctype)) \ No newline at end of file From 9e5b3dad296bf3c598f87f65b5307dcee1c015e9 Mon Sep 17 00:00:00 2001 From: Nabin Hait Date: Fri, 17 Feb 2017 11:03:30 +0530 Subject: [PATCH 22/25] Minor fix in assesment --- erpnext/schools/doctype/assessment/assessment.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/erpnext/schools/doctype/assessment/assessment.py b/erpnext/schools/doctype/assessment/assessment.py index 003b4276e7d..50883364cd6 100644 --- a/erpnext/schools/doctype/assessment/assessment.py +++ b/erpnext/schools/doctype/assessment/assessment.py @@ -34,7 +34,7 @@ class Assessment(Document): validate_overlap_for(self, "Assessment", "student_group") validate_overlap_for(self, "Assessment", "room") - validate_overlap_for(self, "Assessment", "supervisor", self.instructor) + validate_overlap_for(self, "Assessment", "supervisor", self.supervisor) def get_assessment_list(doctype, txt, filters, limit_start, limit_page_length=20): From 6af7dd4e1b98118c876decc42fb4d414b7117805 Mon Sep 17 00:00:00 2001 From: Nabin Hait Date: Fri, 17 Feb 2017 14:47:25 +0530 Subject: [PATCH 23/25] Set fiscal year start and end date based on country --- erpnext/public/js/setup_wizard.js | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/erpnext/public/js/setup_wizard.js b/erpnext/public/js/setup_wizard.js index 30323ecd6ba..c2a15950d85 100644 --- a/erpnext/public/js/setup_wizard.js +++ b/erpnext/public/js/setup_wizard.js @@ -100,7 +100,12 @@ function load_erpnext_slides() { fy = ["01-01", "12-31"]; next_year = current_year; } - + + var year_start_date = current_year + "-" + fy[0]; + if(year_start_date > get_today()) { + next_year = current_year + current_year -= 1; + } slide.get_field("fy_start_date").set_input(current_year + "-" + fy[0]); slide.get_field("fy_end_date").set_input(next_year + "-" + fy[1]); } From 0c5375d0fa6f1ce8e37649e3d2010b01d18522d5 Mon Sep 17 00:00:00 2001 From: Rushabh Mehta Date: Fri, 17 Feb 2017 14:57:31 +0530 Subject: [PATCH 24/25] [minor] item name not mandatory and item price with quick edit --- erpnext/stock/doctype/item/item.js | 53 ++++--- erpnext/stock/doctype/item/item.json | 8 +- erpnext/stock/doctype/item/item.py | 9 +- .../stock/doctype/item_price/item_price.json | 142 +++++++----------- 4 files changed, 99 insertions(+), 113 deletions(-) diff --git a/erpnext/stock/doctype/item/item.js b/erpnext/stock/doctype/item/item.js index 1f793d11e81..985bd4f950f 100644 --- a/erpnext/stock/doctype/item/item.js +++ b/erpnext/stock/doctype/item/item.js @@ -4,6 +4,13 @@ frappe.provide("erpnext.item"); frappe.ui.form.on("Item", { + setup: function(frm) { + frm.add_fetch('attribute', 'numeric_values', 'numeric_values'); + frm.add_fetch('attribute', 'from_range', 'from_range'); + frm.add_fetch('attribute', 'to_range', 'to_range'); + frm.add_fetch('attribute', 'increment', 'increment'); + frm.add_fetch('tax_type', 'tax_rate', 'tax_rate'); + }, onload: function(frm) { erpnext.item.setup_queries(frm); if (frm.doc.variant_of){ @@ -16,7 +23,6 @@ frappe.ui.form.on("Item", { }, refresh: function(frm) { - if(frm.doc.is_stock_item) { frm.add_custom_button(__("Balance"), function() { frappe.route_options = { @@ -54,9 +60,9 @@ frappe.ui.form.on("Item", { }, __("View")); frm.add_custom_button(__("Variant"), function() { - erpnext.item.make_variant() + erpnext.item.make_variant(frm); }, __("Make")); - cur_frm.page.set_inner_btn_group_as_primary(__("Make")); + frm.page.set_inner_btn_group_as_primary(__("Make")); } if (frm.doc.variant_of) { frm.set_intro(__("This Item is a Variant of {0} (Template). Attributes will be copied over from the template unless 'No Copy' is set", [frm.doc.variant_of]), true); @@ -79,6 +85,17 @@ frappe.ui.form.on("Item", { frm.toggle_enable("is_fixed_asset", (frm.doc.__islocal || (!frm.doc.is_stock_item && ((frm.doc.__onload && frm.doc.__onload.asset_exists) ? false : true)))); + + frm.add_custom_button(__('Duplicate'), function() { + var new_item = frappe.model.copy_doc(frm.doc); + if(new_item.item_name===new_item.item_code) { + new_item.item_name = null; + } + if(new_item.description===new_item.description) { + new_item.description = null; + } + frappe.set_route('Form', 'Item', new_item.name); + }); }, validate: function(frm){ @@ -88,13 +105,13 @@ frappe.ui.form.on("Item", { image: function(frm) { refresh_field("image_view"); }, - + is_fixed_asset: function(frm) { if (frm.doc.is_fixed_asset) { frm.set_value("is_stock_item", 0); } }, - + page_name: frappe.utils.warn_page_name_change, item_code: function(frm) { @@ -191,15 +208,15 @@ $.extend(erpnext.item, { frm.fields_dict.reorder_levels.grid.get_field("warehouse").get_query = function(doc, cdt, cdn) { var d = locals[cdt][cdn]; - + var filters = { "is_group": 0 } - + if (d.parent_warehouse) { filters.extend({"parent_warehouse": d.warehouse_group}) } - + return { filters: filters } @@ -212,7 +229,8 @@ $.extend(erpnext.item, { return; frappe.require('assets/js/item-dashboard.min.js', function() { - var section = frm.dashboard.add_section('
Stock Levels
'); + var section = frm.dashboard.add_section('
\ + Stock Levels
'); erpnext.item.item_dashboard = new erpnext.stock.ItemDashboard({ parent: section, item_code: frm.doc.name @@ -234,12 +252,12 @@ $.extend(erpnext.item, { } }, - make_variant: function(doc) { + make_variant: function(frm) { var fields = [] - for(var i=0;i< cur_frm.doc.attributes.length;i++){ + for(var i=0;i< frm.doc.attributes.length;i++){ var fieldtype, desc; - var row = cur_frm.doc.attributes[i]; + var row = frm.doc.attributes[i]; if (row.numeric_values){ fieldtype = "Float"; desc = "Min Value: "+ row.from_range +" , Max Value: "+ row.to_range +", in Increments of: "+ row.increment @@ -268,7 +286,7 @@ $.extend(erpnext.item, { frappe.call({ method:"erpnext.controllers.item_variant.get_variant", args: { - "template": cur_frm.doc.name, + "template": frm.doc.name, "args": d.get_values() }, callback: function(r) { @@ -290,7 +308,7 @@ $.extend(erpnext.item, { frappe.call({ method:"erpnext.controllers.item_variant.create_variant", args: { - "item": cur_frm.doc.name, + "item": frm.doc.name, "args": d.get_values() }, callback: function(r) { @@ -358,10 +376,3 @@ $.extend(erpnext.item, { frm.fields_dict.attributes.grid.toggle_enable("attribute_value", !frm.doc.variant_of); } }); - - -cur_frm.add_fetch('attribute', 'numeric_values', 'numeric_values'); -cur_frm.add_fetch('attribute', 'from_range', 'from_range'); -cur_frm.add_fetch('attribute', 'to_range', 'to_range'); -cur_frm.add_fetch('attribute', 'increment', 'increment'); -cur_frm.add_fetch('tax_type', 'tax_rate', 'tax_rate'); diff --git a/erpnext/stock/doctype/item/item.json b/erpnext/stock/doctype/item/item.json index 6dfe76e3798..60f6fdf371c 100644 --- a/erpnext/stock/doctype/item/item.json +++ b/erpnext/stock/doctype/item/item.json @@ -87,7 +87,7 @@ "in_standard_filter": 0, "label": "Item Code", "length": 0, - "no_copy": 1, + "no_copy": 0, "oldfieldname": "item_code", "oldfieldtype": "Data", "permlevel": 0, @@ -134,7 +134,7 @@ }, { "allow_on_submit": 0, - "bold": 0, + "bold": 1, "collapsible": 0, "columns": 0, "fieldname": "item_name", @@ -156,7 +156,7 @@ "read_only": 0, "remember_last_selected_value": 0, "report_hide": 0, - "reqd": 1, + "reqd": 0, "search_index": 1, "set_only_once": 0, "unique": 0 @@ -2713,7 +2713,7 @@ "issingle": 0, "istable": 0, "max_attachments": 1, - "modified": "2017-01-18 17:43:20.262925", + "modified": "2017-02-17 04:00:38.825621", "modified_by": "Administrator", "module": "Stock", "name": "Item", diff --git a/erpnext/stock/doctype/item/item.py b/erpnext/stock/doctype/item/item.py index d20ba497637..f54744be72d 100644 --- a/erpnext/stock/doctype/item/item.py +++ b/erpnext/stock/doctype/item/item.py @@ -63,6 +63,9 @@ class Item(WebsiteGenerator): def validate(self): super(Item, self).validate() + if not self.item_name: + self.item_name = self.item_code + if not self.description: self.description = self.item_name @@ -470,12 +473,12 @@ class Item(WebsiteGenerator): def check_if_linked_document_exists(self, key): linked_doctypes = ["Delivery Note Item", "Sales Invoice Item", "Purchase Receipt Item", "Purchase Invoice Item", "Stock Entry Detail", "Stock Reconciliation Item"] - - # For "Is Stock Item", following doctypes is important + + # For "Is Stock Item", following doctypes is important # because reserved_qty, ordered_qty and requested_qty updated from these doctypes if key == "is_stock_item": linked_doctypes += ["Sales Order Item", "Purchase Order Item", "Material Request Item"] - + for doctype in linked_doctypes: if frappe.db.get_value(doctype, filters={"item_code": self.name, "docstatus": 1}) or \ frappe.db.get_value("Production Order", diff --git a/erpnext/stock/doctype/item_price/item_price.json b/erpnext/stock/doctype/item_price/item_price.json index 5f0826248d0..0685c80438f 100644 --- a/erpnext/stock/doctype/item_price/item_price.json +++ b/erpnext/stock/doctype/item_price/item_price.json @@ -69,6 +69,33 @@ "set_only_once": 0, "unique": 0 }, + { + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fieldname": "column_break_3", + "fieldtype": "Column Break", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "length": 0, + "no_copy": 0, + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "unique": 0 + }, { "allow_on_submit": 0, "bold": 0, @@ -151,6 +178,34 @@ "set_only_once": 0, "unique": 0 }, + { + "allow_on_submit": 0, + "bold": 1, + "collapsible": 0, + "columns": 0, + "fieldname": "currency", + "fieldtype": "Link", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_list_view": 1, + "in_standard_filter": 0, + "label": "Currency", + "length": 0, + "no_copy": 0, + "options": "Currency", + "permlevel": 0, + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 1, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "unique": 0 + }, { "allow_on_submit": 0, "bold": 0, @@ -211,34 +266,6 @@ "set_only_once": 0, "unique": 0 }, - { - "allow_on_submit": 0, - "bold": 0, - "collapsible": 0, - "columns": 0, - "fieldname": "currency", - "fieldtype": "Link", - "hidden": 0, - "ignore_user_permissions": 0, - "ignore_xss_filter": 0, - "in_filter": 0, - "in_list_view": 1, - "in_standard_filter": 0, - "label": "Currency", - "length": 0, - "no_copy": 0, - "options": "Currency", - "permlevel": 0, - "print_hide": 0, - "print_hide_if_no_value": 0, - "read_only": 1, - "remember_last_selected_value": 0, - "report_hide": 0, - "reqd": 0, - "search_index": 0, - "set_only_once": 0, - "unique": 0 - }, { "allow_on_submit": 0, "bold": 0, @@ -318,61 +345,6 @@ "search_index": 0, "set_only_once": 0, "unique": 0 - }, - { - "allow_on_submit": 0, - "bold": 0, - "collapsible": 0, - "columns": 0, - "fieldname": "section_break_12", - "fieldtype": "Section Break", - "hidden": 0, - "ignore_user_permissions": 0, - "ignore_xss_filter": 0, - "in_filter": 0, - "in_list_view": 0, - "in_standard_filter": 0, - "length": 0, - "no_copy": 0, - "permlevel": 0, - "precision": "", - "print_hide": 0, - "print_hide_if_no_value": 0, - "read_only": 0, - "remember_last_selected_value": 0, - "report_hide": 0, - "reqd": 0, - "search_index": 0, - "set_only_once": 0, - "unique": 0 - }, - { - "allow_on_submit": 0, - "bold": 0, - "collapsible": 0, - "columns": 0, - "fieldname": "bulk_import_help", - "fieldtype": "HTML", - "hidden": 0, - "ignore_user_permissions": 0, - "ignore_xss_filter": 0, - "in_filter": 0, - "in_list_view": 0, - "in_standard_filter": 0, - "label": "Bulk Import Help", - "length": 0, - "no_copy": 0, - "permlevel": 0, - "precision": "", - "print_hide": 0, - "print_hide_if_no_value": 0, - "read_only": 0, - "remember_last_selected_value": 0, - "report_hide": 0, - "reqd": 0, - "search_index": 0, - "set_only_once": 0, - "unique": 0 } ], "hide_heading": 0, @@ -386,7 +358,7 @@ "issingle": 0, "istable": 0, "max_attachments": 0, - "modified": "2016-12-15 14:52:09.842544", + "modified": "2017-02-17 04:24:30.453863", "modified_by": "Administrator", "module": "Stock", "name": "Item Price", @@ -435,7 +407,7 @@ "write": 1 } ], - "quick_entry": 0, + "quick_entry": 1, "read_only": 0, "read_only_onload": 0, "sort_order": "ASC", From 66b373033a632e7325f382cf015f7b6793ff0464 Mon Sep 17 00:00:00 2001 From: Nabin Hait Date: Mon, 20 Feb 2017 15:22:01 +0600 Subject: [PATCH 25/25] bumped to version 7.2.22 --- erpnext/__init__.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/erpnext/__init__.py b/erpnext/__init__.py index 4f53d0daba8..e9be38a791b 100644 --- a/erpnext/__init__.py +++ b/erpnext/__init__.py @@ -2,7 +2,7 @@ from __future__ import unicode_literals import frappe -__version__ = '7.2.21' +__version__ = '7.2.22' def get_default_company(user=None): '''Get default company for user'''