From 01eefafad544d1bc2e6efccb1fea25f20e960354 Mon Sep 17 00:00:00 2001 From: Makarand Bauskar Date: Mon, 23 Jan 2017 12:15:36 +0530 Subject: [PATCH 1/5] [minor] minor fixes in opportunity form (#7549) --- erpnext/crm/doctype/opportunity/opportunity.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/erpnext/crm/doctype/opportunity/opportunity.js b/erpnext/crm/doctype/opportunity/opportunity.js index 21fba7b1e72a..b86a5a528744 100644 --- a/erpnext/crm/doctype/opportunity/opportunity.js +++ b/erpnext/crm/doctype/opportunity/opportunity.js @@ -23,7 +23,7 @@ frappe.ui.form.on("Opportunity", { refresh: function(frm) { var doc = frm.doc; frm.events.enquiry_from(frm); - if(doc.status!=="Lost") { + if(!doc.__islocal && doc.status!=="Lost") { if(doc.with_items){ frm.add_custom_button(__('Supplier Quotation'), function() { @@ -109,7 +109,7 @@ cur_frm.cscript.refresh = function(doc, cdt, cdn) { erpnext.toggle_naming_series(); var frm = cur_frm; - if(frm.perm[0].write && doc.docstatus==0) { + if(!doc.__islocal && frm.perm[0].write && doc.docstatus==0) { if(frm.doc.status==="Open") { frm.add_custom_button(__("Close"), function() { frm.set_value("status", "Closed"); From c948a4fc929560bd5336069fe38e027a8c4d265f Mon Sep 17 00:00:00 2001 From: Kanchan Chauhan Date: Sun, 22 Jan 2017 11:01:02 +0530 Subject: [PATCH 2/5] Patch to update Salary Detail where Salary Component Abbr is null --- erpnext/patches.txt | 3 ++- erpnext/patches/v7_2/update_abbr_in_salary_slips.py | 13 +++++++++++++ 2 files changed, 15 insertions(+), 1 deletion(-) create mode 100644 erpnext/patches/v7_2/update_abbr_in_salary_slips.py diff --git a/erpnext/patches.txt b/erpnext/patches.txt index e600a576181f..b997dfc13b22 100644 --- a/erpnext/patches.txt +++ b/erpnext/patches.txt @@ -362,4 +362,5 @@ execute:frappe.delete_doc('Desktop Icon', {'module_name': 'Profit and Loss Statm 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 \ No newline at end of file +erpnext.patches.v7_2.set_null_value_to_fields +erpnext.patches.v7_2.update_abbr_in_salary_slips \ No newline at end of file diff --git a/erpnext/patches/v7_2/update_abbr_in_salary_slips.py b/erpnext/patches/v7_2/update_abbr_in_salary_slips.py new file mode 100644 index 000000000000..aa6965f17cb7 --- /dev/null +++ b/erpnext/patches/v7_2/update_abbr_in_salary_slips.py @@ -0,0 +1,13 @@ +import frappe + +def execute(): + frappe.reload_doctype('Salary Slip') + if not frappe.db.has_column('Salary Detail', 'abbr'): + return + + salary_details = frappe.db.sql("""select abbr, salary_component, name from `tabSalary Detail` + where abbr is null or abbr = ''""", as_dict=True) + + for salary_detail in salary_details: + salary_component_abbr = frappe.get_value("Salary Component", salary_detail.salary_component, "salary_component_abbr") + frappe.db.sql("""update `tabSalary Detail` set abbr = %s where name = %s""",(salary_component_abbr, salary_detail.name)) \ No newline at end of file From 3899d74f153636bf9dce1daf2b41b55db52fd264 Mon Sep 17 00:00:00 2001 From: Rohit Waghchaure Date: Wed, 25 Jan 2017 18:47:53 +0530 Subject: [PATCH 3/5] [Fix] Get valuation rate from item master and update stock value difference --- erpnext/controllers/stock_controller.py | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/erpnext/controllers/stock_controller.py b/erpnext/controllers/stock_controller.py index 2e6f45433e38..906e0e24b1d4 100644 --- a/erpnext/controllers/stock_controller.py +++ b/erpnext/controllers/stock_controller.py @@ -9,6 +9,7 @@ from erpnext.accounts.utils import get_fiscal_year from erpnext.accounts.general_ledger import make_gl_entries, delete_gl_entries, process_gl_map from erpnext.controllers.accounts_controller import AccountsController +from erpnext.stock.stock_ledger import get_valuation_rate class StockController(AccountsController): def validate(self): @@ -51,7 +52,8 @@ def get_gl_entries(self, warehouse_account=None, default_expense_account=None, # from warehouse account self.check_expense_account(item_row) - + self.update_stock_ledger_entries(sle) + if not sle.stock_value_difference: self.validate_negative_stock(sle) @@ -84,7 +86,16 @@ def get_gl_entries(self, warehouse_account=None, default_expense_account=None, "\n".join(warehouse_with_no_account)) return process_gl_map(gl_list) - + + def update_stock_ledger_entries(self, sle): + if not sle.stock_value_difference: + 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.doctype="Stock Ledger Entry" + frappe.get_doc(sle).db_update() + 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}") From cb19f5298589ff7f86fa208976c6b0820fc2b40d Mon Sep 17 00:00:00 2001 From: Nabin Hait Date: Wed, 25 Jan 2017 19:20:35 +0530 Subject: [PATCH 4/5] Update stock_controller.py --- erpnext/controllers/stock_controller.py | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) diff --git a/erpnext/controllers/stock_controller.py b/erpnext/controllers/stock_controller.py index 906e0e24b1d4..e167860234fd 100644 --- a/erpnext/controllers/stock_controller.py +++ b/erpnext/controllers/stock_controller.py @@ -52,9 +52,9 @@ def get_gl_entries(self, warehouse_account=None, default_expense_account=None, # from warehouse account self.check_expense_account(item_row) - self.update_stock_ledger_entries(sle) if not sle.stock_value_difference: + self.update_stock_ledger_entries(sle) self.validate_negative_stock(sle) gl_list.append(self.get_gl_dict({ @@ -88,13 +88,12 @@ def get_gl_entries(self, warehouse_account=None, default_expense_account=None, return process_gl_map(gl_list) def update_stock_ledger_entries(self, sle): - if not sle.stock_value_difference: - 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.doctype="Stock Ledger Entry" - frappe.get_doc(sle).db_update() + 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.doctype="Stock Ledger Entry" + frappe.get_doc(sle).db_update() def validate_negative_stock(self, sle): if sle.qty_after_transaction < 0 and sle.actual_qty < 0: From 149c033c8fac03eb56299c0fccaec2e6f8599b78 Mon Sep 17 00:00:00 2001 From: Rushabh Mehta Date: Fri, 27 Jan 2017 16:16:07 +0600 Subject: [PATCH 5/5] bumped to version 7.2.15 --- erpnext/__init__.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/erpnext/__init__.py b/erpnext/__init__.py index 7ad096edd72e..d22936a4b29f 100644 --- a/erpnext/__init__.py +++ b/erpnext/__init__.py @@ -2,7 +2,7 @@ from __future__ import unicode_literals import frappe -__version__ = '7.2.14' +__version__ = '7.2.15' def get_default_company(user=None): '''Get default company for user'''