From a22e0d0c99658c79819de71dc73201f9c548a5f2 Mon Sep 17 00:00:00 2001 From: Zarrar Date: Mon, 23 Jul 2018 11:31:04 +0530 Subject: [PATCH 01/12] return empty if no stock ledger entry found (#14968) --- erpnext/stock/report/stock_balance/stock_balance.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/erpnext/stock/report/stock_balance/stock_balance.py b/erpnext/stock/report/stock_balance/stock_balance.py index e51ab0b98a..a13965613c 100644 --- a/erpnext/stock/report/stock_balance/stock_balance.py +++ b/erpnext/stock/report/stock_balance/stock_balance.py @@ -15,6 +15,11 @@ def execute(filters=None): columns = get_columns() items = get_items(filters) sle = get_stock_ledger_entries(filters, items) + + # if no stock ledger entry found return + if not sle: + return columns, [] + iwb_map = get_item_warehouse_map(filters, sle) item_map = get_item_details(items, sle, filters) item_reorder_detail_map = get_item_reorder_details(item_map.keys()) From 6b862fcae5ee91f5d332962baf516750208d7238 Mon Sep 17 00:00:00 2001 From: rohitwaghchaure Date: Mon, 23 Jul 2018 13:02:07 +0530 Subject: [PATCH 02/12] [Fix] Rounded total is not working in the purchase receipt (#14984) --- .../purchase_receipt/purchase_receipt.json | 174 ++++++++++++------ 1 file changed, 118 insertions(+), 56 deletions(-) diff --git a/erpnext/stock/doctype/purchase_receipt/purchase_receipt.json b/erpnext/stock/doctype/purchase_receipt/purchase_receipt.json index 15372c15d9..177955fef7 100755 --- a/erpnext/stock/doctype/purchase_receipt/purchase_receipt.json +++ b/erpnext/stock/doctype/purchase_receipt/purchase_receipt.json @@ -2246,6 +2246,38 @@ "set_only_once": 0, "unique": 0 }, + { + "allow_bulk_edit": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "depends_on": "eval:!doc.disable_rounded_total", + "fieldname": "rounded_total", + "fieldtype": "Currency", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "Rounded Total", + "length": 0, + "no_copy": 1, + "options": "currency", + "permlevel": 0, + "precision": "", + "print_hide": 1, + "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_bulk_edit": 0, "allow_on_submit": 0, @@ -2277,6 +2309,36 @@ "set_only_once": 0, "unique": 0 }, + { + "allow_bulk_edit": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fieldname": "disable_rounded_total", + "fieldtype": "Check", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "Disable Rounded Total", + "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_bulk_edit": 0, "allow_on_submit": 0, @@ -2978,69 +3040,69 @@ }, { "allow_bulk_edit": 0, - "allow_on_submit": 1, - "bold": 0, - "collapsible": 0, - "columns": 0, - "fieldname": "group_same_items", - "fieldtype": "Check", - "hidden": 0, - "ignore_user_permissions": 0, - "ignore_xss_filter": 0, - "in_filter": 0, - "in_global_search": 0, - "in_list_view": 0, - "in_standard_filter": 0, - "label": "Group same items", - "length": 0, - "no_copy": 0, - "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, + "allow_on_submit": 1, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fieldname": "group_same_items", + "fieldtype": "Check", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "Group same items", + "length": 0, + "no_copy": 0, + "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_bulk_edit": 0, + "allow_bulk_edit": 0, "allow_on_submit": 0, "bold": 0, "collapsible": 0, "columns": 0, - "fieldname": "column_break_97", - "fieldtype": "Column Break", - "hidden": 0, - "ignore_user_permissions": 0, - "ignore_xss_filter": 0, - "in_filter": 0, - "in_global_search": 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, + "fieldname": "column_break_97", + "fieldtype": "Column Break", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 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_bulk_edit": 0, - "allow_on_submit": 0, - "bold": 0, - "collapsible": 0, - "columns": 0, + "allow_bulk_edit": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, "fieldname": "other_details", "fieldtype": "HTML", "hidden": 1, @@ -3301,7 +3363,7 @@ "istable": 0, "max_attachments": 0, "menu_index": 0, - "modified": "2018-07-06 02:59:59.609643", + "modified": "2018-07-23 11:27:52.534561", "modified_by": "Administrator", "module": "Stock", "name": "Purchase Receipt", From cd717e422f3dda9110d3765fb5359b30e929d2e4 Mon Sep 17 00:00:00 2001 From: Shreya Shah Date: Mon, 23 Jul 2018 14:15:20 +0530 Subject: [PATCH 03/12] Modify renaming process of Account (#14839) * Disable renaming for Account Master * Update account name along with account number * Fix as per suggestions * Update account.js * Fix typo * Remove after_rename and before_rename methods * Modify test case * Modify field placement * Remove unused method --- erpnext/accounts/doctype/account/account.js | 19 +++-- erpnext/accounts/doctype/account/account.json | 22 +++++- erpnext/accounts/doctype/account/account.py | 69 ++----------------- .../accounts/doctype/account/test_account.py | 20 +++--- 4 files changed, 49 insertions(+), 81 deletions(-) diff --git a/erpnext/accounts/doctype/account/account.js b/erpnext/accounts/doctype/account/account.js index 3a86fbcda9..79e11e3539 100644 --- a/erpnext/accounts/doctype/account/account.js +++ b/erpnext/accounts/doctype/account/account.js @@ -49,7 +49,7 @@ frappe.ui.form.on('Account', { } if(!frm.doc.__islocal) { - frm.add_custom_button(__('Update Account Number'), function () { + frm.add_custom_button(__('Update Account Name / Number'), function () { frm.trigger("update_account_number"); }); } @@ -100,18 +100,25 @@ frappe.ui.form.on('Account', { update_account_number: function(frm) { var d = new frappe.ui.Dialog({ - title: __('Update Account Number'), + title: __('Update Account Number / Name'), fields: [ + { + "label": "Account Name", + "fieldname": "account_name", + "fieldtype": "Data", + "reqd": 1, + "default": frm.doc.account_name + }, { "label": "Account Number", "fieldname": "account_number", "fieldtype": "Data", - "reqd": 1 + "default": frm.doc.account_number } ], primary_action: function() { var data = d.get_values(); - if(data.account_number === frm.doc.account_number) { + if(data.account_number === frm.doc.account_number && data.account_name === frm.doc.account_name) { d.hide(); return; } @@ -120,6 +127,7 @@ frappe.ui.form.on('Account', { method: "erpnext.accounts.doctype.account.account.update_account_number", args: { account_number: data.account_number, + account_name: data.account_name, name: frm.doc.name }, callback: function(r) { @@ -128,6 +136,7 @@ frappe.ui.form.on('Account', { frappe.set_route("Form", "Account", r.message); } else { frm.set_value("account_number", data.account_number); + frm.set_value("account_name", data.account_name); } d.hide(); } @@ -138,4 +147,4 @@ frappe.ui.form.on('Account', { }); d.show(); } -}); \ No newline at end of file +}); diff --git a/erpnext/accounts/doctype/account/account.json b/erpnext/accounts/doctype/account/account.json index 8731c5108f..9f649caa49 100644 --- a/erpnext/accounts/doctype/account/account.json +++ b/erpnext/accounts/doctype/account/account.json @@ -2,7 +2,7 @@ "allow_copy": 1, "allow_guest_to_view": 0, "allow_import": 1, - "allow_rename": 1, + "allow_rename": 0, "beta": 0, "creation": "2013-01-30 12:49:46", "custom": 0, @@ -40,6 +40,7 @@ "reqd": 0, "search_index": 0, "set_only_once": 0, + "translatable": 0, "unique": 0 }, { @@ -68,6 +69,7 @@ "reqd": 0, "search_index": 0, "set_only_once": 0, + "translatable": 0, "unique": 0, "width": "50%" }, @@ -100,6 +102,7 @@ "reqd": 1, "search_index": 0, "set_only_once": 0, + "translatable": 0, "unique": 0 }, { @@ -130,6 +133,7 @@ "reqd": 0, "search_index": 0, "set_only_once": 0, + "translatable": 0, "unique": 0 }, { @@ -161,6 +165,7 @@ "reqd": 0, "search_index": 0, "set_only_once": 0, + "translatable": 0, "unique": 0 }, { @@ -193,6 +198,7 @@ "reqd": 1, "search_index": 0, "set_only_once": 0, + "translatable": 0, "unique": 0 }, { @@ -223,6 +229,7 @@ "reqd": 0, "search_index": 0, "set_only_once": 0, + "translatable": 0, "unique": 0 }, { @@ -253,6 +260,7 @@ "reqd": 0, "search_index": 0, "set_only_once": 0, + "translatable": 0, "unique": 0 }, { @@ -285,6 +293,7 @@ "reqd": 0, "search_index": 0, "set_only_once": 0, + "translatable": 0, "unique": 0 }, { @@ -313,6 +322,7 @@ "reqd": 0, "search_index": 0, "set_only_once": 0, + "translatable": 0, "unique": 0, "width": "50%" }, @@ -346,6 +356,7 @@ "reqd": 1, "search_index": 1, "set_only_once": 0, + "translatable": 0, "unique": 0 }, { @@ -379,6 +390,7 @@ "reqd": 0, "search_index": 0, "set_only_once": 0, + "translatable": 0, "unique": 0 }, { @@ -411,6 +423,7 @@ "reqd": 0, "search_index": 0, "set_only_once": 0, + "translatable": 0, "unique": 0 }, { @@ -444,6 +457,7 @@ "reqd": 0, "search_index": 0, "set_only_once": 0, + "translatable": 0, "unique": 0 }, { @@ -474,6 +488,7 @@ "reqd": 0, "search_index": 0, "set_only_once": 0, + "translatable": 0, "unique": 0 }, { @@ -503,6 +518,7 @@ "reqd": 0, "search_index": 1, "set_only_once": 0, + "translatable": 0, "unique": 0 }, { @@ -532,6 +548,7 @@ "reqd": 0, "search_index": 1, "set_only_once": 0, + "translatable": 0, "unique": 0 }, { @@ -561,6 +578,7 @@ "reqd": 0, "search_index": 0, "set_only_once": 0, + "translatable": 0, "unique": 0 } ], @@ -575,7 +593,7 @@ "issingle": 0, "istable": 0, "max_attachments": 0, - "modified": "2017-08-22 17:39:10.711343", + "modified": "2018-07-08 09:47:04.287841", "modified_by": "Administrator", "module": "Accounts", "name": "Account", diff --git a/erpnext/accounts/doctype/account/account.py b/erpnext/accounts/doctype/account/account.py index ac19690b5f..35974e527e 100644 --- a/erpnext/accounts/doctype/account/account.py +++ b/erpnext/accounts/doctype/account/account.py @@ -165,53 +165,6 @@ class Account(NestedSet): super(Account, self).on_trash(True) - def before_rename(self, old, new, merge=False): - # Add company abbr if not provided - from erpnext.setup.doctype.company.company import get_name_with_abbr - new_account = get_name_with_abbr(new, self.company) - if not merge: - new_account = get_name_with_number(new_account, self.account_number) - else: - # Validate properties before merging - if not frappe.db.exists("Account", new): - throw(_("Account {0} does not exist").format(new)) - - val = list(frappe.db.get_value("Account", new_account, - ["is_group", "root_type", "company"])) - - if val != [self.is_group, self.root_type, self.company]: - throw(_("""Merging is only possible if following properties are same in both records. Is Group, Root Type, Company""")) - - if self.is_group and frappe.db.get_value("Account", new, "parent_account") == old: - frappe.db.set_value("Account", new, "parent_account", - frappe.db.get_value("Account", old, "parent_account")) - - return new_account - - def after_rename(self, old, new, merge=False): - super(Account, self).after_rename(old, new, merge) - - if not merge: - new_acc = frappe.db.get_value("Account", new, ["account_name", "account_number"], as_dict=1) - - # exclude company abbr - new_parts = new.split(" - ")[:-1] - # update account number and remove from parts - if new_parts[0][0].isdigit(): - # if account number is separate by space, split using space - if len(new_parts) == 1: - new_parts = new.split(" ") - if new_acc.account_number != new_parts[0]: - self.account_number = new_parts[0] - self.db_set("account_number", new_parts[0]) - new_parts = new_parts[1:] - - # update account name - account_name = " - ".join(new_parts) - if new_acc.account_name != account_name: - self.account_name = account_name - self.db_set("account_name", account_name) - def get_parent_account(doctype, txt, searchfield, start, page_len, filters): return frappe.db.sql("""select name from tabAccount where is_group = 1 and docstatus != 2 and company = %s @@ -252,25 +205,15 @@ def validate_account_number(name, account_number, company): .format(account_number, account_with_same_number)) @frappe.whitelist() -def update_account_number(name, account_number): - account = frappe.db.get_value("Account", name, ["account_name", "company"], as_dict=True) +def update_account_number(name, account_name, account_number=None): + account = frappe.db.get_value("Account", name, ["company"], as_dict=True) validate_account_number(name, account_number, account.company) - - frappe.db.set_value("Account", name, "account_number", account_number) - - account_name = account.account_name - if account_name[0].isdigit(): - separator = " - " if " - " in account_name else " " - account_name = account_name.split(separator, 1)[1] - frappe.db.set_value("Account", name, "account_name", account_name) + if account_number: + frappe.db.set_value("Account", name, "account_number", account_number.strip()) + frappe.db.set_value("Account", name, "account_name", account_name.strip()) new_name = get_account_autoname(account_number, account_name, account.company) if name != new_name: - frappe.rename_doc("Account", name, new_name) + frappe.rename_doc("Account", name, new_name, ignore_permissions=1) return new_name - -def get_name_with_number(new_account, account_number): - if account_number and not new_account[0].isdigit(): - new_account = account_number + " - " + new_account - return new_account \ No newline at end of file diff --git a/erpnext/accounts/doctype/account/test_account.py b/erpnext/accounts/doctype/account/test_account.py index a4253e2eac..2d9931b8c4 100644 --- a/erpnext/accounts/doctype/account/test_account.py +++ b/erpnext/accounts/doctype/account/test_account.py @@ -5,6 +5,7 @@ from __future__ import unicode_literals import unittest import frappe from erpnext.stock import get_warehouse_account, get_company_default_inventory_account +from erpnext.accounts.doctype.account.account import update_account_number class TestAccount(unittest.TestCase): def test_rename_account(self): @@ -21,21 +22,18 @@ class TestAccount(unittest.TestCase): self.assertEqual(account_number, "1210") self.assertEqual(account_name, "Debtors") - frappe.rename_doc("Account", "1210 - Debtors - _TC", "1211 - Debtors 1 - _TC") + new_account_number = "1211-11-4 - 6 - " + new_account_name = "Debtors 1 - Test - " - new_acc = frappe.db.get_value("Account", "1211 - Debtors 1 - _TC", + update_account_number("1210 - Debtors - _TC", new_account_number, new_account_name) + + new_acc = frappe.db.get_value("Account", "1211-11-4 - 6 - - Debtors 1 - Test - - _TC", ["account_name", "account_number"], as_dict=1) - self.assertEqual(new_acc.account_name, "Debtors 1") - self.assertEqual(new_acc.account_number, "1211") - frappe.rename_doc("Account", "1211 - Debtors 1 - _TC", "Debtors 2") + self.assertEqual(new_acc.account_name, "Debtors 1 - Test -") + self.assertEqual(new_acc.account_number, "1211-11-4 - 6 -") - new_acc = frappe.db.get_value("Account", "1211 - Debtors 2 - _TC", - ["account_name", "account_number"], as_dict=1) - self.assertEqual(new_acc.account_name, "Debtors 2") - self.assertEqual(new_acc.account_number, "1211") - - frappe.delete_doc("Account", "1211 - Debtors 2 - _TC") + frappe.delete_doc("Account", "1211-11-4 - 6 - Debtors 1 - Test - - _TC") def _make_test_records(verbose): from frappe.test_runner import make_test_objects From e50e0e4b30e242813f0ad83cca82d8dd6933b61e Mon Sep 17 00:00:00 2001 From: Nabin Hait Date: Wed, 25 Jul 2018 17:49:47 +0530 Subject: [PATCH 04/12] Update repost_reserved_qty_for_production.py --- erpnext/patches/v9_2/repost_reserved_qty_for_production.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/erpnext/patches/v9_2/repost_reserved_qty_for_production.py b/erpnext/patches/v9_2/repost_reserved_qty_for_production.py index 27cce1dc5d..c4eab19d2e 100644 --- a/erpnext/patches/v9_2/repost_reserved_qty_for_production.py +++ b/erpnext/patches/v9_2/repost_reserved_qty_for_production.py @@ -1,7 +1,8 @@ import frappe def execute(): + frappe.reload_doc("stock", "doctype", "bin") bins = frappe.db.sql("select name from `tabBin` where reserved_qty_for_production > 0") for d in bins: bin_doc = frappe.get_doc("Bin", d[0]) - bin_doc.update_reserved_qty_for_production() \ No newline at end of file + bin_doc.update_reserved_qty_for_production() From 0fe6ced99d05fae4aaad4ff385475997a2600c4a Mon Sep 17 00:00:00 2001 From: rohitwaghchaure Date: Fri, 27 Jul 2018 10:33:30 +0530 Subject: [PATCH 05/12] [Fix] Valuation rate for serialized items (#15017) --- erpnext/stock/stock_ledger.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/erpnext/stock/stock_ledger.py b/erpnext/stock/stock_ledger.py index 22db7f12ab..53267d64bc 100644 --- a/erpnext/stock/stock_ledger.py +++ b/erpnext/stock/stock_ledger.py @@ -223,9 +223,10 @@ class update_entries_after(object): tuple(serial_no))[0][0]) new_stock_qty = self.qty_after_transaction + actual_qty + if new_stock_qty > 0: new_stock_value = (self.qty_after_transaction * self.valuation_rate) + stock_value_change - if new_stock_value > 0: + if new_stock_value >= 0: # calculate new valuation rate only if stock value is positive # else it remains the same as that of previous entry self.valuation_rate = new_stock_value / new_stock_qty From d0a2b1619bf473d1c057706adad09c4cdf8aad85 Mon Sep 17 00:00:00 2001 From: Nabin Hait Date: Fri, 27 Jul 2018 10:51:41 +0530 Subject: [PATCH 06/12] Optimization for marking student attendance --- erpnext/education/api.py | 8 +++----- .../doctype/student_attendance/student_attendance.json | 8 ++++---- 2 files changed, 7 insertions(+), 9 deletions(-) diff --git a/erpnext/education/api.py b/erpnext/education/api.py index 99fb36e52c..2bd2c2334d 100644 --- a/erpnext/education/api.py +++ b/erpnext/education/api.py @@ -88,16 +88,14 @@ def make_attendance_records(student, student_name, status, course_schedule=None, :param course_schedule: Course Schedule. :param status: Status (Present/Absent) """ - student_attendance_list = frappe.get_list("Student Attendance", fields = ['name'], filters = { + student_attendance = frappe.get_doc({ + "doctype": "Student Attendance", "student": student, "course_schedule": course_schedule, "student_group": student_group, "date": date }) - - if student_attendance_list: - student_attendance = frappe.get_doc("Student Attendance", student_attendance_list[0]) - else: + if not student_attendance: student_attendance = frappe.new_doc("Student Attendance") student_attendance.student = student student_attendance.student_name = student_name diff --git a/erpnext/education/doctype/student_attendance/student_attendance.json b/erpnext/education/doctype/student_attendance/student_attendance.json index 07530b40a0..7077d23b14 100644 --- a/erpnext/education/doctype/student_attendance/student_attendance.json +++ b/erpnext/education/doctype/student_attendance/student_attendance.json @@ -3,7 +3,7 @@ "allow_guest_to_view": 0, "allow_import": 1, "allow_rename": 0, - "autoname": "SA.######", + "autoname": "", "beta": 0, "creation": "2015-11-05 15:20:23.045996", "custom": 0, @@ -40,7 +40,7 @@ "remember_last_selected_value": 0, "report_hide": 0, "reqd": 1, - "search_index": 0, + "search_index": 1, "set_only_once": 0, "unique": 0 }, @@ -101,7 +101,7 @@ "remember_last_selected_value": 0, "report_hide": 0, "reqd": 1, - "search_index": 0, + "search_index": 1, "set_only_once": 0, "unique": 0 }, @@ -239,7 +239,7 @@ "issingle": 0, "istable": 0, "max_attachments": 0, - "modified": "2017-11-10 19:09:51.041960", + "modified": "2018-07-27 10:48:22.301531", "modified_by": "Administrator", "module": "Education", "name": "Student Attendance", From 1f4c263a6348a301b0534f3678c7c28b1cacd269 Mon Sep 17 00:00:00 2001 From: Shreya Shah Date: Fri, 27 Jul 2018 10:59:14 +0530 Subject: [PATCH 07/12] [minor] Program Enrollment Tool (#15013) * Make academic term field mandatory * Add disabled field to Student Group * Mandatory check in Education Settings for Academic Term * Fix as per review --- erpnext/demo/user/education.py | 8 ++--- .../education_settings.json | 34 ++++++++++++++++++- .../doctype/fee_schedule/fee_schedule.js | 3 +- .../program_enrollment.json | 2 +- .../program_enrollment/program_enrollment.py | 1 - .../program_enrollment_tool.js | 3 ++ .../program_enrollment_tool.json | 2 +- .../program_enrollment_tool.py | 5 +++ .../student_attendance_tool.js | 3 +- .../doctype/student_group/student_group.json | 33 +++++++++++++++++- .../student_and_guardian_contact_details.py | 2 +- 11 files changed, 84 insertions(+), 12 deletions(-) diff --git a/erpnext/demo/user/education.py b/erpnext/demo/user/education.py index 8c82f879ab..e4bb9ffe13 100644 --- a/erpnext/demo/user/education.py +++ b/erpnext/demo/user/education.py @@ -51,12 +51,12 @@ def enroll_random_student(current_date): def assign_student_group(student, student_name, program, courses, batch): course_list = [d["course"] for d in courses] - for d in frappe.get_list("Student Group", fields=("name"), filters={"program": program, "course":("in", course_list)}): + for d in frappe.get_list("Student Group", fields=("name"), filters={"program": program, "course":("in", course_list), "disabled": 0}): student_group = frappe.get_doc("Student Group", d.name) student_group.append("students", {"student": student, "student_name": student_name, "group_roll_number":len(student_group.students)+1, "active":1}) student_group.save() - student_batch = frappe.get_list("Student Group", fields=("name"), filters={"program": program, "group_based_on":"Batch", "batch":batch})[0] + student_batch = frappe.get_list("Student Group", fields=("name"), filters={"program": program, "group_based_on":"Batch", "batch":batch, "disabled": 0})[0] student_batch_doc = frappe.get_doc("Student Group", student_batch.name) student_batch_doc.append("students", {"student": student, "student_name": student_name, "group_roll_number":len(student_batch_doc.students)+1, "active":1}) @@ -65,7 +65,7 @@ def assign_student_group(student, student_name, program, courses, batch): def mark_student_attendance(current_date): status = ["Present", "Absent"] - for d in frappe.db.get_list("Student Group", filters={"group_based_on": "Batch"}): + for d in frappe.db.get_list("Student Group", filters={"group_based_on": "Batch", "disabled": 0}): students = get_student_group_students(d.name) for stud in students: make_attendance_records(stud.student, stud.student_name, status[weighted_choice([9,4])], None, d.name, current_date) @@ -77,7 +77,7 @@ def make_fees(): def make_assessment_plan(date): for d in range(1,4): - random_group = get_random("Student Group", {"group_based_on": "Course"}, True) + random_group = get_random("Student Group", {"group_based_on": "Course", "disabled": 0}, True) doc = frappe.new_doc("Assessment Plan") doc.student_group = random_group.name doc.course = random_group.course diff --git a/erpnext/education/doctype/education_settings/education_settings.json b/erpnext/education/doctype/education_settings/education_settings.json index a0b8e99f48..c1eaa11284 100644 --- a/erpnext/education/doctype/education_settings/education_settings.json +++ b/erpnext/education/doctype/education_settings/education_settings.json @@ -195,6 +195,38 @@ "set_only_once": 0, "unique": 0 }, + { + "allow_bulk_edit": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "default": "0", + "description": "If enabled, field Academic Term will be Mandatory in Program Enrollment Tool.", + "fieldname": "academic_term_reqd", + "fieldtype": "Check", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "Make Academic Term Mandatory", + "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_bulk_edit": 0, "allow_on_submit": 0, @@ -267,7 +299,7 @@ "issingle": 1, "istable": 0, "max_attachments": 0, - "modified": "2017-11-28 15:45:30.324324", + "modified": "2018-07-26 04:43:35.406690", "modified_by": "Administrator", "module": "Education", "name": "Education Settings", diff --git a/erpnext/education/doctype/fee_schedule/fee_schedule.js b/erpnext/education/doctype/fee_schedule/fee_schedule.js index c4fff77d89..13383312a8 100644 --- a/erpnext/education/doctype/fee_schedule/fee_schedule.js +++ b/erpnext/education/doctype/fee_schedule/fee_schedule.js @@ -31,7 +31,8 @@ frappe.ui.form.on('Fee Schedule', { return { "program": frm.doc.program, "academic_term": frm.doc.academic_term, - "academic_year": frm.doc.academic_year + "academic_year": frm.doc.academic_year, + "disabled": 0 }; }); frappe.realtime.on("fee_schedule_progress", function(data) { diff --git a/erpnext/education/doctype/program_enrollment/program_enrollment.json b/erpnext/education/doctype/program_enrollment/program_enrollment.json index 00b1373596..7e0701c8c5 100644 --- a/erpnext/education/doctype/program_enrollment/program_enrollment.json +++ b/erpnext/education/doctype/program_enrollment/program_enrollment.json @@ -671,7 +671,7 @@ "istable": 0, "max_attachments": 0, "menu_index": 0, - "modified": "2017-12-27 10:59:36.838548", + "modified": "2018-07-26 04:44:03.781418", "modified_by": "Administrator", "module": "Education", "name": "Program Enrollment", diff --git a/erpnext/education/doctype/program_enrollment/program_enrollment.py b/erpnext/education/doctype/program_enrollment/program_enrollment.py index 0f9bb96adb..455ad9cfd7 100644 --- a/erpnext/education/doctype/program_enrollment/program_enrollment.py +++ b/erpnext/education/doctype/program_enrollment/program_enrollment.py @@ -86,7 +86,6 @@ def get_program_courses(doctype, txt, searchfield, start, page_len, filters): "program": filters['program'] }) - @frappe.whitelist() def get_students(doctype, txt, searchfield, start, page_len, filters): if not filters.get("academic_term"): diff --git a/erpnext/education/doctype/program_enrollment_tool/program_enrollment_tool.js b/erpnext/education/doctype/program_enrollment_tool/program_enrollment_tool.js index 2e54a2febf..06d7598194 100644 --- a/erpnext/education/doctype/program_enrollment_tool/program_enrollment_tool.js +++ b/erpnext/education/doctype/program_enrollment_tool/program_enrollment_tool.js @@ -5,6 +5,9 @@ frappe.ui.form.on("Program Enrollment Tool", { setup: function(frm) { frm.add_fetch("student", "title", "student_name"); frm.add_fetch("student_applicant", "title", "student_name"); + if(frm.doc.__onload && frm.doc.__onload.academic_term_reqd) { + frm.toggle_reqd("academic_term", true); + } }, "refresh": function(frm) { diff --git a/erpnext/education/doctype/program_enrollment_tool/program_enrollment_tool.json b/erpnext/education/doctype/program_enrollment_tool/program_enrollment_tool.json index d611a6f270..35ad98d120 100644 --- a/erpnext/education/doctype/program_enrollment_tool/program_enrollment_tool.json +++ b/erpnext/education/doctype/program_enrollment_tool/program_enrollment_tool.json @@ -513,7 +513,7 @@ "issingle": 1, "istable": 0, "max_attachments": 0, - "modified": "2018-01-02 11:59:40.230689", + "modified": "2018-07-26 04:44:13.232146", "modified_by": "Administrator", "module": "Education", "name": "Program Enrollment Tool", diff --git a/erpnext/education/doctype/program_enrollment_tool/program_enrollment_tool.py b/erpnext/education/doctype/program_enrollment_tool/program_enrollment_tool.py index ca5b49cde7..6223331c69 100644 --- a/erpnext/education/doctype/program_enrollment_tool/program_enrollment_tool.py +++ b/erpnext/education/doctype/program_enrollment_tool/program_enrollment_tool.py @@ -7,8 +7,13 @@ import frappe from frappe import _ from frappe.model.document import Document from erpnext.education.api import enroll_student +from frappe.utils import cint class ProgramEnrollmentTool(Document): + def onload(self): + academic_term_reqd = cint(frappe.db.get_single_value('Education Settings', 'academic_term_reqd')) + self.set_onload("academic_term_reqd", academic_term_reqd) + def get_students(self): students = [] if not self.get_students_from: diff --git a/erpnext/education/doctype/student_attendance_tool/student_attendance_tool.js b/erpnext/education/doctype/student_attendance_tool/student_attendance_tool.js index df6d13250a..cc9607da19 100644 --- a/erpnext/education/doctype/student_attendance_tool/student_attendance_tool.js +++ b/erpnext/education/doctype/student_attendance_tool/student_attendance_tool.js @@ -7,7 +7,8 @@ frappe.ui.form.on('Student Attendance Tool', { frm.set_query("student_group", function() { return { "filters": { - "group_based_on": frm.doc.group_based_on + "group_based_on": frm.doc.group_based_on, + "disabled": 0 } }; }); diff --git a/erpnext/education/doctype/student_group/student_group.json b/erpnext/education/doctype/student_group/student_group.json index 37a611b33d..0af156517d 100644 --- a/erpnext/education/doctype/student_group/student_group.json +++ b/erpnext/education/doctype/student_group/student_group.json @@ -293,6 +293,37 @@ "set_only_once": 0, "unique": 0 }, + { + "allow_bulk_edit": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "default": "0", + "fieldname": "disabled", + "fieldtype": "Check", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "Disabled", + "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_bulk_edit": 0, "allow_on_submit": 0, @@ -459,7 +490,7 @@ "istable": 0, "max_attachments": 0, "menu_index": 0, - "modified": "2017-11-10 19:09:37.370864", + "modified": "2018-07-26 04:17:10.836912", "modified_by": "Administrator", "module": "Education", "name": "Student Group", diff --git a/erpnext/education/report/student_and_guardian_contact_details/student_and_guardian_contact_details.py b/erpnext/education/report/student_and_guardian_contact_details/student_and_guardian_contact_details.py index 641b78372c..4d2e510601 100644 --- a/erpnext/education/report/student_and_guardian_contact_details/student_and_guardian_contact_details.py +++ b/erpnext/education/report/student_and_guardian_contact_details/student_and_guardian_contact_details.py @@ -99,7 +99,7 @@ def get_guardian_map(student_list): def get_student_roll_no(academic_year, program, batch): student_group = frappe.get_all("Student Group", - filters={"academic_year":academic_year, "program":program, "batch":batch}) + filters={"academic_year":academic_year, "program":program, "batch":batch, "disabled": 0}) if student_group: roll_no_dict = dict(frappe.db.sql('''select student, group_roll_number from `tabStudent Group Student` where parent=%s''', (student_group[0].name))) From 20d3bef3c3fa89fb34d284e8d38cb910c0b03b5d Mon Sep 17 00:00:00 2001 From: rohitwaghchaure Date: Fri, 27 Jul 2018 11:03:53 +0530 Subject: [PATCH 08/12] [Fix] Deducted tax amount adding up in the total amount in the GST Itemised Purchase Register report (#14994) --- .../item_wise_sales_register.py | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/erpnext/accounts/report/item_wise_sales_register/item_wise_sales_register.py b/erpnext/accounts/report/item_wise_sales_register/item_wise_sales_register.py index e6216b5f33..d5b708fec5 100644 --- a/erpnext/accounts/report/item_wise_sales_register/item_wise_sales_register.py +++ b/erpnext/accounts/report/item_wise_sales_register/item_wise_sales_register.py @@ -157,6 +157,9 @@ def get_delivery_notes_against_sales_order(item_list): return so_dn_map +def get_deducted_taxes(): + return frappe.db.sql_list("select name from `tabPurchase Taxes and Charges` where add_deduct_tax = 'Deduct'") + def get_tax_accounts(item_list, columns, company_currency, doctype="Sales Invoice", tax_doctype="Sales Taxes and Charges"): import json @@ -176,9 +179,10 @@ def get_tax_accounts(item_list, columns, company_currency, if doctype == "Purchase Invoice": conditions = " and category in ('Total', 'Valuation and Total') and base_tax_amount_after_discount_amount != 0" + deducted_tax = get_deducted_taxes() tax_details = frappe.db.sql(""" select - parent, description, item_wise_tax_detail, + name, parent, description, item_wise_tax_detail, charge_type, base_tax_amount_after_discount_amount from `tab%s` where @@ -190,7 +194,7 @@ def get_tax_accounts(item_list, columns, company_currency, """ % (tax_doctype, '%s', ', '.join(['%s']*len(invoice_item_row)), conditions), tuple([doctype] + invoice_item_row.keys())) - for parent, description, item_wise_tax_detail, charge_type, tax_amount in tax_details: + for name, parent, description, item_wise_tax_detail, charge_type, tax_amount in tax_details: description = handle_html(description) if description not in tax_columns and tax_amount: # as description is text editor earlier and markup can break the column convention in reports @@ -219,9 +223,13 @@ def get_tax_accounts(item_list, columns, company_currency, item_tax_amount = flt((tax_amount * d.base_net_amount) / item_net_amount) \ if item_net_amount else 0 if item_tax_amount: + tax_amount = flt(item_tax_amount, tax_amount_precision) + tax_amount = (tax_amount * -1 + if (doctype == 'Purchase Invoice' and name in deducted_tax) else tax_amount) + itemised_tax.setdefault(d.name, {})[description] = frappe._dict({ "tax_rate": tax_rate, - "tax_amount": flt(item_tax_amount, tax_amount_precision) + "tax_amount": tax_amount }) except ValueError: From cc56ff5c37664834d6769a1b22e2b669a12e0f5d Mon Sep 17 00:00:00 2001 From: Yaqin Shurrab Date: Fri, 27 Jul 2018 08:43:00 +0300 Subject: [PATCH 09/12] Get the correct Summation of Closing Balances (#14990) Fix total raw values for Closing Credit and Closing Debit --- erpnext/accounts/report/trial_balance/trial_balance.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/erpnext/accounts/report/trial_balance/trial_balance.py b/erpnext/accounts/report/trial_balance/trial_balance.py index 5df2a6505a..93ffe0279f 100644 --- a/erpnext/accounts/report/trial_balance/trial_balance.py +++ b/erpnext/accounts/report/trial_balance/trial_balance.py @@ -162,8 +162,6 @@ def calculate_values(accounts, gl_entries_by_account, opening_balances, filters, total_row["credit"] += d["credit"] total_row["opening_debit"] += d["opening_debit"] total_row["opening_credit"] += d["opening_credit"] - total_row["closing_debit"] += (d["opening_debit"] + d["debit"]) - total_row["closing_credit"] += (d["opening_credit"] + d["credit"]) return total_row @@ -176,6 +174,8 @@ def accumulate_values_into_parents(accounts, accounts_by_name): def prepare_data(accounts, filters, total_row, parent_children_map, company_currency): data = [] + total_row["closing_debit"] = total_row["closing_credit"] = 0 + for d in accounts: has_value = False row = { @@ -200,6 +200,10 @@ def prepare_data(accounts, filters, total_row, parent_children_map, company_curr row["has_value"] = has_value data.append(row) + if not d.parent_account: + total_row["closing_debit"] += (d["debit"] - d["credit"]) if (d["debit"] - d["credit"]) > 0 else 0 + total_row["closing_credit"] += abs(d["debit"] - d["credit"]) if (d["debit"] - d["credit"]) < 0 else 0 + data.extend([{},total_row]) return data From f5cc1bd44c164b8559b05b2c7d67fe5a85e2e974 Mon Sep 17 00:00:00 2001 From: "FinByz Tech Pvt. Ltd" Date: Fri, 27 Jul 2018 11:21:42 +0530 Subject: [PATCH 10/12] Created Eway Bill Report (#14926) * Created Eway Bill Report * Field value changes * Changed module from Stock to Regional * Added comments and minor fix * minor fix --- erpnext/regional/report/eway_bill/__init__.py | 0 .../regional/report/eway_bill/eway_bill.js | 33 ++ .../regional/report/eway_bill/eway_bill.json | 32 ++ .../regional/report/eway_bill/eway_bill.py | 385 ++++++++++++++++++ .../doctype/delivery_note/delivery_note.json | 214 ++++++++-- 5 files changed, 633 insertions(+), 31 deletions(-) create mode 100644 erpnext/regional/report/eway_bill/__init__.py create mode 100644 erpnext/regional/report/eway_bill/eway_bill.js create mode 100644 erpnext/regional/report/eway_bill/eway_bill.json create mode 100644 erpnext/regional/report/eway_bill/eway_bill.py diff --git a/erpnext/regional/report/eway_bill/__init__.py b/erpnext/regional/report/eway_bill/__init__.py new file mode 100644 index 0000000000..e69de29bb2 diff --git a/erpnext/regional/report/eway_bill/eway_bill.js b/erpnext/regional/report/eway_bill/eway_bill.js new file mode 100644 index 0000000000..ab0094638a --- /dev/null +++ b/erpnext/regional/report/eway_bill/eway_bill.js @@ -0,0 +1,33 @@ +// Copyright (c) 2016, FinByz Tech Pvt. Ltd. and contributors +// For license information, please see license.txt +/* eslint-disable */ + +frappe.query_reports["Eway Bill"] = { + "filters": [ + { + 'fieldname': 'delivery_note', + 'label': __("Delivery Note"), + 'fieldtype': 'Link', + 'options': 'Delivery Note' + }, + { + 'fieldname': 'posting_date', + 'label': __("Date"), + 'fieldtype': 'DateRange', + 'default': [frappe.datetime.nowdate(), frappe.datetime.nowdate()] + }, + { + 'fieldname': 'customer', + 'label': __("Customer"), + 'fieldtype': 'Link', + 'options': 'Customer' + }, + { + "fieldname":"company", + "label": __("Company"), + "fieldtype": "Link", + "options": "Company", + "default": frappe.defaults.get_user_default("Company") + }, + ] +} diff --git a/erpnext/regional/report/eway_bill/eway_bill.json b/erpnext/regional/report/eway_bill/eway_bill.json new file mode 100644 index 0000000000..41d6c9354c --- /dev/null +++ b/erpnext/regional/report/eway_bill/eway_bill.json @@ -0,0 +1,32 @@ +{ + "add_total_row": 0, + "apply_user_permissions": 1, + "creation": "2018-07-13 19:59:18.922829", + "disabled": 0, + "docstatus": 0, + "doctype": "Report", + "idx": 0, + "is_standard": "Yes", + "modified": "2018-07-19 12:08:07.400295", + "modified_by": "Administrator", + "module": "Regional", + "name": "Eway Bill", + "owner": "Administrator", + "ref_doctype": "Delivery Note", + "report_name": "Eway Bill", + "report_type": "Script Report", + "roles": [ + { + "role": "Stock User" + }, + { + "role": "Stock Manager" + }, + { + "role": "Sales User" + }, + { + "role": "Accounts User" + } + ] +} \ No newline at end of file diff --git a/erpnext/regional/report/eway_bill/eway_bill.py b/erpnext/regional/report/eway_bill/eway_bill.py new file mode 100644 index 0000000000..0ded917413 --- /dev/null +++ b/erpnext/regional/report/eway_bill/eway_bill.py @@ -0,0 +1,385 @@ +# Copyright (c) 2013, FinByz Tech Pvt. Ltd. and contributors +# For license information, please see license.txt + +from __future__ import unicode_literals +import frappe +import json +import re +from frappe import _ +from frappe.utils import nowdate + +def execute(filters=None): + if not filters: filters.setdefault('posting_date', [nowdate(), nowdate()]) + columns, data = [], [] + columns = get_columns() + data = get_data(filters) + return columns, data + +def get_data(filters): + + conditions = get_conditions(filters) + + data = frappe.db.sql(""" + SELECT + dn.name as dn_id, dn.posting_date, dn.company, dn.company_gstin, dn.customer, dn.customer_gstin, dni.item_code, dni.item_name, dni.description, dni.gst_hsn_code, dni.uom, dni.qty, dni.amount, dn.transport_mode, dn.distance, dn.transporter_name, dn.transporter, dn.lr_no, dn.lr_date, dn.vehicle_no, dn.vehicle_type, dn.company_address, dn.shipping_address_name + FROM + `tabDelivery Note` AS dn join `tabDelivery Note Item` AS dni on (dni.parent = dn.name) + WHERE + dn.docstatus < 2 + %s """ % conditions, as_dict=1) + + unit = { + 'Bag': "BAGS", + 'Bottle': "BOTTLES", + 'Kg': "KILOGRAMS", + 'Liter': "LITERS", + 'Meter': "METERS", + 'Nos': "NUMBERS", + 'PKT': "PACKS", + 'Roll': "ROLLS", + 'Set': "SETS" + } + + # Regular expression set to remove all the special characters + special_characters = "[$%^*()+\\[\]{};':\"\\|<>.?]" + + for row in data: + set_defaults(row) + set_taxes(row, filters) + set_address_details(row, special_characters) + + # Eway Bill accepts date as dd/mm/yyyy and not dd-mm-yyyy + row.posting_date = '/'.join(str(row.posting_date).replace("-", "/").split('/')[::-1]) + row.lr_date = '/'.join(str(row.lr_date).replace("-", "/").split('/')[::-1]) + + row.item_name = re.sub(special_characters, " ", row.item_name) + row.description = row.item_name + + row.uom = unit.get(row.uom, row.uom) + + # For removing special charactes and numbers from customer. + row.customer = re.sub(special_characters[:-1] + "&0-9" + "]", "", row.customer) + + return data + +def get_conditions(filters): + + conditions = "" + + conditions += filters.get('company') and " AND dn.company = '%s' " % filters.get('company') or "" + conditions += filters.get('posting_date') and " AND dn.posting_date >= '%s' AND dn.posting_date <= '%s' " % (filters.get('posting_date')[0], filters.get('posting_date')[1]) or "" + conditions += filters.get('delivery_note') and " AND dn.name = '%s' " % filters.get('delivery_note') or "" + conditions += filters.get('customer') and " AND dn.customer = '%s' " % filters.get('customer').replace("'", "\'") or "" + + return conditions + +def set_defaults(row): + row.setdefault(u'supply_type', "Outward") + row.setdefault(u'sub_type', "Supply") + row.setdefault(u'doc_type', "Delivery Challan") + +def set_address_details(row, special_characters): + + if row.get('company_address'): + address_line1, address_line2, city, pincode, state = frappe.db.get_value("Address", row.get('company_address'), ['address_line1', 'address_line2', 'city', 'pincode', 'state']) + + row.update({'from_address_1': re.sub(special_characters, "", address_line1 or '')}) + row.update({'from_address_2': re.sub(special_characters, "", address_line2 or '')}) + row.update({'from_place': city and city.upper() or ''}) + row.update({'from_pin_code': pincode and pincode.replace(" ", "") or ''}) + row.update({'from_state': state and state.upper() or ''}) + row.update({'dispatch_state': row.from_state}) + + if row.get('shipping_address_name'): + address_line1, address_line2, city, pincode, state = frappe.db.get_value("Address", row.get('shipping_address_name'), ['address_line1', 'address_line2', 'city', 'pincode', 'state']) + + row.update({'to_address_1': re.sub(special_characters, "", address_line1 or '')}) + row.update({'to_address_2': re.sub(special_characters, "", address_line2 or '')}) + row.update({'to_place': city and city.upper() or ''}) + row.update({'to_pin_code': pincode and pincode.replace(" ", "") or ''}) + row.update({'to_state': state and state.upper() or ''}) + row.update({'ship_to_state': row.to_state}) + +def set_taxes(row, filters): + taxes = frappe.get_list("Sales Taxes and Charges", + filters={ + 'parent': row.dn_id + }, + fields=('item_wise_tax_detail', 'account_head')) + + account_list = ["cgst_account", "sgst_account", "igst_account", "cess_account"] + taxes_list = frappe.get_list("GST Account", + filters={ + "parent": "GST Settings", + "company": filters.company + }, + fields=account_list) + + item_tax_rate = {} + + for tax in taxes: + item_wise_tax = json.loads(tax.item_wise_tax_detail) + item_tax_rate[tax.account_head] = item_wise_tax.get(row.item_code) + + tax_rate = [] + + tax = taxes_list[0] + for key in account_list: + if tax[key] not in item_tax_rate.keys(): + item_tax_rate[tax[key]] = [0.0, 0.0] + + tax_rate.append(str(item_tax_rate[tax[key]][0])) + row.update({key[:5] + "amount": round(item_tax_rate.get(tax[key], 0.0)[1], 2)}) + item_tax_rate.pop(tax[key]) + + row.amount = float(row.amount) + sum(i[1] for i in item_tax_rate.values()) + row.update({'tax_rate': '+'.join(tax_rate)}) + +def get_columns(): + columns = [ + { + "fieldname": "supply_type", + "label": _("Supply Type"), + "fieldtype": "Data", + "width": 100 + }, + { + "fieldname": "sub_type", + "label": _("Sub Type"), + "fieldtype": "Data", + "width": 100 + }, + { + "fieldname": "doc_type", + "label": _("Doc Type"), + "fieldtype": "Data", + "width": 100 + }, + { + "fieldname": "dn_id", + "label": _("Doc Name"), + "fieldtype": "Link", + "options": "Delivery Note", + "width": 140 + }, + { + "fieldname": "posting_date", + "label": _("Doc Date"), + "fieldtype": "Data", + "width": 100 + }, + { + "fieldname": "company", + "label": _("From Party Name"), + "fieldtype": "Link", + "options": "Company", + "width": 120 + }, + { + "fieldname": "company_gstin", + "label": _("From GSTIN"), + "fieldtype": "Data", + "width": 100 + }, + { + "fieldname": "from_address_1", + "label": _("From Address 1"), + "fieldtype": "Data", + "width": 120 + }, + { + "fieldname": "from_address_2", + "label": _("From Address 2"), + "fieldtype": "Data", + "width": 120 + }, + { + "fieldname": "from_place", + "label": _("From Place"), + "fieldtype": "Data", + "width": 80 + }, + { + "fieldname": "from_pin_code", + "label": _("From Pin Code"), + "fieldtype": "Data", + "width": 80 + }, + { + "fieldname": "from_state", + "label": _("From State"), + "fieldtype": "Data", + "width": 80 + }, + { + "fieldname": "dispatch_state", + "label": _("Dispatch State"), + "fieldtype": "Data", + "width": 100 + }, + { + "fieldname": "customer", + "label": _("To Party Name"), + "fieldtype": "Data", + "width": 120 + }, + { + "fieldname": "customer_gstin", + "label": _("To GSTIN"), + "fieldtype": "Data", + "width": 120 + }, + { + "fieldname": "to_address_1", + "label": _("To Address 1"), + "fieldtype": "Data", + "width": 120 + }, + { + "fieldname": "to_address_2", + "label": _("To Address 2"), + "fieldtype": "Data", + "width": 120 + }, + { + "fieldname": "to_place", + "label": _("To Place"), + "fieldtype": "Data", + "width": 80 + }, + { + "fieldname": "to_pin_code", + "label": _("To Pin Code"), + "fieldtype": "Data", + "width": 80 + }, + { + "fieldname": "to_state", + "label": _("To State"), + "fieldtype": "Data", + "width": 80 + }, + { + "fieldname": "ship_to_state", + "label": _("Ship To State"), + "fieldtype": "Data", + "width": 100 + }, + { + "fieldname": "item_name", + "label": _("Product"), + "fieldtype": "Link", + "options": "Item", + "width": 120 + }, + { + "fieldname": "description", + "label": _("Description"), + "fieldtype": "Data", + "width": 100 + }, + { + "fieldname": "gst_hsn_code", + "label": _("HSN"), + "fieldtype": "Data", + "width": 120 + }, + { + "fieldname": "uom", + "label": _("Unit"), + "fieldtype": "Data", + "width": 100 + }, + { + "fieldname": "qty", + "label": _("Qty"), + "fieldtype": "Float", + "width": 100 + }, + { + "fieldname": "amount", + "label": _("Accessable Value"), + "fieldtype": "Float", + "width": 120 + }, + { + "fieldname": "tax_rate", + "label": _("Tax Rate"), + "fieldtype": "Data", + "width": 100 + }, + { + "fieldname": "cgst_amount", + "label": _("CGST Amount"), + "fieldtype": "Data", + "width": 100 + }, + { + "fieldname": "sgst_amount", + "label": _("SGST Amount"), + "fieldtype": "Data", + "width": 100 + }, + { + "fieldname": "igst_amount", + "label": _("IGST Amount"), + "fieldtype": "Data", + "width": 100 + }, + { + "fieldname": "cess_amount", + "label": _("CESS Amount"), + "fieldtype": "Data", + "width": 100 + }, + { + "fieldname": "transport_mode", + "label": _("Transport Mode"), + "fieldtype": "Data", + "width": 100 + }, + { + "fieldname": "distance", + "label": _("Distance"), + "fieldtype": "Data", + "width": 100 + }, + { + "fieldname": "transporter_name", + "label": _("Transporter Name"), + "fieldtype": "Data", + "width": 120 + }, + { + "fieldname": "transporter_id", + "label": _("Transporter ID"), + "fieldtype": "Data", + "width": 100 + }, + { + "fieldname": "lr_no", + "label": _("Transporter Doc No"), + "fieldtype": "Data", + "width": 120 + }, + { + "fieldname": "lr_date", + "label": _("Transporter Date"), + "fieldtype": "Data", + "width": 120 + }, + { + "fieldname": "vehicle_no", + "label": _("Vehicle No"), + "fieldtype": "Data", + "width": 100 + }, + { + "fieldname": "vehicle_type", + "label": _("Vehicle Type"), + "fieldtype": "Data", + "width": 100 + }, + ] + + return columns \ No newline at end of file diff --git a/erpnext/stock/doctype/delivery_note/delivery_note.json b/erpnext/stock/doctype/delivery_note/delivery_note.json index 325b234267..b3729ffcfc 100644 --- a/erpnext/stock/doctype/delivery_note/delivery_note.json +++ b/erpnext/stock/doctype/delivery_note/delivery_note.json @@ -2587,6 +2587,36 @@ "set_only_once": 0, "unique": 0 }, + { + "allow_bulk_edit": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fieldname": "transporter", + "fieldtype": "Data", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "Transporter ID", + "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_bulk_edit": 0, "allow_on_submit": 0, @@ -2620,6 +2650,67 @@ "unique": 0, "width": "150px" }, + { + "allow_bulk_edit": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fieldname": "transport_mode", + "fieldtype": "Select", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "Transport Mode", + "length": 0, + "no_copy": 0, + "options": "\nRoad\nAir\nRail\nShip", + "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_bulk_edit": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fieldname": "distance", + "fieldtype": "Float", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "Distance (KM)", + "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_bulk_edit": 0, "allow_on_submit": 0, @@ -2650,6 +2741,67 @@ "unique": 0, "width": "50%" }, + { + "allow_bulk_edit": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fieldname": "vehicle_no", + "fieldtype": "Data", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "Vehicle No", + "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_bulk_edit": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fieldname": "vehicle_type", + "fieldtype": "Select", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "Vehicle Type", + "length": 0, + "no_copy": 0, + "options": "\nRegular\nODC", + "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_bulk_edit": 0, "allow_on_submit": 0, @@ -2666,7 +2818,7 @@ "in_global_search": 0, "in_list_view": 0, "in_standard_filter": 0, - "label": "Vehicle No", + "label": "Transporter Doc No", "length": 0, "no_copy": 0, "oldfieldname": "lr_no", @@ -2701,7 +2853,7 @@ "in_global_search": 0, "in_list_view": 0, "in_standard_filter": 0, - "label": "Vehicle Dispatch Date", + "label": "Transporter Date", "length": 0, "no_copy": 0, "oldfieldname": "lr_date", @@ -3157,36 +3309,36 @@ }, { "allow_bulk_edit": 0, - "allow_on_submit": 1, - "bold": 0, - "collapsible": 0, - "columns": 0, - "fieldname": "group_same_items", - "fieldtype": "Check", - "hidden": 0, - "ignore_user_permissions": 0, - "ignore_xss_filter": 0, - "in_filter": 0, - "in_global_search": 0, - "in_list_view": 0, - "in_standard_filter": 0, - "label": "Group same items", - "length": 0, - "no_copy": 0, - "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, + "allow_on_submit": 1, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fieldname": "group_same_items", + "fieldtype": "Check", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "Group same items", + "length": 0, + "no_copy": 0, + "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_bulk_edit": 0, + "allow_bulk_edit": 0, "allow_on_submit": 0, "bold": 0, "collapsible": 1, @@ -3731,7 +3883,7 @@ "istable": 0, "max_attachments": 0, "menu_index": 0, - "modified": "2018-07-06 03:03:35.035396", + "modified": "2018-07-19 11:53:03.807829", "modified_by": "Administrator", "module": "Stock", "name": "Delivery Note", From eed0a4e2dff2b8f06ce17adae905c897b6670afb Mon Sep 17 00:00:00 2001 From: Shreya Shah Date: Fri, 27 Jul 2018 11:26:35 +0530 Subject: [PATCH 11/12] Do not copy remarks field while duplicating (#15023) --- .../doctype/payment_entry/payment_entry.json | 61 +------------------ 1 file changed, 2 insertions(+), 59 deletions(-) diff --git a/erpnext/accounts/doctype/payment_entry/payment_entry.json b/erpnext/accounts/doctype/payment_entry/payment_entry.json index 9e9a4f1536..0edd602bec 100644 --- a/erpnext/accounts/doctype/payment_entry/payment_entry.json +++ b/erpnext/accounts/doctype/payment_entry/payment_entry.json @@ -40,7 +40,6 @@ "reqd": 0, "search_index": 0, "set_only_once": 0, - "translatable": 0, "unique": 0 }, { @@ -72,7 +71,6 @@ "reqd": 1, "search_index": 0, "set_only_once": 1, - "translatable": 0, "unique": 0 }, { @@ -104,7 +102,6 @@ "reqd": 1, "search_index": 0, "set_only_once": 0, - "translatable": 0, "unique": 0 }, { @@ -134,7 +131,6 @@ "reqd": 0, "search_index": 0, "set_only_once": 0, - "translatable": 0, "unique": 0 }, { @@ -166,7 +162,6 @@ "reqd": 1, "search_index": 0, "set_only_once": 0, - "translatable": 0, "unique": 0 }, { @@ -198,7 +193,6 @@ "reqd": 1, "search_index": 0, "set_only_once": 0, - "translatable": 0, "unique": 0 }, { @@ -230,7 +224,6 @@ "reqd": 0, "search_index": 0, "set_only_once": 0, - "translatable": 0, "unique": 0 }, { @@ -262,7 +255,6 @@ "reqd": 0, "search_index": 0, "set_only_once": 0, - "translatable": 0, "unique": 0 }, { @@ -296,7 +288,6 @@ "reqd": 0, "search_index": 0, "set_only_once": 0, - "translatable": 0, "unique": 0 }, { @@ -329,7 +320,6 @@ "reqd": 0, "search_index": 0, "set_only_once": 0, - "translatable": 0, "unique": 0 }, { @@ -359,7 +349,6 @@ "reqd": 0, "search_index": 0, "set_only_once": 0, - "translatable": 0, "unique": 0 }, { @@ -392,7 +381,6 @@ "reqd": 0, "search_index": 0, "set_only_once": 0, - "translatable": 0, "unique": 0 }, { @@ -423,7 +411,6 @@ "reqd": 0, "search_index": 0, "set_only_once": 0, - "translatable": 0, "unique": 0 }, { @@ -455,7 +442,6 @@ "reqd": 0, "search_index": 0, "set_only_once": 0, - "translatable": 0, "unique": 0 }, { @@ -488,7 +474,6 @@ "reqd": 1, "search_index": 0, "set_only_once": 0, - "translatable": 0, "unique": 0 }, { @@ -521,7 +506,6 @@ "reqd": 1, "search_index": 0, "set_only_once": 0, - "translatable": 0, "unique": 0 }, { @@ -554,7 +538,6 @@ "reqd": 0, "search_index": 0, "set_only_once": 0, - "translatable": 0, "unique": 0 }, { @@ -584,7 +567,6 @@ "reqd": 0, "search_index": 0, "set_only_once": 0, - "translatable": 0, "unique": 0 }, { @@ -617,7 +599,6 @@ "reqd": 1, "search_index": 0, "set_only_once": 0, - "translatable": 0, "unique": 0 }, { @@ -650,7 +631,6 @@ "reqd": 1, "search_index": 0, "set_only_once": 0, - "translatable": 0, "unique": 0 }, { @@ -683,7 +663,6 @@ "reqd": 0, "search_index": 0, "set_only_once": 0, - "translatable": 0, "unique": 0 }, { @@ -716,7 +695,6 @@ "reqd": 0, "search_index": 0, "set_only_once": 0, - "translatable": 0, "unique": 0 }, { @@ -749,7 +727,6 @@ "reqd": 1, "search_index": 0, "set_only_once": 0, - "translatable": 0, "unique": 0 }, { @@ -781,7 +758,6 @@ "reqd": 1, "search_index": 0, "set_only_once": 0, - "translatable": 0, "unique": 0 }, { @@ -814,7 +790,6 @@ "reqd": 1, "search_index": 0, "set_only_once": 0, - "translatable": 0, "unique": 0 }, { @@ -844,7 +819,6 @@ "reqd": 0, "search_index": 0, "set_only_once": 0, - "translatable": 0, "unique": 0 }, { @@ -877,7 +851,6 @@ "reqd": 1, "search_index": 0, "set_only_once": 0, - "translatable": 0, "unique": 0 }, { @@ -909,7 +882,6 @@ "reqd": 1, "search_index": 0, "set_only_once": 0, - "translatable": 0, "unique": 0 }, { @@ -942,7 +914,6 @@ "reqd": 1, "search_index": 0, "set_only_once": 0, - "translatable": 0, "unique": 0 }, { @@ -975,7 +946,6 @@ "reqd": 0, "search_index": 0, "set_only_once": 0, - "translatable": 0, "unique": 0 }, { @@ -1008,7 +978,6 @@ "reqd": 0, "search_index": 0, "set_only_once": 0, - "translatable": 0, "unique": 0 }, { @@ -1041,7 +1010,6 @@ "reqd": 0, "search_index": 0, "set_only_once": 0, - "translatable": 0, "unique": 0 }, { @@ -1073,7 +1041,6 @@ "reqd": 0, "search_index": 0, "set_only_once": 0, - "translatable": 0, "unique": 0 }, { @@ -1105,7 +1072,6 @@ "reqd": 0, "search_index": 0, "set_only_once": 0, - "translatable": 0, "unique": 0 }, { @@ -1138,7 +1104,6 @@ "reqd": 0, "search_index": 0, "set_only_once": 0, - "translatable": 0, "unique": 0 }, { @@ -1169,7 +1134,6 @@ "reqd": 0, "search_index": 0, "set_only_once": 0, - "translatable": 0, "unique": 0 }, { @@ -1199,7 +1163,6 @@ "reqd": 0, "search_index": 0, "set_only_once": 0, - "translatable": 0, "unique": 0 }, { @@ -1231,7 +1194,6 @@ "reqd": 0, "search_index": 0, "set_only_once": 0, - "translatable": 0, "unique": 0 }, { @@ -1264,7 +1226,6 @@ "reqd": 0, "search_index": 0, "set_only_once": 0, - "translatable": 0, "unique": 0 }, { @@ -1296,7 +1257,6 @@ "reqd": 0, "search_index": 0, "set_only_once": 0, - "translatable": 0, "unique": 0 }, { @@ -1329,7 +1289,6 @@ "reqd": 0, "search_index": 0, "set_only_once": 0, - "translatable": 0, "unique": 0 }, { @@ -1361,7 +1320,6 @@ "reqd": 0, "search_index": 0, "set_only_once": 0, - "translatable": 0, "unique": 0 }, { @@ -1392,7 +1350,6 @@ "reqd": 0, "search_index": 0, "set_only_once": 0, - "translatable": 0, "unique": 0 }, { @@ -1424,7 +1381,6 @@ "reqd": 0, "search_index": 0, "set_only_once": 0, - "translatable": 0, "unique": 0 }, { @@ -1454,7 +1410,6 @@ "reqd": 0, "search_index": 0, "set_only_once": 0, - "translatable": 0, "unique": 0 }, { @@ -1486,7 +1441,6 @@ "reqd": 0, "search_index": 0, "set_only_once": 0, - "translatable": 0, "unique": 0 }, { @@ -1518,7 +1472,6 @@ "reqd": 0, "search_index": 0, "set_only_once": 0, - "translatable": 0, "unique": 0 }, { @@ -1551,7 +1504,6 @@ "reqd": 0, "search_index": 0, "set_only_once": 0, - "translatable": 0, "unique": 0 }, { @@ -1584,7 +1536,6 @@ "reqd": 0, "search_index": 0, "set_only_once": 0, - "translatable": 0, "unique": 0 }, { @@ -1604,7 +1555,7 @@ "in_standard_filter": 0, "label": "Remarks", "length": 0, - "no_copy": 0, + "no_copy": 1, "permlevel": 0, "precision": "", "print_hide": 0, @@ -1615,7 +1566,6 @@ "reqd": 0, "search_index": 0, "set_only_once": 0, - "translatable": 0, "unique": 0 }, { @@ -1645,7 +1595,6 @@ "reqd": 0, "search_index": 0, "set_only_once": 0, - "translatable": 0, "unique": 0 }, { @@ -1677,7 +1626,6 @@ "reqd": 0, "search_index": 0, "set_only_once": 0, - "translatable": 0, "unique": 0 }, { @@ -1709,7 +1657,6 @@ "reqd": 0, "search_index": 0, "set_only_once": 0, - "translatable": 0, "unique": 0 }, { @@ -1740,7 +1687,6 @@ "reqd": 0, "search_index": 0, "set_only_once": 0, - "translatable": 0, "unique": 0 }, { @@ -1772,7 +1718,6 @@ "reqd": 0, "search_index": 0, "set_only_once": 0, - "translatable": 0, "unique": 0 }, { @@ -1803,7 +1748,6 @@ "reqd": 0, "search_index": 0, "set_only_once": 0, - "translatable": 0, "unique": 0 }, { @@ -1834,7 +1778,6 @@ "reqd": 0, "search_index": 0, "set_only_once": 0, - "translatable": 0, "unique": 0 } ], @@ -1848,7 +1791,7 @@ "issingle": 0, "istable": 0, "max_attachments": 0, - "modified": "2018-02-19 16:58:23.899015", + "modified": "2018-07-27 01:49:24.720317", "modified_by": "Administrator", "module": "Accounts", "name": "Payment Entry", From 584153a1b12cff3b0c73692dbca8927e2f8f5325 Mon Sep 17 00:00:00 2001 From: Nabin Hait Date: Fri, 27 Jul 2018 13:05:42 +0600 Subject: [PATCH 12/12] bumped to version 10.1.44 --- erpnext/__init__.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/erpnext/__init__.py b/erpnext/__init__.py index 475408104e..3d5ceadd1b 100644 --- a/erpnext/__init__.py +++ b/erpnext/__init__.py @@ -5,7 +5,7 @@ import frappe from erpnext.hooks import regional_overrides from frappe.utils import getdate -__version__ = '10.1.43' +__version__ = '10.1.44' def get_default_company(user=None): '''Get default company for user'''