From 673887455f0e57c3bb02dae16b73fa47d80a1660 Mon Sep 17 00:00:00 2001 From: Anand Doshi Date: Thu, 1 Oct 2015 11:18:40 +0530 Subject: [PATCH 1/7] [fix] Show Contribution (%) in Sales Team table in Customer Form --- erpnext/selling/doctype/customer/customer.js | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/erpnext/selling/doctype/customer/customer.js b/erpnext/selling/doctype/customer/customer.js index e596ae4162..42cc93a81b 100644 --- a/erpnext/selling/doctype/customer/customer.js +++ b/erpnext/selling/doctype/customer/customer.js @@ -17,7 +17,6 @@ frappe.ui.form.on("Customer", "refresh", function(frm) { } var grid = cur_frm.get_field("sales_team").grid; - grid.set_column_disp("allocated_percentage", false); grid.set_column_disp("allocated_amount", false); grid.set_column_disp("incentives", false); @@ -101,11 +100,11 @@ cur_frm.fields_dict['accounts'].grid.get_field('account').get_query = function(d 'company': d.company, "is_group": 0 }; - + if(doc.party_account_currency) { $.extend(filters, {"account_currency": doc.party_account_currency}); } - + return { filters: filters } From e2c3d40b57b17cd2fb36fda88a91913beebc1ede Mon Sep 17 00:00:00 2001 From: Anand Doshi Date: Thu, 1 Oct 2015 11:21:09 +0530 Subject: [PATCH 2/7] [hotfix] Payment Reconciliation Invoice Type --- .../doctype/payment_reconciliation/payment_reconciliation.py | 1 + 1 file changed, 1 insertion(+) diff --git a/erpnext/accounts/doctype/payment_reconciliation/payment_reconciliation.py b/erpnext/accounts/doctype/payment_reconciliation/payment_reconciliation.py index 8396ce5f67..81bfec5b0f 100644 --- a/erpnext/accounts/doctype/payment_reconciliation/payment_reconciliation.py +++ b/erpnext/accounts/doctype/payment_reconciliation/payment_reconciliation.py @@ -141,6 +141,7 @@ class PaymentReconciliation(Document): def reconcile(self, args): for e in self.get('payments'): + e.invoice_type = None if e.invoice_number and " | " in e.invoice_number: e.invoice_type, e.invoice_number = e.invoice_number.split(" | ") From 5c623dae4d242169f83da8710383d49339e7e964 Mon Sep 17 00:00:00 2001 From: Nabin Hait Date: Thu, 1 Oct 2015 11:22:09 +0530 Subject: [PATCH 3/7] [fix] General Ledger report fixed --- .../report/general_ledger/general_ledger.py | 34 ++++++------------- 1 file changed, 10 insertions(+), 24 deletions(-) diff --git a/erpnext/accounts/report/general_ledger/general_ledger.py b/erpnext/accounts/report/general_ledger/general_ledger.py index a7b1d19c37..7bad3617e9 100644 --- a/erpnext/accounts/report/general_ledger/general_ledger.py +++ b/erpnext/accounts/report/general_ledger/general_ledger.py @@ -161,40 +161,26 @@ def get_data_with_opening_closing(filters, account_details, gl_entries): for acc, acc_dict in gle_map.items(): if acc_dict.entries: # Opening for individual ledger, if grouped by account - if filters.get("group_by_account"): - data.append(get_balance_row(_("Opening"), acc_dict.opening, - acc_dict.opening_in_account_currency)) + data.append(get_balance_row(_("Opening"), acc_dict.opening, + acc_dict.opening_in_account_currency)) data += acc_dict.entries # Totals and closing for individual ledger, if grouped by account - if filters.get("group_by_account"): - account_closing = acc_dict.opening + acc_dict.total_debit - acc_dict.total_credit - account_closing_in_account_currency = acc_dict.opening_in_account_currency \ - + acc_dict.total_debit_in_account_currency - acc_dict.total_credit_in_account_currency + account_closing = acc_dict.opening + acc_dict.total_debit - acc_dict.total_credit + account_closing_in_account_currency = acc_dict.opening_in_account_currency \ + + acc_dict.total_debit_in_account_currency - acc_dict.total_credit_in_account_currency - data += [{"account": "'" + _("Totals") + "'", "debit": acc_dict.total_debit, - "credit": acc_dict.total_credit}, - get_balance_row(_("Closing (Opening + Totals)"), - account_closing, account_closing_in_account_currency), {}] + data += [{"account": "'" + _("Totals") + "'", "debit": acc_dict.total_debit, + "credit": acc_dict.total_credit}, + get_balance_row(_("Closing (Opening + Totals)"), + account_closing, account_closing_in_account_currency), {}] else: - from_date, to_date = getdate(filters.from_date), getdate(filters.to_date) - opening_debit = opening_credit = 0.0 - for gl in gl_entries: - if gl.posting_date < from_date: - opening_debit += flt(gl.debit, 3) - opening_credit += flt(gl.credit, 3) - else: + if gl.posting_date >= getdate(filters.from_date) and gl.posting_date <= getdate(filters.to_date): data.append(gl) - if not (filters.get("account") or filters.get("party")): - data = [{ - "account": "'" + _("Opening") + "'", - "debit": opening_debit, - "credit": opening_credit - }] + data # Total debit and credit between from and to date if total_debit or total_credit: From f924e08b935d2ee4f91590de72ad665e6013de72 Mon Sep 17 00:00:00 2001 From: Nabin Hait Date: Thu, 1 Oct 2015 11:51:48 +0530 Subject: [PATCH 4/7] [fix] Validate duplicate email ids in Lead --- erpnext/crm/doctype/lead/lead.py | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/erpnext/crm/doctype/lead/lead.py b/erpnext/crm/doctype/lead/lead.py index 12de2e5819..0e7286517e 100644 --- a/erpnext/crm/doctype/lead/lead.py +++ b/erpnext/crm/doctype/lead/lead.py @@ -58,12 +58,12 @@ class Lead(SellingController): def check_email_id_is_unique(self): if self.email_id: # validate email is unique - email_list = frappe.db.sql("""select name from tabLead where email_id=%s""", - self.email_id) - email_list = [e[0] for e in email_list if e[0]!=self.name] - if len(email_list) > 1: - frappe.throw(_("Email id must be unique, already exists for {0}").format(comma_and(email_list)), - frappe.DuplicateEntryError) + duplicate_leads = frappe.db.sql_list("""select name from tabLead + where email_id=%s and name!=%s""", (self.email_id, self.name)) + + if duplicate_leads: + frappe.throw(_("Email id must be unique, already exists for {0}") + .format(comma_and(duplicate_leads)), frappe.DuplicateEntryError) def on_trash(self): frappe.db.sql("""update `tabIssue` set lead='' where lead=%s""", From 712b02593a61e7336c03bf7c46b97e71049a5715 Mon Sep 17 00:00:00 2001 From: Nabin Hait Date: Thu, 1 Oct 2015 12:35:45 +0530 Subject: [PATCH 5/7] [fix] Month issue fixed in Monthly Attendance Sheet --- .../monthly_attendance_sheet.py | 25 ++++++++----------- 1 file changed, 10 insertions(+), 15 deletions(-) diff --git a/erpnext/hr/report/monthly_attendance_sheet/monthly_attendance_sheet.py b/erpnext/hr/report/monthly_attendance_sheet/monthly_attendance_sheet.py index f53accad65..0dc25d2d29 100644 --- a/erpnext/hr/report/monthly_attendance_sheet/monthly_attendance_sheet.py +++ b/erpnext/hr/report/monthly_attendance_sheet/monthly_attendance_sheet.py @@ -5,6 +5,7 @@ from __future__ import unicode_literals import frappe from frappe.utils import cstr, cint from frappe import msgprint, _ +from calendar import monthrange def execute(filters=None): if not filters: filters = {} @@ -73,23 +74,17 @@ def get_conditions(filters): msgprint(_("Please select month and year"), raise_exception=1) filters["month"] = ["Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", - "Dec"].index(filters["month"]) + 1 + "Dec"].index(filters.month) + 1 - from frappe.model.document import Document - fiscal_years = frappe.get_doc("Fiscal Year",filters["fiscal_year"]) - import datetime - year_start = fiscal_years.year_start_date.strftime("%Y") - year_end = fiscal_years.year_end_date.strftime("%Y") - dt_test = datetime.datetime.strptime(year_end + "-" + str(100+int(filters["month"]))[2:3] + "-01", "%Y-%m-%d") - date_test = datetime.date(dt_test.year, dt_test.month, dt_test.day) - if date_test > fiscal_years.year_end_date: - year_target = year_start + year_start_date, year_end_date = frappe.db.get_value("Fiscal Year", filters.fiscal_year, + ["year_start_date", "year_end_date"]) + + if filters.month >= year_start_date.strftime("%m"): + year = year_start_date.strftime("%Y") else: - year_target = year_end - - from calendar import monthrange - filters["total_days_in_month"] = monthrange(cint(year_target), - filters["month"])[1] + year = year_end_date.strftime("%Y") + + filters["total_days_in_month"] = monthrange(cint(year), filters.month)[1] conditions = " and month(att_date) = %(month)s and fiscal_year = %(fiscal_year)s" From dace2b6796421908b4922ec4402429dab1dcd279 Mon Sep 17 00:00:00 2001 From: Nabin Hait Date: Thu, 1 Oct 2015 13:54:46 +0530 Subject: [PATCH 6/7] [fix] get permission query condition if no permitted links --- erpnext/utilities/address_and_contact.py | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/erpnext/utilities/address_and_contact.py b/erpnext/utilities/address_and_contact.py index 9341adfb41..d175db6649 100644 --- a/erpnext/utilities/address_and_contact.py +++ b/erpnext/utilities/address_and_contact.py @@ -53,13 +53,23 @@ def get_permission_query_conditions(doctype): if not links.get("not_permitted_links"): # when everything is permitted, don't add additional condition return "" + + elif not links.get("permitted_links"): + conditions = [] + + # when everything is not permitted + for df in links.get("not_permitted_links"): + # like ifnull(customer, '')='' and ifnull(supplier, '')='' + conditions.append("ifnull(`tab{doctype}`.`{fieldname}`, '')=''".format(doctype=doctype, fieldname=df.fieldname)) + + return "( " + " and ".join(conditions) + " )" else: conditions = [] for df in links.get("permitted_links"): # like ifnull(customer, '')!='' or ifnull(supplier, '')!='' - conditions.append("ifnull(`tab{doctype}`.`{fieldname}`, '')!=''".format(doctype=doctype, fieldname=df.fieldname)) + conditions.append("ifnull(`tab{doctype}`.`{fieldname}`, '')!=''".format(doctype=doctype, fieldname=df.fieldname)) return "( " + " or ".join(conditions) + " )" From ba48f82e03f125389ddcc47beba8b5db8bffe70d Mon Sep 17 00:00:00 2001 From: Anand Doshi Date: Thu, 1 Oct 2015 14:31:22 +0600 Subject: [PATCH 7/7] bumped to version 6.4.2 --- erpnext/__version__.py | 2 +- erpnext/hooks.py | 2 +- setup.py | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/erpnext/__version__.py b/erpnext/__version__.py index 4f29ece9ed..bc305ffd2c 100644 --- a/erpnext/__version__.py +++ b/erpnext/__version__.py @@ -1,2 +1,2 @@ from __future__ import unicode_literals -__version__ = '6.4.1' +__version__ = '6.4.2' diff --git a/erpnext/hooks.py b/erpnext/hooks.py index 2443a48ee6..8c2797f141 100644 --- a/erpnext/hooks.py +++ b/erpnext/hooks.py @@ -29,7 +29,7 @@ blogs. """ app_icon = "icon-th" app_color = "#e74c3c" -app_version = "6.4.1" +app_version = "6.4.2" github_link = "https://github.com/frappe/erpnext" error_report_email = "support@erpnext.com" diff --git a/setup.py b/setup.py index b1baaff185..355a404472 100644 --- a/setup.py +++ b/setup.py @@ -1,6 +1,6 @@ from setuptools import setup, find_packages -version = "6.4.1" +version = "6.4.2" with open("requirements.txt", "r") as f: install_requires = f.readlines()