From 71349d221ba8d6f54b53a7b2fe09aaacb09e5cd4 Mon Sep 17 00:00:00 2001 From: Rushabh Mehta Date: Fri, 3 Jul 2015 10:43:35 +0530 Subject: [PATCH 01/13] [fix] item image in mozilla #3412 #3413 --- .../print_formats/includes/item_table_description.html | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/erpnext/templates/print_formats/includes/item_table_description.html b/erpnext/templates/print_formats/includes/item_table_description.html index f259626661c..ece5386538a 100644 --- a/erpnext/templates/print_formats/includes/item_table_description.html +++ b/erpnext/templates/print_formats/includes/item_table_description.html @@ -1,6 +1,7 @@ {% if doc.in_format_data("image") and doc.get("image") and not doc.is_print_hide("image")-%}
- + +
{%- endif %}
@@ -8,14 +9,14 @@
{{ doc.item_code }}
{%- endif %} {% if (doc.in_format_data("item_name") and not doc.is_print_hide("item_name") and - (not doc.in_format_data("item_code") or doc.is_print_hide("item_code") + (not doc.in_format_data("item_code") or doc.is_print_hide("item_code") or doc.item_code != doc.item_name)) -%}
{{ doc.get_formatted("item_name") }}
{%- endif %} {% if (doc.in_format_data("description") and doc.description and ( ( - (not doc.in_format_data("item_code") or doc.is_print_hide("item_code")) and + (not doc.in_format_data("item_code") or doc.is_print_hide("item_code")) and (not doc.in_format_data("item_name") or doc.is_print_hide("item_name")) ) or not (doc.item_code == doc.item_name == doc.description) )) From 5688a6c31afbf24e694169b2ef9dca8ebb78405f Mon Sep 17 00:00:00 2001 From: Rushabh Mehta Date: Fri, 3 Jul 2015 11:34:53 +0530 Subject: [PATCH 02/13] [fix] remove user permission if user id is unset #3447 --- erpnext/hr/doctype/employee/employee.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/erpnext/hr/doctype/employee/employee.py b/erpnext/hr/doctype/employee/employee.py index cb0ce118b31..a2bb10cc69d 100644 --- a/erpnext/hr/doctype/employee/employee.py +++ b/erpnext/hr/doctype/employee/employee.py @@ -45,6 +45,10 @@ class Employee(Document): if self.user_id: self.validate_for_enabled_user_id() self.validate_duplicate_user_id() + else: + existing_user_id = frappe.db.get_value("Employee", self.name, "user_id") + if existing_user_id: + frappe.permissions.remove_user_permission("Employee", self.name, existing_user_id) def on_update(self): if self.user_id: From 7278c0ae85479a50f76d989d7542abe72719d9fb Mon Sep 17 00:00:00 2001 From: Rushabh Mehta Date: Fri, 3 Jul 2015 12:21:50 +0530 Subject: [PATCH 03/13] [minor] remove the term 'Masters' from setup, it is confusing and not used anywhere, add Company to Accounts tab --- erpnext/config/accounts.py | 5 +++++ erpnext/config/setup.py | 38 +------------------------------------- 2 files changed, 6 insertions(+), 37 deletions(-) diff --git a/erpnext/config/accounts.py b/erpnext/config/accounts.py index 64508b8a316..f32aeed0227 100644 --- a/erpnext/config/accounts.py +++ b/erpnext/config/accounts.py @@ -73,6 +73,11 @@ def get_data(): "label": _("Setup"), "icon": "icon-cog", "items": [ + { + "type": "doctype", + "name": "Company", + "description": _("Company (not Customer or Supplier) master.") + }, { "type": "doctype", "name": "Fiscal Year", diff --git a/erpnext/config/setup.py b/erpnext/config/setup.py index 961e4f7d791..a660942f875 100644 --- a/erpnext/config/setup.py +++ b/erpnext/config/setup.py @@ -110,43 +110,7 @@ def get_data(): "description": _("Setup SMS gateway settings") }, ] - }, - { - "label": _("Masters"), - "icon": "icon-star", - "items": [ - { - "type": "doctype", - "name": "Company", - "description": _("Company (not Customer or Supplier) master.") - }, - { - "type": "doctype", - "name": "Item", - "description": _("Item master.") - }, - { - "type": "doctype", - "name": "Customer", - "description": _("Customer master.") - }, - { - "type": "doctype", - "name": "Supplier", - "description": _("Supplier master.") - }, - { - "type": "doctype", - "name": "Contact", - "description": _("Contact master.") - }, - { - "type": "doctype", - "name": "Address", - "description": _("Address master.") - }, - ] - }, + } ] for module, label, icon in ( From 5a0fbff1a3088d0ab5b165e8958c43e0e211a8d2 Mon Sep 17 00:00:00 2001 From: Tsutomu Mimori Date: Fri, 3 Jul 2015 16:08:02 +0900 Subject: [PATCH 04/13] #3402 --- .../monthly_attendance_sheet.py | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) 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 e012d780e2b..f53accad65d 100644 --- a/erpnext/hr/report/monthly_attendance_sheet/monthly_attendance_sheet.py +++ b/erpnext/hr/report/monthly_attendance_sheet/monthly_attendance_sheet.py @@ -75,8 +75,20 @@ def get_conditions(filters): filters["month"] = ["Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "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 + else: + year_target = year_end + from calendar import monthrange - filters["total_days_in_month"] = monthrange(cint(filters["fiscal_year"].split("-")[-1]), + filters["total_days_in_month"] = monthrange(cint(year_target), filters["month"])[1] conditions = " and month(att_date) = %(month)s and fiscal_year = %(fiscal_year)s" From 1faaf71dfc11c9b834532632695799800fcc1264 Mon Sep 17 00:00:00 2001 From: Neil Trini Lasrado Date: Fri, 3 Jul 2015 12:22:04 +0530 Subject: [PATCH 05/13] Auto-Capitalize Item Attribute Abbreation, Prevent attribute to be deleated if Variant exists --- .../doctype/item_attribute/item_attribute.py | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/erpnext/stock/doctype/item_attribute/item_attribute.py b/erpnext/stock/doctype/item_attribute/item_attribute.py index d7c33a53945..73fefe42283 100644 --- a/erpnext/stock/doctype/item_attribute/item_attribute.py +++ b/erpnext/stock/doctype/item_attribute/item_attribute.py @@ -8,8 +8,14 @@ from frappe import _ class ItemAttribute(Document): def validate(self): + self.validate_duplication() + self.validate_attribute_values() + + + def validate_duplication(self): values, abbrs = [], [] for d in self.item_attribute_values: + d.abbr = d.abbr.upper() if d.attribute_value in values: frappe.throw(_("{0} must appear only once").format(d.attribute_value)) values.append(d.attribute_value) @@ -17,3 +23,14 @@ class ItemAttribute(Document): if d.abbr in abbrs: frappe.throw(_("{0} must appear only once").format(d.abbr)) abbrs.append(d.abbr) + + def validate_attribute_values(self): + attribute_values = [] + for d in self.item_attribute_values: + attribute_values.append(d.attribute_value) + + variant_attributes = frappe.db.sql("select DISTINCT attribute_value from `tabVariant Attribute` where attribute=%s", self.name) + if variant_attributes: + for d in variant_attributes: + if d[0] not in attribute_values: + frappe.throw(_("Attribute Value {0} cannot be removed from {1} as it has Variants.").format(d[0], self.name)) \ No newline at end of file From 85e6f5d04ee378b7f5c74a1d018aae0942ad529a Mon Sep 17 00:00:00 2001 From: Rushabh Mehta Date: Fri, 3 Jul 2015 12:59:08 +0530 Subject: [PATCH 06/13] [fix] [minor] fix customer_name, supplier_name labels --- .../accounts/doctype/purchase_invoice/purchase_invoice.json | 4 ++-- erpnext/accounts/doctype/sales_invoice/sales_invoice.json | 4 ++-- erpnext/buying/doctype/purchase_order/purchase_order.json | 4 ++-- erpnext/crm/doctype/lead/lead.json | 4 ++-- erpnext/selling/doctype/sales_order/sales_order.json | 4 ++-- 5 files changed, 10 insertions(+), 10 deletions(-) diff --git a/erpnext/accounts/doctype/purchase_invoice/purchase_invoice.json b/erpnext/accounts/doctype/purchase_invoice/purchase_invoice.json index dcbc60521e8..69b0708f1a5 100755 --- a/erpnext/accounts/doctype/purchase_invoice/purchase_invoice.json +++ b/erpnext/accounts/doctype/purchase_invoice/purchase_invoice.json @@ -38,7 +38,7 @@ "fieldtype": "Data", "hidden": 0, "in_list_view": 0, - "label": "Name", + "label": "Supplier Name", "oldfieldname": "supplier_name", "oldfieldtype": "Data", "permlevel": 0, @@ -940,7 +940,7 @@ "icon": "icon-file-text", "idx": 1, "is_submittable": 1, - "modified": "2015-06-22 07:30:06.743438", + "modified": "2015-07-03 03:26:32.934540", "modified_by": "Administrator", "module": "Accounts", "name": "Purchase Invoice", diff --git a/erpnext/accounts/doctype/sales_invoice/sales_invoice.json b/erpnext/accounts/doctype/sales_invoice/sales_invoice.json index 045678dc545..70d5f4adb40 100644 --- a/erpnext/accounts/doctype/sales_invoice/sales_invoice.json +++ b/erpnext/accounts/doctype/sales_invoice/sales_invoice.json @@ -47,7 +47,7 @@ "fieldtype": "Data", "hidden": 0, "in_list_view": 0, - "label": "Name", + "label": "Customer Name", "oldfieldname": "customer_name", "oldfieldtype": "Data", "permlevel": 0, @@ -1253,7 +1253,7 @@ "icon": "icon-file-text", "idx": 1, "is_submittable": 1, - "modified": "2015-06-22 06:39:22.072544", + "modified": "2015-07-03 03:25:40.519956", "modified_by": "Administrator", "module": "Accounts", "name": "Sales Invoice", diff --git a/erpnext/buying/doctype/purchase_order/purchase_order.json b/erpnext/buying/doctype/purchase_order/purchase_order.json index f65ba40a92c..8ca8ed08c1a 100644 --- a/erpnext/buying/doctype/purchase_order/purchase_order.json +++ b/erpnext/buying/doctype/purchase_order/purchase_order.json @@ -53,7 +53,7 @@ "fieldtype": "Data", "hidden": 0, "in_list_view": 0, - "label": "Name", + "label": "Supplier Name", "permlevel": 0, "read_only": 1 }, @@ -882,7 +882,7 @@ "icon": "icon-file-text", "idx": 1, "is_submittable": 1, - "modified": "2015-06-22 07:30:36.259753", + "modified": "2015-07-03 03:26:43.080551", "modified_by": "Administrator", "module": "Buying", "name": "Purchase Order", diff --git a/erpnext/crm/doctype/lead/lead.json b/erpnext/crm/doctype/lead/lead.json index e095426ab37..b2aa31a2503 100644 --- a/erpnext/crm/doctype/lead/lead.json +++ b/erpnext/crm/doctype/lead/lead.json @@ -29,7 +29,7 @@ "fieldtype": "Data", "in_filter": 1, "in_list_view": 0, - "label": "Contact Name", + "label": "Person Name", "oldfieldname": "lead_name", "oldfieldtype": "Data", "permlevel": 0, @@ -344,7 +344,7 @@ ], "icon": "icon-user", "idx": 1, - "modified": "2015-04-02 15:13:02.621854", + "modified": "2015-07-03 03:26:18.579905", "modified_by": "Administrator", "module": "CRM", "name": "Lead", diff --git a/erpnext/selling/doctype/sales_order/sales_order.json b/erpnext/selling/doctype/sales_order/sales_order.json index 59f54fbadcc..28f98e43304 100644 --- a/erpnext/selling/doctype/sales_order/sales_order.json +++ b/erpnext/selling/doctype/sales_order/sales_order.json @@ -52,7 +52,7 @@ "fieldname": "customer_name", "fieldtype": "Data", "hidden": 0, - "label": "Name", + "label": "Customer Name", "permlevel": 0, "read_only": 1 }, @@ -1089,7 +1089,7 @@ "idx": 1, "is_submittable": 1, "issingle": 0, - "modified": "2015-06-22 07:29:24.379272", + "modified": "2015-07-03 03:25:20.180721", "modified_by": "Administrator", "module": "Selling", "name": "Sales Order", From 24efb3122aae428c9d74d4c1602d7cea049ab095 Mon Sep 17 00:00:00 2001 From: Nabin Hait Date: Fri, 3 Jul 2015 15:20:14 +0530 Subject: [PATCH 07/13] [fix] Hide zero balance rows in batch-wise balance history report --- .../batch_wise_balance_history.py | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/erpnext/stock/report/batch_wise_balance_history/batch_wise_balance_history.py b/erpnext/stock/report/batch_wise_balance_history/batch_wise_balance_history.py index 69e13212fd7..9cba2032f82 100644 --- a/erpnext/stock/report/batch_wise_balance_history/batch_wise_balance_history.py +++ b/erpnext/stock/report/batch_wise_balance_history/batch_wise_balance_history.py @@ -20,10 +20,11 @@ def execute(filters=None): for wh in sorted(iwb_map[item]): for batch in sorted(iwb_map[item][wh]): qty_dict = iwb_map[item][wh][batch] - data.append([item, item_map[item]["item_name"], item_map[item]["description"], wh, batch, - flt(qty_dict.opening_qty, float_precision), flt(qty_dict.in_qty, float_precision), - flt(qty_dict.out_qty, float_precision), flt(qty_dict.bal_qty, float_precision) - ]) + if qty_dict.opening_qty or qty_dict.in_qty or qty_dict.out_qty or qty_dict.bal_qty: + data.append([item, item_map[item]["item_name"], item_map[item]["description"], wh, batch, + flt(qty_dict.opening_qty, float_precision), flt(qty_dict.in_qty, float_precision), + flt(qty_dict.out_qty, float_precision), flt(qty_dict.bal_qty, float_precision) + ]) return columns, data From d7441ec05144adb40e5c798912453a2032ecfd02 Mon Sep 17 00:00:00 2001 From: Nabin Hait Date: Fri, 3 Jul 2015 19:07:23 +0530 Subject: [PATCH 08/13] [fix][patch] delete item variant attributes if no variants exists against that item --- erpnext/patches/v5_0/item_variants.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/erpnext/patches/v5_0/item_variants.py b/erpnext/patches/v5_0/item_variants.py index 62e9ac9e1f0..66300be671e 100644 --- a/erpnext/patches/v5_0/item_variants.py +++ b/erpnext/patches/v5_0/item_variants.py @@ -11,6 +11,9 @@ def execute(): manage_variant.attributes = frappe.db.sql("select item_attribute as attribute, item_attribute_value as attribute_value \ from `tabItem Variant` where parent = %s", d.name, as_dict=1) if manage_variant.attributes: - manage_variant.generate_combinations() - manage_variant.create_variants() + if not frappe.get_list("Item", filters={"variant_of": d.name}, limit_page_length=1): + frappe.db.sql("delete from `tabItem Variant` where parent=%s", d.name) + else: + manage_variant.generate_combinations() + manage_variant.create_variants() frappe.delete_doc("DocType", "Item Variant") \ No newline at end of file From 4d64acfafc42bcf9bfe818ebe35d743232c391ed Mon Sep 17 00:00:00 2001 From: Neil Trini Lasrado Date: Sat, 4 Jul 2015 14:50:00 +0530 Subject: [PATCH 09/13] Autocomplete issues fixed in Manage Variants --- erpnext/stock/doctype/manage_variants/manage_variants.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/erpnext/stock/doctype/manage_variants/manage_variants.js b/erpnext/stock/doctype/manage_variants/manage_variants.js index ba5c46e8eb9..e8b7adefece 100644 --- a/erpnext/stock/doctype/manage_variants/manage_variants.js +++ b/erpnext/stock/doctype/manage_variants/manage_variants.js @@ -3,7 +3,7 @@ frappe.ui.form.on("Manage Variants", { onload: function(frm) { - var df = frappe.meta.get_docfield("Variant Attribute", "attribute_value"); + var df = frappe.meta.get_docfield("Variant Attribute", "attribute_value", "Manage Variants"); df.on_make = function(field) { $(field.input_area).addClass("ui-front"); field.$input.autocomplete({ From 56912791e20bd310a8674da6608d294f9cc4e16f Mon Sep 17 00:00:00 2001 From: Rushabh Mehta Date: Mon, 6 Jul 2015 11:14:31 +0530 Subject: [PATCH 10/13] [fix] quotation list #3492 --- erpnext/selling/doctype/quotation/quotation_list.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/erpnext/selling/doctype/quotation/quotation_list.js b/erpnext/selling/doctype/quotation/quotation_list.js index add7aefa95a..204ace13f4a 100644 --- a/erpnext/selling/doctype/quotation/quotation_list.js +++ b/erpnext/selling/doctype/quotation/quotation_list.js @@ -2,7 +2,9 @@ frappe.listview_settings['Quotation'] = { add_fields: ["customer_name", "base_grand_total", "status", "company", "currency"], get_indicator: function(doc) { - if(doc.status==="Ordered") { + if(doc.status==="Submitted") { + return [__("Submitted"), "blue", "status,=,Submitted"]; + } else if(doc.status==="Ordered") { return [__("Ordered"), "green", "status,=,Ordered"]; } else if(doc.status==="Lost") { return [__("Lost"), "darkgrey", "status,=,Lost"]; From 1a0e86f11ddac5ff4842e87cfc6796670866ca0f Mon Sep 17 00:00:00 2001 From: Neil Trini Lasrado Date: Mon, 6 Jul 2015 14:46:06 +0530 Subject: [PATCH 11/13] Update item_attribute.py Error Description Changed --- erpnext/stock/doctype/item_attribute/item_attribute.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/erpnext/stock/doctype/item_attribute/item_attribute.py b/erpnext/stock/doctype/item_attribute/item_attribute.py index 73fefe42283..171e1186f66 100644 --- a/erpnext/stock/doctype/item_attribute/item_attribute.py +++ b/erpnext/stock/doctype/item_attribute/item_attribute.py @@ -33,4 +33,4 @@ class ItemAttribute(Document): if variant_attributes: for d in variant_attributes: if d[0] not in attribute_values: - frappe.throw(_("Attribute Value {0} cannot be removed from {1} as it has Variants.").format(d[0], self.name)) \ No newline at end of file + frappe.throw(_("Attribute Value {0} cannot be removed from {1} as Item Variants exist with this Attribute.").format(d[0], self.name)) From 9269813207bff0b03edc692a11932d4b2daa09bd Mon Sep 17 00:00:00 2001 From: Nabin Hait Date: Mon, 6 Jul 2015 15:13:35 +0530 Subject: [PATCH 12/13] Added change log --- erpnext/change_log/v5/v5_1_3.md | 3 +++ 1 file changed, 3 insertions(+) create mode 100644 erpnext/change_log/v5/v5_1_3.md diff --git a/erpnext/change_log/v5/v5_1_3.md b/erpnext/change_log/v5/v5_1_3.md new file mode 100644 index 00000000000..9825a10ffb3 --- /dev/null +++ b/erpnext/change_log/v5/v5_1_3.md @@ -0,0 +1,3 @@ +- Hide zero balance rows in batch-wise balance history report +- Autocomplete issue fixed in Manage Variants +- Remove user permission (Employee role) if user id is unset from Employee record \ No newline at end of file From 9a38e669ef404688a49b6501f90210575d7cc4c6 Mon Sep 17 00:00:00 2001 From: Nabin Hait Date: Mon, 6 Jul 2015 16:02:32 +0600 Subject: [PATCH 13/13] bumped to version 5.1.3 --- 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 1d65332e750..c8b2f49e372 100644 --- a/erpnext/__version__.py +++ b/erpnext/__version__.py @@ -1,2 +1,2 @@ from __future__ import unicode_literals -__version__ = '5.1.2' +__version__ = '5.1.3' diff --git a/erpnext/hooks.py b/erpnext/hooks.py index b2ae87b221d..a05e5aeafb9 100644 --- a/erpnext/hooks.py +++ b/erpnext/hooks.py @@ -5,7 +5,7 @@ app_publisher = "Frappe Technologies Pvt. Ltd. and Contributors" app_description = "Open Source Enterprise Resource Planning for Small and Midsized Organizations" app_icon = "icon-th" app_color = "#e74c3c" -app_version = "5.1.2" +app_version = "5.1.3" error_report_email = "support@erpnext.com" diff --git a/setup.py b/setup.py index 8820356c6c0..a0e3f14045c 100644 --- a/setup.py +++ b/setup.py @@ -1,6 +1,6 @@ from setuptools import setup, find_packages -version = "5.1.2" +version = "5.1.3" with open("requirements.txt", "r") as f: install_requires = f.readlines()