From bb7c5ac0f8f4769f57e9e08612beca54d663dcc9 Mon Sep 17 00:00:00 2001 From: Ameya Shenoy Date: Wed, 2 May 2018 17:32:39 +0530 Subject: [PATCH 01/10] dark magic to revive travis It seems that some process inside travis is using port no 9000. Hence adding this line in the travis.yml to change common_site_config.json and use port no 9001 for socket_io --- .travis.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.travis.yml b/.travis.yml index a2c0e47349..448cd40a39 100644 --- a/.travis.yml +++ b/.travis.yml @@ -33,6 +33,7 @@ before_script: - bench reinstall --yes - bench build - bench scheduler disable + - sed -i 's/9000/9001/g' sites/common_site_config.json - bench start & - sleep 10 From ed376cacc80921505d6d7615c0b96c89569a5ed2 Mon Sep 17 00:00:00 2001 From: Nabin Hait Date: Thu, 3 May 2018 16:24:52 +0530 Subject: [PATCH 02/10] Set Qty in transactions based on serial no via Stock Settings (#13897) --- erpnext/patches.txt | 3 +- ...n_transactions_based_on_serial_no_input.py | 12 +++++++ erpnext/public/js/controllers/transaction.js | 2 +- .../setup_wizard/operations/defaults_setup.py | 1 + erpnext/stock/doctype/serial_no/serial_no.py | 2 +- .../stock_settings/stock_settings.json | 33 ++++++++++++++++++- .../doctype/stock_settings/stock_settings.py | 5 +-- 7 files changed, 52 insertions(+), 6 deletions(-) create mode 100644 erpnext/patches/v10_0/set_qty_in_transactions_based_on_serial_no_input.py diff --git a/erpnext/patches.txt b/erpnext/patches.txt index 3e035b1de1..fa25b806b5 100644 --- a/erpnext/patches.txt +++ b/erpnext/patches.txt @@ -499,4 +499,5 @@ erpnext.patches.v10_0.update_hub_connector_domain erpnext.patches.v10_0.set_student_party_type erpnext.patches.v10_0.update_project_in_sle erpnext.patches.v10_0.fix_reserved_qty_for_sub_contract -erpnext.patches.v10_0.taxes_issue_with_pos \ No newline at end of file +erpnext.patches.v10_0.taxes_issue_with_pos +erpnext.patches.v10_0.set_qty_in_transactions_based_on_serial_no_input \ No newline at end of file diff --git a/erpnext/patches/v10_0/set_qty_in_transactions_based_on_serial_no_input.py b/erpnext/patches/v10_0/set_qty_in_transactions_based_on_serial_no_input.py new file mode 100644 index 0000000000..5dbcb1d38f --- /dev/null +++ b/erpnext/patches/v10_0/set_qty_in_transactions_based_on_serial_no_input.py @@ -0,0 +1,12 @@ +# Copyright (c) 2017, Frappe and Contributors +# License: GNU General Public License v3. See license.txt + +from __future__ import unicode_literals +import frappe + +def execute(): + frappe.reload_doc("stock", "doctype", "stock_settings") + + ss = frappe.get_doc("Stock Settings") + ss.set_qty_in_transactions_based_on_serial_no_input = 1 + ss.save() \ No newline at end of file diff --git a/erpnext/public/js/controllers/transaction.js b/erpnext/public/js/controllers/transaction.js index 9ed20c9bfa..4ab413b321 100644 --- a/erpnext/public/js/controllers/transaction.js +++ b/erpnext/public/js/controllers/transaction.js @@ -401,7 +401,7 @@ erpnext.TransactionController = erpnext.taxes_and_totals.extend({ item.serial_no = valid_serial_nos.join('\n'); refresh_field("serial_no", item.name, item.parentfield); - if(!doc.is_return) { + if(!doc.is_return && cint(user_defaults.set_qty_in_transactions_based_on_serial_no_input)) { frappe.model.set_value(item.doctype, item.name, "qty", valid_serial_nos.length / item.conversion_factor); frappe.model.set_value(item.doctype, item.name, "stock_qty", valid_serial_nos.length); diff --git a/erpnext/setup/setup_wizard/operations/defaults_setup.py b/erpnext/setup/setup_wizard/operations/defaults_setup.py index b54d94e9ff..7aba807cf0 100644 --- a/erpnext/setup/setup_wizard/operations/defaults_setup.py +++ b/erpnext/setup/setup_wizard/operations/defaults_setup.py @@ -37,6 +37,7 @@ def set_default_settings(args): stock_settings.auto_indent = 1 stock_settings.auto_insert_price_list_rate_if_missing = 1 stock_settings.automatically_set_serial_nos_based_on_fifo = 1 + stock_settings.set_qty_in_transactions_based_on_serial_no_input = 1 stock_settings.save() selling_settings = frappe.get_doc("Selling Settings") diff --git a/erpnext/stock/doctype/serial_no/serial_no.py b/erpnext/stock/doctype/serial_no/serial_no.py index 233a45c64e..a8cab80cbe 100644 --- a/erpnext/stock/doctype/serial_no/serial_no.py +++ b/erpnext/stock/doctype/serial_no/serial_no.py @@ -198,7 +198,7 @@ def validate_serial_no(sle, item_det): frappe.throw(_("Serial No {0} quantity {1} cannot be a fraction").format(sle.item_code, sle.actual_qty)) if len(serial_nos) and len(serial_nos) != abs(cint(sle.actual_qty)): - frappe.throw(_("{0} Serial Numbers required for Item {1}. You have provided {2}.").format(sle.actual_qty, sle.item_code, len(serial_nos)), + frappe.throw(_("{0} Serial Numbers required for Item {1}. You have provided {2}.").format(abs(sle.actual_qty), sle.item_code, len(serial_nos)), SerialNoQtyError) if len(serial_nos) != len(set(serial_nos)): diff --git a/erpnext/stock/doctype/stock_settings/stock_settings.json b/erpnext/stock/doctype/stock_settings/stock_settings.json index 761f807a2d..11fc17413a 100644 --- a/erpnext/stock/doctype/stock_settings/stock_settings.json +++ b/erpnext/stock/doctype/stock_settings/stock_settings.json @@ -463,6 +463,37 @@ "set_only_once": 0, "unique": 0 }, + { + "allow_bulk_edit": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "default": "1", + "fieldname": "set_qty_in_transactions_based_on_serial_no_input", + "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": "Set Qty in Transactions based on Serial No Input", + "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, @@ -679,7 +710,7 @@ "issingle": 1, "istable": 0, "max_attachments": 0, - "modified": "2017-11-17 01:35:49.562613", + "modified": "2018-05-03 12:37:12.905394", "modified_by": "Administrator", "module": "Stock", "name": "Stock Settings", diff --git a/erpnext/stock/doctype/stock_settings/stock_settings.py b/erpnext/stock/doctype/stock_settings/stock_settings.py index 89ece33b08..da7c2be49b 100644 --- a/erpnext/stock/doctype/stock_settings/stock_settings.py +++ b/erpnext/stock/doctype/stock_settings/stock_settings.py @@ -11,8 +11,9 @@ from frappe.utils.html_utils import clean_html class StockSettings(Document): def validate(self): - for key in ["item_naming_by", "item_group", "stock_uom", "allow_negative_stock", "default_warehouse"]: - frappe.db.set_default(key, self.get(key, "")) + for key in ["item_naming_by", "item_group", "stock_uom", + "allow_negative_stock", "default_warehouse", "set_qty_in_transactions_based_on_serial_no_input"]: + frappe.db.set_default(key, self.get(key, "")) from erpnext.setup.doctype.naming_series.naming_series import set_by_naming_series set_by_naming_series("Item", "item_code", From ed393d10256e2c4036b61c35c0ffaa4a73734b7a Mon Sep 17 00:00:00 2001 From: Saurabh Date: Thu, 3 May 2018 18:52:25 +0530 Subject: [PATCH 03/10] [fix] consider user permissions in leave application calendar view (#13902) * [fix] consider user permissions in leave application calendar view * add hr settings to control leave calendar view * add patch --- .../hr/doctype/hr_settings/hr_settings.json | 89 ++++++++++++++++++- .../doctype/hr_settings/test_hr_settings.js | 23 +++++ .../doctype/hr_settings/test_hr_settings.py | 10 +++ .../leave_application/leave_application.py | 21 ++++- erpnext/patches.txt | 3 +- ...s_of_all_department_members_in_calendar.py | 5 ++ 6 files changed, 142 insertions(+), 9 deletions(-) create mode 100644 erpnext/hr/doctype/hr_settings/test_hr_settings.js create mode 100644 erpnext/hr/doctype/hr_settings/test_hr_settings.py create mode 100644 erpnext/patches/v10_0/show_leaves_of_all_department_members_in_calendar.py diff --git a/erpnext/hr/doctype/hr_settings/hr_settings.json b/erpnext/hr/doctype/hr_settings/hr_settings.json index 5281045098..94a0ced73f 100644 --- a/erpnext/hr/doctype/hr_settings/hr_settings.json +++ b/erpnext/hr/doctype/hr_settings/hr_settings.json @@ -1,5 +1,6 @@ { "allow_copy": 0, + "allow_guest_to_view": 0, "allow_import": 0, "allow_rename": 0, "beta": 0, @@ -11,6 +12,7 @@ "editable_grid": 1, "fields": [ { + "allow_bulk_edit": 0, "allow_on_submit": 0, "bold": 0, "collapsible": 0, @@ -21,6 +23,7 @@ "ignore_user_permissions": 0, "ignore_xss_filter": 0, "in_filter": 0, + "in_global_search": 0, "in_list_view": 0, "in_standard_filter": 0, "label": "Employee Settings", @@ -38,6 +41,7 @@ "unique": 0 }, { + "allow_bulk_edit": 0, "allow_on_submit": 0, "bold": 0, "collapsible": 0, @@ -50,6 +54,7 @@ "ignore_user_permissions": 0, "ignore_xss_filter": 0, "in_filter": 0, + "in_global_search": 0, "in_list_view": 0, "in_standard_filter": 0, "label": "Retirement Age", @@ -68,6 +73,7 @@ "unique": 0 }, { + "allow_bulk_edit": 0, "allow_on_submit": 0, "bold": 0, "collapsible": 0, @@ -80,6 +86,7 @@ "ignore_user_permissions": 0, "ignore_xss_filter": 0, "in_filter": 0, + "in_global_search": 0, "in_list_view": 0, "in_standard_filter": 0, "label": "Employee Records to be created by", @@ -98,6 +105,7 @@ "unique": 0 }, { + "allow_bulk_edit": 0, "allow_on_submit": 0, "bold": 0, "collapsible": 0, @@ -108,6 +116,7 @@ "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, @@ -125,6 +134,7 @@ "unique": 0 }, { + "allow_bulk_edit": 0, "allow_on_submit": 0, "bold": 0, "collapsible": 0, @@ -136,6 +146,7 @@ "ignore_user_permissions": 0, "ignore_xss_filter": 0, "in_filter": 0, + "in_global_search": 0, "in_list_view": 0, "in_standard_filter": 0, "label": "Stop Birthday Reminders", @@ -153,6 +164,7 @@ "unique": 0 }, { + "allow_bulk_edit": 0, "allow_on_submit": 0, "bold": 0, "collapsible": 0, @@ -163,6 +175,7 @@ "ignore_user_permissions": 0, "ignore_xss_filter": 0, "in_filter": 0, + "in_global_search": 0, "in_list_view": 0, "in_standard_filter": 0, "label": "Maintain Billing Hours and Working Hours Same on Timesheet", @@ -181,6 +194,7 @@ "unique": 0 }, { + "allow_bulk_edit": 0, "allow_on_submit": 0, "bold": 0, "collapsible": 0, @@ -191,6 +205,7 @@ "ignore_user_permissions": 0, "ignore_xss_filter": 0, "in_filter": 0, + "in_global_search": 0, "in_list_view": 0, "in_standard_filter": 0, "label": "Payroll Settings", @@ -208,6 +223,7 @@ "unique": 0 }, { + "allow_bulk_edit": 0, "allow_on_submit": 0, "bold": 0, "collapsible": 0, @@ -219,6 +235,7 @@ "ignore_user_permissions": 0, "ignore_xss_filter": 0, "in_filter": 0, + "in_global_search": 0, "in_list_view": 0, "in_standard_filter": 0, "label": "Include holidays in Total no. of Working Days", @@ -236,6 +253,7 @@ "unique": 0 }, { + "allow_bulk_edit": 0, "allow_on_submit": 0, "bold": 0, "collapsible": 0, @@ -248,6 +266,7 @@ "ignore_user_permissions": 0, "ignore_xss_filter": 0, "in_filter": 0, + "in_global_search": 0, "in_list_view": 0, "in_standard_filter": 0, "label": "Email Salary Slip to Employee", @@ -266,6 +285,7 @@ "unique": 0 }, { + "allow_bulk_edit": 0, "allow_on_submit": 0, "bold": 0, "collapsible": 0, @@ -276,6 +296,7 @@ "ignore_user_permissions": 0, "ignore_xss_filter": 0, "in_filter": 0, + "in_global_search": 0, "in_list_view": 0, "in_standard_filter": 0, "label": "Max working hours against Timesheet", @@ -292,21 +313,81 @@ "search_index": 0, "set_only_once": 0, "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fieldname": "leave_settings", + "fieldtype": "Section 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, + "label": "Leave Settings", + "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": "show_leaves_of_all_department_members_in_calendar", + "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": "Show Leaves Of All Department Members In Calendar", + "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 } ], + "has_web_view": 0, "hide_heading": 0, "hide_toolbar": 0, "icon": "fa fa-cog", "idx": 1, "image_view": 0, "in_create": 0, - "in_dialog": 0, "is_submittable": 0, "issingle": 1, "istable": 0, "max_attachments": 0, - "modified": "2017-01-16 14:01:31.183485", - "modified_by": "anastasiadis.st00@gmail.com", + "modified": "2018-05-03 15:35:13.015466", + "modified_by": "Administrator", "module": "HR", "name": "HR Settings", "owner": "Administrator", @@ -321,7 +402,6 @@ "export": 0, "if_owner": 0, "import": 0, - "is_custom": 0, "permlevel": 0, "print": 1, "read": 1, @@ -336,6 +416,7 @@ "quick_entry": 0, "read_only": 0, "read_only_onload": 0, + "show_name_in_global_search": 0, "sort_order": "ASC", "track_changes": 0, "track_seen": 0 diff --git a/erpnext/hr/doctype/hr_settings/test_hr_settings.js b/erpnext/hr/doctype/hr_settings/test_hr_settings.js new file mode 100644 index 0000000000..f32640ba5c --- /dev/null +++ b/erpnext/hr/doctype/hr_settings/test_hr_settings.js @@ -0,0 +1,23 @@ +/* eslint-disable */ +// rename this file from _test_[name] to test_[name] to activate +// and remove above this line + +QUnit.test("test: HR Settings", function (assert) { + let done = assert.async(); + + // number of asserts + assert.expect(1); + + frappe.run_serially([ + // insert a new HR Settings + () => frappe.tests.make('HR Settings', [ + // values to be set + {key: 'value'} + ]), + () => { + assert.equal(cur_frm.doc.key, 'value'); + }, + () => done() + ]); + +}); diff --git a/erpnext/hr/doctype/hr_settings/test_hr_settings.py b/erpnext/hr/doctype/hr_settings/test_hr_settings.py new file mode 100644 index 0000000000..2d5b18b6fb --- /dev/null +++ b/erpnext/hr/doctype/hr_settings/test_hr_settings.py @@ -0,0 +1,10 @@ +# -*- coding: utf-8 -*- +# Copyright (c) 2018, Frappe Technologies Pvt. Ltd. and Contributors +# See license.txt +from __future__ import unicode_literals + +import frappe +import unittest + +class TestHRSettings(unittest.TestCase): + pass diff --git a/erpnext/hr/doctype/leave_application/leave_application.py b/erpnext/hr/doctype/leave_application/leave_application.py index c0b19f14f0..8d19510624 100755 --- a/erpnext/hr/doctype/leave_application/leave_application.py +++ b/erpnext/hr/doctype/leave_application/leave_application.py @@ -436,17 +436,30 @@ def add_department_leaves(events, start, end, employee, company): and company=%s""", (department, company)) match_conditions = "and employee in (\"%s\")" % '", "'.join(department_employees) - add_leaves(events, start, end, match_conditions=match_conditions) + add_leaves(events, start, end, filter_conditions=match_conditions) + +def add_leaves(events, start, end, filter_conditions=None): + conditions = [] + + if filter_conditions: + conditions.append(filter_conditions) + + if not cint(frappe.db.get_value("HR Settings", None, "show_leaves_of_all_department_members_in_calendar")): + from frappe.desk.reportview import build_match_conditions + match_conditions = build_match_conditions("Leave Application") + + if match_conditions: + conditions.append(match_conditions) -def add_leaves(events, start, end, match_conditions=None): query = """select name, from_date, to_date, employee_name, half_day, status, employee, docstatus from `tabLeave Application` where from_date <= %(end)s and to_date >= %(start)s <= to_date and docstatus < 2 and status!="Rejected" """ - if match_conditions: - query += match_conditions + + if conditions: + query += ' and '.join(conditions) for d in frappe.db.sql(query, {"start":start, "end": end}, as_dict=True): e = { diff --git a/erpnext/patches.txt b/erpnext/patches.txt index fa25b806b5..2eb0804f2a 100644 --- a/erpnext/patches.txt +++ b/erpnext/patches.txt @@ -500,4 +500,5 @@ erpnext.patches.v10_0.set_student_party_type erpnext.patches.v10_0.update_project_in_sle erpnext.patches.v10_0.fix_reserved_qty_for_sub_contract erpnext.patches.v10_0.taxes_issue_with_pos -erpnext.patches.v10_0.set_qty_in_transactions_based_on_serial_no_input \ No newline at end of file +erpnext.patches.v10_0.set_qty_in_transactions_based_on_serial_no_input +erpnext.patches.v10_0.show_leaves_of_all_department_members_in_calendar diff --git a/erpnext/patches/v10_0/show_leaves_of_all_department_members_in_calendar.py b/erpnext/patches/v10_0/show_leaves_of_all_department_members_in_calendar.py new file mode 100644 index 0000000000..1ae8b4a54e --- /dev/null +++ b/erpnext/patches/v10_0/show_leaves_of_all_department_members_in_calendar.py @@ -0,0 +1,5 @@ +import frappe + +def execute(): + frappe.reload_doc("hr", "doctype", "hr_settings") + frappe.db.set_value("HR Settings", None, "show_leaves_of_all_department_members_in_calendar", 1) \ No newline at end of file From 62b985d405eaf6905825de680bfe2fb01a7d9237 Mon Sep 17 00:00:00 2001 From: Nabin Hait Date: Fri, 4 May 2018 12:21:00 +0530 Subject: [PATCH 04/10] [fix] Update show_in_website in template --- erpnext/stock/doctype/item/item.py | 23 ++++++++++++----------- 1 file changed, 12 insertions(+), 11 deletions(-) diff --git a/erpnext/stock/doctype/item/item.py b/erpnext/stock/doctype/item/item.py index ab99eaf55a..9b6397470e 100644 --- a/erpnext/stock/doctype/item/item.py +++ b/erpnext/stock/doctype/item/item.py @@ -604,19 +604,20 @@ class Item(WebsiteGenerator): def update_template_item(self): """Set Show in Website for Template Item if True for its Variant""" - if self.variant_of and self.show_in_website: - self.show_variant_in_website = 1 - self.show_in_website = 0 + if self.variant_of: + if self.show_in_website: + self.show_variant_in_website = 1 + self.show_in_website = 0 - if self.show_variant_in_website: - # show template - template_item = frappe.get_doc("Item", self.variant_of) + if self.show_variant_in_website: + # show template + template_item = frappe.get_doc("Item", self.variant_of) - if not template_item.show_in_website: - template_item.show_in_website = 1 - template_item.flags.dont_update_variants = True - template_item.flags.ignore_permissions = True - template_item.save() + if not template_item.show_in_website: + template_item.show_in_website = 1 + template_item.flags.dont_update_variants = True + template_item.flags.ignore_permissions = True + template_item.save() def update_variants(self): if self.flags.dont_update_variants or \ From 764b9bfeba4ce028b121fb1767f873fb168e30e0 Mon Sep 17 00:00:00 2001 From: Shreya Shah Date: Fri, 4 May 2018 17:58:36 +0530 Subject: [PATCH 05/10] cint for Item field has_variants (#13916) * convert none type value to int * Fix typo --- erpnext/stock/doctype/item/item.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/erpnext/stock/doctype/item/item.py b/erpnext/stock/doctype/item/item.py index 9b6397470e..203458e446 100644 --- a/erpnext/stock/doctype/item/item.py +++ b/erpnext/stock/doctype/item/item.py @@ -641,9 +641,9 @@ class Item(WebsiteGenerator): def validate_stock_exists_for_template_item(self): if self.stock_ledger_created() and self._doc_before_save: - if (self._doc_before_save.has_variants != self.has_variants + if (cint(self._doc_before_save.has_variants) != cint(self.has_variants) or self._doc_before_save.variant_of != self.variant_of): - frappe.throw(_("Cannot change Variant properties after stock transction. You will have to make a new Item to do this.").format(self.name), + frappe.throw(_("Cannot change Variant properties after stock transaction. You will have to make a new Item to do this.").format(self.name), StockExistsForTemplate) if self.has_variants or self.variant_of: From 55daa9cd24376c0ccd04b38b4b845c50ff7c05b0 Mon Sep 17 00:00:00 2001 From: Shreya Shah Date: Fri, 4 May 2018 18:01:23 +0530 Subject: [PATCH 06/10] fix taxable amount for same items (#13927) --- erpnext/regional/report/gstr_1/gstr_1.py | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/erpnext/regional/report/gstr_1/gstr_1.py b/erpnext/regional/report/gstr_1/gstr_1.py index 79d6e12bfb..a14500acaf 100644 --- a/erpnext/regional/report/gstr_1/gstr_1.py +++ b/erpnext/regional/report/gstr_1/gstr_1.py @@ -144,7 +144,17 @@ class Gstr1Report(object): """ % (self.doctype, ', '.join(['%s']*len(self.invoices))), tuple(self.invoices), as_dict=1) for d in items: - self.invoice_items.setdefault(d.parent, {}).setdefault(d.item_code, d.base_net_amount) + item_details = {} + item_details[d.item_code] = d.base_net_amount + + if d.parent in self.invoice_items: + parent_dict = self.invoice_items[d.parent] + if d.item_code in parent_dict: + item_details[d.item_code] += parent_dict[d.item_code] + else: + item_details.update(parent_dict) + + self.invoice_items[d.parent] = item_details def get_items_based_on_tax_rate(self): self.tax_details = frappe.db.sql(""" From bd63f0056a2344ac8ce45ced25da6262b8dbf3e6 Mon Sep 17 00:00:00 2001 From: Jamsheer Date: Fri, 4 May 2018 18:13:28 +0530 Subject: [PATCH 07/10] Patient medical record updation and deletion fixes (#13891) --- erpnext/healthcare/doctype/consultation/consultation.py | 4 +++- erpnext/healthcare/doctype/lab_test/lab_test.py | 2 +- erpnext/healthcare/doctype/vital_signs/vital_signs.py | 2 +- 3 files changed, 5 insertions(+), 3 deletions(-) diff --git a/erpnext/healthcare/doctype/consultation/consultation.py b/erpnext/healthcare/doctype/consultation/consultation.py index 69d7ecbd01..ebf80d69f4 100755 --- a/erpnext/healthcare/doctype/consultation/consultation.py +++ b/erpnext/healthcare/doctype/consultation/consultation.py @@ -113,9 +113,11 @@ def insert_consultation_to_medical_record(doc): def update_consultation_to_medical_record(consultation): medical_record_id = frappe.db.sql("select name from `tabPatient Medical Record` where reference_name=%s", (consultation.name)) - if(medical_record_id[0][0]): + if medical_record_id and medical_record_id[0][0]: subject = set_subject_field(consultation) frappe.db.set_value("Patient Medical Record", medical_record_id[0][0], "subject", subject) + else: + insert_consultation_to_medical_record(consultation) def delete_medical_record(consultation): frappe.db.sql("""delete from `tabPatient Medical Record` where reference_name = %s""", (consultation.name)) diff --git a/erpnext/healthcare/doctype/lab_test/lab_test.py b/erpnext/healthcare/doctype/lab_test/lab_test.py index 6fd9535ecc..3ad8b53a2e 100644 --- a/erpnext/healthcare/doctype/lab_test/lab_test.py +++ b/erpnext/healthcare/doctype/lab_test/lab_test.py @@ -244,7 +244,7 @@ def insert_lab_test_to_medical_record(doc): def delete_lab_test_from_medical_record(self): medical_record_id = frappe.db.sql("select name from `tabPatient Medical Record` where reference_name=%s",(self.name)) - if(medical_record_id[0][0]): + if medical_record_id and medical_record_id[0][0]: frappe.delete_doc("Patient Medical Record", medical_record_id[0][0]) def create_item_line(test_code, sales_invoice): diff --git a/erpnext/healthcare/doctype/vital_signs/vital_signs.py b/erpnext/healthcare/doctype/vital_signs/vital_signs.py index 436f79fcb9..dea848de79 100644 --- a/erpnext/healthcare/doctype/vital_signs/vital_signs.py +++ b/erpnext/healthcare/doctype/vital_signs/vital_signs.py @@ -27,7 +27,7 @@ def insert_vital_signs_to_medical_record(doc): def delete_vital_signs_from_medical_record(doc): medical_record_id = frappe.db.sql("select name from `tabPatient Medical Record` where reference_name=%s",(doc.name)) - if(medical_record_id[0][0]): + if medical_record_id and medical_record_id[0][0]: frappe.delete_doc("Patient Medical Record", medical_record_id[0][0]) def set_subject_field(doc): From 3e0a937cb8799cba2604b58267c70ff4cba2556c Mon Sep 17 00:00:00 2001 From: Rohit Waghchaure Date: Mon, 23 Apr 2018 15:46:51 +0530 Subject: [PATCH 08/10] [Fix] Tax not changes when user change the POS profile in the sales invoice --- erpnext/accounts/doctype/sales_invoice/sales_invoice.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/erpnext/accounts/doctype/sales_invoice/sales_invoice.py b/erpnext/accounts/doctype/sales_invoice/sales_invoice.py index b174d9b224..d8220528d4 100644 --- a/erpnext/accounts/doctype/sales_invoice/sales_invoice.py +++ b/erpnext/accounts/doctype/sales_invoice/sales_invoice.py @@ -344,8 +344,8 @@ class SalesInvoice(SellingController): self.terms = frappe.db.get_value("Terms and Conditions", self.tc_name, "terms") # fetch charges - if self.taxes_and_charges and not len(self.get("taxes")): - self.set_taxes() + if self.taxes_and_charges: + self.set_other_charges() return pos From 47c0c8ba4937ec10bafc939a3565a6494c425c25 Mon Sep 17 00:00:00 2001 From: Ameya Shenoy Date: Mon, 30 Apr 2018 11:17:12 +0530 Subject: [PATCH 09/10] removed bad code and made compatible with pip 10 (#13805) --- setup.py | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/setup.py b/setup.py index c293fb82d0..71107a9a2f 100644 --- a/setup.py +++ b/setup.py @@ -1,20 +1,17 @@ # -*- coding: utf-8 -*- from setuptools import setup, find_packages -try: # for pip >= 10 - from pip._internal.req import parse_requirements -except ImportError: # for pip <= 9.0.3 - from pip.req import parse_requirements import re, ast # get version from __version__ variable in erpnext/__init__.py _version_re = re.compile(r'__version__\s+=\s+(.*)') +with open('requirements.txt') as f: + install_requires = f.read().strip().split('\n') + with open('erpnext/__init__.py', 'rb') as f: version = str(ast.literal_eval(_version_re.search( f.read().decode('utf-8')).group(1))) -requirements = parse_requirements("requirements.txt", session="") - setup( name='erpnext', version=version, @@ -24,6 +21,5 @@ setup( packages=find_packages(), zip_safe=False, include_package_data=True, - install_requires=[str(ir.req) for ir in requirements], - dependency_links=[str(ir._link) for ir in requirements if ir._link] + install_requires=install_requires ) From 723fe8fb1bd6a03b424237935d25f1e48eb56db8 Mon Sep 17 00:00:00 2001 From: Nabin Hait Date: Sat, 5 May 2018 12:43:29 +0600 Subject: [PATCH 10/10] bumped to version 10.1.29 --- erpnext/__init__.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/erpnext/__init__.py b/erpnext/__init__.py index 540e223376..ea1a4023e5 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.28' +__version__ = '10.1.29' def get_default_company(user=None): '''Get default company for user'''