From 6b89644ca71f47ba7ed820e4bac72793a1049230 Mon Sep 17 00:00:00 2001 From: Nabin Hait Date: Tue, 9 Jan 2018 15:39:35 +0530 Subject: [PATCH 01/15] Payment terms filter in AR report --- .../report/accounts_receivable/accounts_receivable.js | 8 ++++---- .../report/accounts_receivable/accounts_receivable.py | 6 +++--- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/erpnext/accounts/report/accounts_receivable/accounts_receivable.js b/erpnext/accounts/report/accounts_receivable/accounts_receivable.js index 55d863928f..fd5241b1ff 100644 --- a/erpnext/accounts/report/accounts_receivable/accounts_receivable.js +++ b/erpnext/accounts/report/accounts_receivable/accounts_receivable.js @@ -23,10 +23,10 @@ frappe.query_reports["Accounts Receivable"] = { "options": "Customer Group" }, { - "fieldname":"credit_days_based_on", - "label": __("Credit Days Based On"), - "fieldtype": "Select", - "options": "\nFixed Days\nLast Day of the Next Month" + "fieldname":"payment_terms_template", + "label": __("Payment Terms Template"), + "fieldtype": "Link", + "options": "Payment Terms Template" }, { "fieldtype": "Break", diff --git a/erpnext/accounts/report/accounts_receivable/accounts_receivable.py b/erpnext/accounts/report/accounts_receivable/accounts_receivable.py index 522abe85b4..0732b7dc09 100644 --- a/erpnext/accounts/report/accounts_receivable/accounts_receivable.py +++ b/erpnext/accounts/report/accounts_receivable/accounts_receivable.py @@ -283,9 +283,9 @@ class ReceivablePayableReport(object): where exists(select name from `tabCustomer Group` where lft >= {0} and rgt <= {1} and name=tabCustomer.customer_group))""".format(lft, rgt)) - if self.filters.get("credit_days_based_on"): - conditions.append("party in (select name from tabCustomer where credit_days_based_on=%s)") - values.append(self.filters.get("credit_days_based_on")) + if self.filters.get("payment_terms_template"): + conditions.append("party in (select name from tabCustomer where payment_terms=%s)") + values.append(self.filters.get("payment_terms_template")) return " and ".join(conditions), values From 527e6c02b34a30bf0528e2a0050ca924b865abfe Mon Sep 17 00:00:00 2001 From: Nabin Hait Date: Tue, 9 Jan 2018 16:29:13 +0530 Subject: [PATCH 02/15] Delete BOMs on deletion of company --- erpnext/setup/doctype/company/company.py | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/erpnext/setup/doctype/company/company.py b/erpnext/setup/doctype/company/company.py index a36810f6fe..d7d23b3ace 100644 --- a/erpnext/setup/doctype/company/company.py +++ b/erpnext/setup/doctype/company/company.py @@ -281,6 +281,12 @@ class Company(Document): # delete mode of payment account frappe.db.sql("delete from `tabMode of Payment Account` where company=%s", self.name) + # delete BOMs + boms = frappe.db.sql_list("select name from tabBOM where company=%s", self.name) + frappe.db.sql("delete from tabBOM where company=%s", self.name) + for dt in ("BOM Operation", "BOM Item", "BOM Scrap Item", "BOM Explosion Item"): + frappe.db.sql("delete from `tab%s` where parent in (%s)""" + % (dt, ', '.join(['%s']*len(boms))), tuple(boms)) @frappe.whitelist() def enqueue_replace_abbr(company, old, new): From 6f75885d860c580bb4d39f5eb3c8661a5c3cf2b2 Mon Sep 17 00:00:00 2001 From: tundebabzy Date: Wed, 10 Jan 2018 23:05:51 +0100 Subject: [PATCH 03/15] better validation message --- erpnext/stock/doctype/packing_slip/packing_slip.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/erpnext/stock/doctype/packing_slip/packing_slip.js b/erpnext/stock/doctype/packing_slip/packing_slip.js index 69d12eb2d9..9f6b9ff191 100644 --- a/erpnext/stock/doctype/packing_slip/packing_slip.js +++ b/erpnext/stock/doctype/packing_slip/packing_slip.js @@ -48,7 +48,7 @@ cur_frm.cscript.validate = function(doc, cdt, cdn) { cur_frm.cscript.validate_case_nos = function(doc) { doc = locals[doc.doctype][doc.name]; if(cint(doc.from_case_no)==0) { - frappe.msgprint(__("Case No. cannot be 0")) + frappe.msgprint(__("The 'From Package No.' field must neither be empty nor it's value less than 1.")); frappe.validated = false; } else if(!cint(doc.to_case_no)) { doc.to_case_no = doc.from_case_no; @@ -124,3 +124,5 @@ cur_frm.pformat.net_weight_pkg= function(doc){ cur_frm.pformat.gross_weight_pkg= function(doc){ return '' + make_row('Gross Weight', doc.gross_weight_pkg) + '
' } + +// TODO: validate gross weight field \ No newline at end of file From 752d21e65802dc8c46ec2047d04582e7f1bfdfe4 Mon Sep 17 00:00:00 2001 From: rohitwaghchaure Date: Thu, 11 Jan 2018 12:28:48 +0530 Subject: [PATCH 04/15] Code cleanup for item price stock report and fix report was not exporting properly in excel (#12427) --- .../item_price_stock/item_price_stock.py | 94 ++++++++++++++----- 1 file changed, 72 insertions(+), 22 deletions(-) diff --git a/erpnext/stock/report/item_price_stock/item_price_stock.py b/erpnext/stock/report/item_price_stock/item_price_stock.py index 4cd8fddccd..9ee7d05d35 100644 --- a/erpnext/stock/report/item_price_stock/item_price_stock.py +++ b/erpnext/stock/report/item_price_stock/item_price_stock.py @@ -12,13 +12,52 @@ def execute(filters=None): def get_columns(): return [ - _("Item Name") + ":Link/Item:150", - _("Warehouse") + ":Link/Warehouse:130", - _("Stock Available") + ":Float:120", - _("Buying Price List") + ":Data:130", - _("Buying Rate") + ":Currency:110", - _("Selling Price List") + ":Data:130", - _("Selling Rate") + ":Currency:110" + { + "label": _("Item Name"), + "fieldname": "item_name", + "fieldtype": "Link", + "options": "Item", + "width": 120 + }, + { + "label": _("Warehouse"), + "fieldname": "warehouse", + "fieldtype": "Link", + "options": "Warehouse", + "width": 120 + }, + { + "label": _("Stock Available"), + "fieldname": "stock_available", + "fieldtype": "Float", + "width": 120 + }, + { + "label": _("Buying Price List"), + "fieldname": "buying_price_list", + "fieldtype": "Link", + "options": "Price List", + "width": 120 + }, + { + "label": _("Buying Rate"), + "fieldname": "buying_rate", + "fieldtype": "Currency", + "width": 120 + }, + { + "label": _("Selling Price List"), + "fieldname": "selling_price_list", + "fieldtype": "Link", + "options": "Price List", + "width": 120 + }, + { + "label": _("Selling Rate"), + "fieldname": "selling_rate", + "fieldtype": "Currency", + "width": 120 + } ] def get_data(filters, columns): @@ -32,8 +71,8 @@ def get_item_price_qty_data(filters): if filters.get("item_code"): conditions += "where a.item_code=%(item_code)s" - item_results = frappe.db.sql("""select a.item_code as name,a.name as price_list_name, - b.warehouse as warehouse,b.actual_qty as actual_qty + item_results = frappe.db.sql("""select a.item_code as item_name, a.name as price_list_name, + b.warehouse as warehouse, b.actual_qty as actual_qty from `tabItem Price` a left join `tabBin` b ON a.item_code = b.item_code {conditions}""" @@ -45,19 +84,30 @@ def get_item_price_qty_data(filters): buying_price_map = get_buying_price_map(price_list_names) selling_price_map = get_selling_price_map(price_list_names) - item_dicts = [{"Item Name": d['name'],"Item Price List": d['price_list_name'],"Warehouse": d['warehouse'], - "Stock Available": d['actual_qty']} for d in item_results] - for item_dict in item_dicts: - price_list = item_dict["Item Price List"] - item_dict["Warehouse"] = item_dict["Warehouse"] or "" - item_dict["Stock Available"] = item_dict["Stock Available"] or 0 - if buying_price_map.get(price_list): - item_dict["Buying Price List"] = buying_price_map.get(price_list)["Buying Price List"] or "" - item_dict["Buying Rate"] = buying_price_map.get(price_list)["Buying Rate"] or 0 - if selling_price_map.get(price_list): - item_dict["Selling Price List"] = selling_price_map.get(price_list)["Selling Price List"] or "" - item_dict["Selling Rate"] = selling_price_map.get(price_list)["Selling Rate"] or 0 - return item_dicts + result = [] + if item_results: + for item_dict in item_results: + data = { + 'item_name': item_dict.item_name, + 'warehouse': item_dict.warehouse, + 'stock_available': item_dict.actual_qty or 0, + 'buying_price_list': "", + 'buying_rate': 0.0, + 'selling_price_list': "", + 'selling_rate': 0.0 + } + + price_list = item_dict["price_list_name"] + if buying_price_map.get(price_list): + data["buying_price_list"] = buying_price_map.get(price_list)["Buying Price List"] or "" + data["buying_rate"] = buying_price_map.get(price_list)["Buying Rate"] or 0 + if selling_price_map.get(price_list): + data["selling_price_list"] = selling_price_map.get(price_list)["Selling Price List"] or "" + data["selling_rate"] = selling_price_map.get(price_list)["Selling Rate"] or 0 + + result.append(data) + + return result def get_buying_price_map(price_list_names): buying_price = frappe.db.sql(""" From 20dead5d910e13a7a1d6d7156b5abe23bc0bd725 Mon Sep 17 00:00:00 2001 From: rohitwaghchaure Date: Thu, 11 Jan 2018 12:31:14 +0530 Subject: [PATCH 05/15] [minor] UI change (#12440) * [minor] UI change * Update company.js --- erpnext/setup/doctype/company/company.js | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/erpnext/setup/doctype/company/company.js b/erpnext/setup/doctype/company/company.js index 29077dce20..95e3482d39 100644 --- a/erpnext/setup/doctype/company/company.js +++ b/erpnext/setup/doctype/company/company.js @@ -32,6 +32,10 @@ frappe.ui.form.on("Company", { frm.toggle_enable("default_currency", (frm.doc.__onload && !frm.doc.__onload.transactions_exist)); + frm.add_custom_button(__('Make Tax Template'), function() { + frm.trigger("make_default_tax_template"); + }); + frm.add_custom_button(__('Cost Centers'), function() { frappe.set_route('Tree', 'Cost Center', {'company': frm.doc.name}) }, __("View")); @@ -47,13 +51,6 @@ frappe.ui.form.on("Company", { frm.add_custom_button(__('Purchase Tax Template'), function() { frappe.set_route('List', 'Purchase Taxes and Charges Template', {'company': frm.doc.name}); }, __("View")); - - frm.add_custom_button(__('Default Tax Template'), function() { - frm.trigger("make_default_tax_template"); - }, __("Make")); - - frm.page.set_inner_btn_group_as_primary(__("View")); - frm.page.set_inner_btn_group_as_primary(__("Make")); } erpnext.company.set_chart_of_accounts_options(frm.doc); From 5b45bcf5f35a3bf23c2f29e922a69c681484cab4 Mon Sep 17 00:00:00 2001 From: rohitwaghchaure Date: Thu, 11 Jan 2018 12:39:09 +0530 Subject: [PATCH 06/15] [Fix] Report Available Stock for Packing Items Menu not working (#12400) --- .../available_stock_for_packing_items.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/erpnext/selling/report/available_stock_for_packing_items/available_stock_for_packing_items.py b/erpnext/selling/report/available_stock_for_packing_items/available_stock_for_packing_items.py index 40ed20c93d..1e45a73673 100644 --- a/erpnext/selling/report/available_stock_for_packing_items/available_stock_for_packing_items.py +++ b/erpnext/selling/report/available_stock_for_packing_items/available_stock_for_packing_items.py @@ -41,8 +41,9 @@ def get_columns(): def get_product_bundle_items(): sbom_item_map = {} - for sbom in frappe.db.sql("""select parent, item_code, qty from `tabProduct Bundle Item` - where docstatus < 2""", as_dict=1): + for sbom in frappe.db.sql("""select pb.new_item_code as parent, pbi.item_code, pbi.qty + from `tabProduct Bundle Item` as pbi, `tabProduct Bundle` as pb + where pb.docstatus < 2 and pb.name = pbi.parent""", as_dict=1): sbom_item_map.setdefault(sbom.parent, {}).setdefault(sbom.item_code, sbom.qty) return sbom_item_map From 02302ff0092543c542ee6deee11d15f0b268651a Mon Sep 17 00:00:00 2001 From: rohitwaghchaure Date: Thu, 11 Jan 2018 12:58:46 +0530 Subject: [PATCH 07/15] [Fix] Incoming rate for gross profit report (#12422) --- erpnext/accounts/report/gross_profit/gross_profit.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/erpnext/accounts/report/gross_profit/gross_profit.py b/erpnext/accounts/report/gross_profit/gross_profit.py index 78e3faab4e..2bd5cc5577 100644 --- a/erpnext/accounts/report/gross_profit/gross_profit.py +++ b/erpnext/accounts/report/gross_profit/gross_profit.py @@ -255,10 +255,12 @@ class GrossProfitGenerator(object): from `tabPurchase Invoice Item` where item_code = %s and docstatus=1""", item_code)[0][0]) else: + row.voucher_type = row.parenttype + row.voucher_no = row.parent average_buying_rate = get_incoming_rate(row) if not average_buying_rate: average_buying_rate = get_valuation_rate(item_code, row.warehouse, - row.parenttype, row.parent, allow_zero_rate=True, + row.parenttype, row.parent, allow_zero_rate=row.allow_zero_valuation, currency=self.filters.currency, company=self.filters.company) self.average_buying_rate[item_code] = flt(average_buying_rate) @@ -309,7 +311,8 @@ class GrossProfitGenerator(object): `tabSales Invoice Item`.brand, `tabSales Invoice Item`.dn_detail, `tabSales Invoice Item`.delivery_note, `tabSales Invoice Item`.stock_qty as qty, `tabSales Invoice Item`.base_net_rate, `tabSales Invoice Item`.base_net_amount, - `tabSales Invoice Item`.name as "item_row", `tabSales Invoice`.is_return + `tabSales Invoice Item`.name as "item_row", `tabSales Invoice`.is_return, + `tabSales Invoice Item`.allow_zero_valuation_rate as "allow_zero_valuation" {sales_person_cols} from `tabSales Invoice` inner join `tabSales Invoice Item` From 3955fa5102313a904c6189a436aa5e0e09b64c3b Mon Sep 17 00:00:00 2001 From: rohitwaghchaure Date: Thu, 11 Jan 2018 18:21:02 +0530 Subject: [PATCH 08/15] [Fix] Email addres unique key issue (#12450) --- erpnext/selling/doctype/customer/customer.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/erpnext/selling/doctype/customer/customer.py b/erpnext/selling/doctype/customer/customer.py index 9c2545b39c..6c9e4501f8 100644 --- a/erpnext/selling/doctype/customer/customer.py +++ b/erpnext/selling/doctype/customer/customer.py @@ -66,7 +66,7 @@ class Customer(TransactionBase): self.create_lead_address_contact() def create_primary_contact(self): - if not self.customer_primary_contact: + if not self.customer_primary_contact and not self.lead_name: if self.mobile_no or self.email_id: contact = make_contact(self) self.db_set('customer_primary_contact', contact.name) From 6c3082591c3f7d772f0d31580f21226efdfce1a2 Mon Sep 17 00:00:00 2001 From: Manas Solanki Date: Fri, 12 Jan 2018 12:00:13 +0530 Subject: [PATCH 09/15] change the resolution field to the text editor (#12449) --- erpnext/support/doctype/issue/issue.json | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/erpnext/support/doctype/issue/issue.json b/erpnext/support/doctype/issue/issue.json index 137b0886e4..1c4639b4b3 100644 --- a/erpnext/support/doctype/issue/issue.json +++ b/erpnext/support/doctype/issue/issue.json @@ -659,7 +659,7 @@ "columns": 0, "depends_on": "eval:!doc.__islocal", "fieldname": "resolution_details", - "fieldtype": "Small Text", + "fieldtype": "Text Editor", "hidden": 0, "ignore_user_permissions": 0, "ignore_xss_filter": 0, @@ -879,7 +879,7 @@ "issingle": 0, "istable": 0, "max_attachments": 0, - "modified": "2017-11-15 17:15:40.347362", + "modified": "2018-01-11 07:10:53.707415", "modified_by": "Administrator", "module": "Support", "name": "Issue", From c9172e0079441f174c67671a1dea355a2d73626b Mon Sep 17 00:00:00 2001 From: Zlash65 Date: Fri, 12 Jan 2018 15:04:42 +0530 Subject: [PATCH 10/15] delete boms only when found --- erpnext/setup/doctype/company/company.py | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/erpnext/setup/doctype/company/company.py b/erpnext/setup/doctype/company/company.py index d7d23b3ace..81b94bd91f 100644 --- a/erpnext/setup/doctype/company/company.py +++ b/erpnext/setup/doctype/company/company.py @@ -283,10 +283,11 @@ class Company(Document): # delete BOMs boms = frappe.db.sql_list("select name from tabBOM where company=%s", self.name) - frappe.db.sql("delete from tabBOM where company=%s", self.name) - for dt in ("BOM Operation", "BOM Item", "BOM Scrap Item", "BOM Explosion Item"): - frappe.db.sql("delete from `tab%s` where parent in (%s)""" - % (dt, ', '.join(['%s']*len(boms))), tuple(boms)) + if boms: + frappe.db.sql("delete from tabBOM where company=%s", self.name) + for dt in ("BOM Operation", "BOM Item", "BOM Scrap Item", "BOM Explosion Item"): + frappe.db.sql("delete from `tab%s` where parent in (%s)""" + % (dt, ', '.join(['%s']*len(boms))), tuple(boms), debug=1) @frappe.whitelist() def enqueue_replace_abbr(company, old, new): From bba5fd7a389d1e2ae0c2855831e7062daf8a781e Mon Sep 17 00:00:00 2001 From: Manas Solanki Date: Fri, 12 Jan 2018 16:21:09 +0530 Subject: [PATCH 11/15] Assessment module addition (#12417) * add academic session details in the Assessmet Plan * add the academic session and few details in the assessment result * fix codacy --- .../assessment_plan/assessment_plan.js | 57 ++-- .../assessment_plan/assessment_plan.json | 192 +++++++++---- .../assessment_plan/assessment_plan.py | 12 + .../assessment_result/assessment_result.js | 26 +- .../assessment_result/assessment_result.json | 262 +++++++++++++++--- .../assessment_result/assessment_result.py | 18 +- .../program_enrollment_tool.py | 1 + erpnext/patches.txt | 4 +- .../patches/v10_0/update_assessment_plan.py | 17 ++ .../patches/v10_0/update_assessment_result.py | 20 ++ 10 files changed, 488 insertions(+), 121 deletions(-) create mode 100644 erpnext/patches/v10_0/update_assessment_plan.py create mode 100644 erpnext/patches/v10_0/update_assessment_result.py diff --git a/erpnext/education/doctype/assessment_plan/assessment_plan.js b/erpnext/education/doctype/assessment_plan/assessment_plan.js index f6fceb1563..0f59f99657 100644 --- a/erpnext/education/doctype/assessment_plan/assessment_plan.js +++ b/erpnext/education/doctype/assessment_plan/assessment_plan.js @@ -1,41 +1,46 @@ // Copyright (c) 2016, Frappe Technologies Pvt. Ltd. and contributors // For license information, please see license.txt -cur_frm.add_fetch("student_group", "course", "course"); -cur_frm.add_fetch("examiner", "instructor_name", "examiner_name"); -cur_frm.add_fetch("supervisor", "instructor_name", "supervisor_name"); -cur_frm.add_fetch("course", "default_grading_scale", "grading_scale"); frappe.ui.form.on("Assessment Plan", { - onload: function(frm) { - frm.set_query("assessment_group", function(doc, cdt, cdn) { - return{ - filters: { - 'is_group': 0 - } - } - }); - }, - - refresh: function(frm) { - if (frm.doc.docstatus == 1) { - frm.add_custom_button(__("Assessment Result"), function() { - frappe.route_options = { - assessment_plan: frm.doc.name, - student_group: frm.doc.student_group - } - frappe.set_route("Form", "Assessment Result Tool"); - }); - } + setup: function(frm) { + frm.add_fetch("student_group", "course", "course"); + frm.add_fetch("student_group", "program", "program"); + frm.add_fetch("student_group", "academic_year", "academic_year"); + frm.add_fetch("student_group", "academic_term", "academic_term"); + frm.add_fetch("examiner", "instructor_name", "examiner_name"); + frm.add_fetch("supervisor", "instructor_name", "supervisor_name"); + frm.add_fetch("course", "default_grading_scale", "grading_scale"); + }, + onload: function(frm) { + frm.set_query("assessment_group", function(doc, cdt, cdn) { + return{ + filters: { + 'is_group': 0 + } + }; + }); frm.set_query('grading_scale', function(){ return { filters: { docstatus: 1 } - } + }; }); - }, + }, + + refresh: function(frm) { + if (frm.doc.docstatus == 1) { + frm.add_custom_button(__("Assessment Result"), function() { + frappe.route_options = { + assessment_plan: frm.doc.name, + student_group: frm.doc.student_group + } + frappe.set_route("Form", "Assessment Result Tool"); + }); + } + }, course: function(frm) { if (frm.doc.course && frm.doc.maximum_assessment_score) { diff --git a/erpnext/education/doctype/assessment_plan/assessment_plan.json b/erpnext/education/doctype/assessment_plan/assessment_plan.json index e2ae247e7c..eccc966276 100644 --- a/erpnext/education/doctype/assessment_plan/assessment_plan.json +++ b/erpnext/education/doctype/assessment_plan/assessment_plan.json @@ -13,36 +13,6 @@ "editable_grid": 0, "engine": "InnoDB", "fields": [ - { - "allow_bulk_edit": 0, - "allow_on_submit": 0, - "bold": 0, - "collapsible": 0, - "columns": 0, - "fieldname": "assessment_name", - "fieldtype": "Data", - "hidden": 0, - "ignore_user_permissions": 0, - "ignore_xss_filter": 0, - "in_filter": 0, - "in_global_search": 1, - "in_list_view": 0, - "in_standard_filter": 0, - "label": "Assessment Name", - "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, @@ -80,19 +50,80 @@ "bold": 0, "collapsible": 0, "columns": 0, - "fieldname": "course", - "fieldtype": "Link", + "fieldname": "assessment_name", + "fieldtype": "Data", "hidden": 0, "ignore_user_permissions": 0, "ignore_xss_filter": 0, "in_filter": 0, "in_global_search": 1, "in_list_view": 0, - "in_standard_filter": 1, - "label": "Course", + "in_standard_filter": 0, + "label": "Assessment Name", "length": 0, "no_copy": 0, - "options": "Course", + "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": "assessment_group", + "fieldtype": "Link", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 1, + "label": "Assessment Group", + "length": 0, + "no_copy": 0, + "options": "Assessment Group", + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 1, + "search_index": 0, + "set_only_once": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fieldname": "grading_scale", + "fieldtype": "Link", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 1, + "label": "Grading Scale", + "length": 0, + "no_copy": 0, + "options": "Grading Scale", "permlevel": 0, "precision": "", "print_hide": 0, @@ -140,19 +171,50 @@ "bold": 0, "collapsible": 0, "columns": 0, - "fieldname": "assessment_group", + "fieldname": "course", "fieldtype": "Link", "hidden": 0, "ignore_user_permissions": 0, "ignore_xss_filter": 0, "in_filter": 0, - "in_global_search": 0, + "in_global_search": 1, "in_list_view": 0, "in_standard_filter": 1, - "label": "Assessment Group", + "label": "Course", "length": 0, "no_copy": 0, - "options": "Assessment Group", + "options": "Course", + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 1, + "search_index": 0, + "set_only_once": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fieldname": "program", + "fieldtype": "Link", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 1, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "Program", + "length": 0, + "no_copy": 0, + "options": "Program", "permlevel": 0, "precision": "", "print_hide": 0, @@ -171,8 +233,8 @@ "bold": 0, "collapsible": 0, "columns": 0, - "fieldname": "maximum_assessment_score", - "fieldtype": "Float", + "fieldname": "academic_year", + "fieldtype": "Link", "hidden": 0, "ignore_user_permissions": 0, "ignore_xss_filter": 0, @@ -180,9 +242,10 @@ "in_global_search": 0, "in_list_view": 0, "in_standard_filter": 0, - "label": "Maximum Assessment Score", + "label": "Academic Year", "length": 0, "no_copy": 0, + "options": "Academic Year", "permlevel": 0, "precision": "", "print_hide": 0, @@ -190,7 +253,7 @@ "read_only": 0, "remember_last_selected_value": 0, "report_hide": 0, - "reqd": 1, + "reqd": 0, "search_index": 0, "set_only_once": 0, "unique": 0 @@ -201,7 +264,7 @@ "bold": 0, "collapsible": 0, "columns": 0, - "fieldname": "grading_scale", + "fieldname": "academic_term", "fieldtype": "Link", "hidden": 0, "ignore_user_permissions": 0, @@ -209,11 +272,11 @@ "in_filter": 0, "in_global_search": 0, "in_list_view": 0, - "in_standard_filter": 1, - "label": "Grading Scale", + "in_standard_filter": 0, + "label": "Academic Term", "length": 0, "no_copy": 0, - "options": "Grading Scale", + "options": "Academic Term", "permlevel": 0, "precision": "", "print_hide": 0, @@ -221,7 +284,7 @@ "read_only": 0, "remember_last_selected_value": 0, "report_hide": 0, - "reqd": 1, + "reqd": 0, "search_index": 0, "set_only_once": 0, "unique": 0 @@ -546,6 +609,7 @@ "in_global_search": 0, "in_list_view": 0, "in_standard_filter": 0, + "label": "Evaluate", "length": 0, "no_copy": 0, "permlevel": 0, @@ -560,6 +624,36 @@ "set_only_once": 0, "unique": 0 }, + { + "allow_bulk_edit": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fieldname": "maximum_assessment_score", + "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": "Maximum Assessment Score", + "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": 1, + "search_index": 0, + "set_only_once": 0, + "unique": 0 + }, { "allow_bulk_edit": 0, "allow_on_submit": 0, @@ -633,7 +727,7 @@ "istable": 0, "max_attachments": 0, "menu_index": 0, - "modified": "2017-11-28 17:23:36.657725", + "modified": "2018-01-08 17:53:39.340356", "modified_by": "Administrator", "module": "Education", "name": "Assessment Plan", diff --git a/erpnext/education/doctype/assessment_plan/assessment_plan.py b/erpnext/education/doctype/assessment_plan/assessment_plan.py index 7ad76b8731..d88c87764d 100644 --- a/erpnext/education/doctype/assessment_plan/assessment_plan.py +++ b/erpnext/education/doctype/assessment_plan/assessment_plan.py @@ -9,10 +9,22 @@ from frappe import _ class AssessmentPlan(Document): def validate(self): + self.set_missing_field() self.validate_overlap() self.validate_max_score() self.validate_assessment_criteria() + def set_missing_field(self): + if self.student_group: + academic_term, academic_year, program, course = frappe.get_value("Student Group", self.student_group, + ["academic_term", "academic_year", "program", "course"]) + self.academic_term = academic_term + self.academic_year = academic_year + if program: + self.program = program + if course and not self.course: #pylint: disable=E0203 + self.course = course + def validate_overlap(self): """Validates overlap for Student Group, Instructor, Room""" diff --git a/erpnext/education/doctype/assessment_result/assessment_result.js b/erpnext/education/doctype/assessment_result/assessment_result.js index d1115a7da6..cf176aa520 100644 --- a/erpnext/education/doctype/assessment_result/assessment_result.js +++ b/erpnext/education/doctype/assessment_result/assessment_result.js @@ -1,11 +1,29 @@ // Copyright (c) 2016, Frappe Technologies Pvt. Ltd. and contributors // For license information, please see license.txt -cur_frm.add_fetch("student", "title", "student_name"); -cur_frm.add_fetch("assessment_plan", "grading_scale", "grading_scale"); -cur_frm.add_fetch("assessment_plan", "maximum_assessment_score", "maximum_score"); - frappe.ui.form.on("Assessment Result", { + setup: function(frm) { + frm.add_fetch("student", "title", "student_name"); + frm.add_fetch("assessment_plan", "course", "course"); + frm.add_fetch("assessment_plan", "program", "program"); + frm.add_fetch("assessment_plan", "academic_year", "academic_year"); + frm.add_fetch("assessment_plan", "academic_term", "academic_term"); + frm.add_fetch("assessment_plan", "grading_scale", "grading_scale"); + frm.add_fetch("assessment_plan", "student_group", "student_group"); + frm.add_fetch("assessment_plan", "assessment_group", "assessment_group"); + frm.add_fetch("assessment_plan", "maximum_assessment_score", "maximum_score"); + }, + + onload: function(frm) { + frm.set_query('assessment_plan', function(){ + return { + filters: { + docstatus: 1 + } + }; + }); + }, + assessment_plan: function(frm) { if (frm.doc.assessment_plan) { frappe.call({ diff --git a/erpnext/education/doctype/assessment_result/assessment_result.json b/erpnext/education/doctype/assessment_result/assessment_result.json index 3912587f99..1e2f4d249d 100644 --- a/erpnext/education/doctype/assessment_result/assessment_result.json +++ b/erpnext/education/doctype/assessment_result/assessment_result.json @@ -13,6 +13,190 @@ "editable_grid": 1, "engine": "InnoDB", "fields": [ + { + "allow_bulk_edit": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fieldname": "assessment_plan", + "fieldtype": "Link", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 1, + "in_standard_filter": 0, + "label": "Assessment Plan", + "length": 0, + "no_copy": 0, + "options": "Assessment Plan", + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 1, + "search_index": 0, + "set_only_once": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fieldname": "program", + "fieldtype": "Link", + "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": "Program", + "length": 0, + "no_copy": 0, + "options": "Program", + "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": "course", + "fieldtype": "Link", + "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": "Course", + "length": 0, + "no_copy": 0, + "options": "Course", + "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": "academic_year", + "fieldtype": "Link", + "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": "Academic Year", + "length": 0, + "no_copy": 0, + "options": "Academic Year", + "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": "academic_term", + "fieldtype": "Link", + "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": "Academic Term", + "length": 0, + "no_copy": 0, + "options": "Academic Term", + "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": "column_break_3", + "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, @@ -80,8 +264,8 @@ "bold": 0, "collapsible": 0, "columns": 0, - "fieldname": "column_break_3", - "fieldtype": "Column Break", + "fieldname": "student_group", + "fieldtype": "Link", "hidden": 0, "ignore_user_permissions": 0, "ignore_xss_filter": 0, @@ -89,8 +273,10 @@ "in_global_search": 0, "in_list_view": 0, "in_standard_filter": 0, + "label": "Student Group", "length": 0, "no_copy": 0, + "options": "Student Group", "permlevel": 0, "precision": "", "print_hide": 0, @@ -109,19 +295,19 @@ "bold": 0, "collapsible": 0, "columns": 0, - "fieldname": "assessment_plan", + "fieldname": "assessment_group", "fieldtype": "Link", "hidden": 0, "ignore_user_permissions": 0, "ignore_xss_filter": 0, "in_filter": 0, "in_global_search": 0, - "in_list_view": 1, + "in_list_view": 0, "in_standard_filter": 0, - "label": "Assessment Plan", + "label": "Assessment Group", "length": 0, "no_copy": 0, - "options": "Assessment Plan", + "options": "Assessment Group", "permlevel": 0, "precision": "", "print_hide": 0, @@ -129,7 +315,7 @@ "read_only": 0, "remember_last_selected_value": 0, "report_hide": 0, - "reqd": 1, + "reqd": 0, "search_index": 0, "set_only_once": 0, "unique": 0 @@ -180,6 +366,7 @@ "in_global_search": 0, "in_list_view": 0, "in_standard_filter": 0, + "label": "Result", "length": 0, "no_copy": 0, "permlevel": 0, @@ -285,6 +472,35 @@ "set_only_once": 0, "unique": 0 }, + { + "allow_bulk_edit": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fieldname": "column_break_11", + "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, @@ -315,35 +531,6 @@ "set_only_once": 0, "unique": 0 }, - { - "allow_bulk_edit": 0, - "allow_on_submit": 0, - "bold": 0, - "collapsible": 0, - "columns": 0, - "fieldname": "column_break_11", - "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, @@ -389,6 +576,7 @@ "in_global_search": 0, "in_list_view": 0, "in_standard_filter": 0, + "label": "Summary", "length": 0, "no_copy": 0, "permlevel": 0, @@ -474,7 +662,7 @@ "issingle": 0, "istable": 0, "max_attachments": 0, - "modified": "2017-11-10 18:58:32.114529", + "modified": "2018-01-09 14:14:30.090317", "modified_by": "Administrator", "module": "Education", "name": "Assessment Result", diff --git a/erpnext/education/doctype/assessment_result/assessment_result.py b/erpnext/education/doctype/assessment_result/assessment_result.py index 7459d5afe7..891b9e265d 100644 --- a/erpnext/education/doctype/assessment_result/assessment_result.py +++ b/erpnext/education/doctype/assessment_result/assessment_result.py @@ -14,15 +14,25 @@ from frappe.utils.csvutils import getlink class AssessmentResult(Document): def validate(self): - if self.student and not self.student_name: - self.student_name = frappe.db.get_value("Student", self.student, "title") - self.grading_scale = frappe.db.get_value("Assessment Plan", self.assessment_plan, "grading_scale") + self.set_missing_values() self.validate_maximum_score() self.validate_grade() self.validate_duplicate() + def set_missing_values(self): + if self.student and not self.student_name: + self.student_name = frappe.db.get_value("Student", self.student, "title") + assessment_plan_details = frappe.get_value("Assessment Plan", self.assessment_plan, ["academic_term", + "academic_year", "program", "course", "grading_scale", "assessment_group", "student_group", + "maximum_assessment_score"], as_dict=1) + + for field in assessment_plan_details: + if field != "maximum_assessment_score": + setattr(self, field, assessment_plan_details[field]) + else: + self.maximum_score = assessment_plan_details[field] + def validate_maximum_score(self): - self.maximum_score = frappe.db.get_value("Assessment Plan", self.assessment_plan, "maximum_assessment_score") assessment_details = get_assessment_details(self.assessment_plan) max_scores = {} for d in assessment_details: 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 824a29582e..bc6021839a 100644 --- a/erpnext/education/doctype/program_enrollment_tool/program_enrollment_tool.py +++ b/erpnext/education/doctype/program_enrollment_tool/program_enrollment_tool.py @@ -10,6 +10,7 @@ from erpnext.education.api import enroll_student class ProgramEnrollmentTool(Document): def get_students(self): + students = [] if not self.get_students_from: frappe.throw(_("Mandatory field - Get Students From")) elif not self.program: diff --git a/erpnext/patches.txt b/erpnext/patches.txt index 5976915ede..8fa382cf7f 100644 --- a/erpnext/patches.txt +++ b/erpnext/patches.txt @@ -484,4 +484,6 @@ erpnext.patches.v10_0.copy_projects_renamed_fields erpnext.patches.v10_0.enabled_regional_print_format_based_on_country erpnext.patches.v10_0.update_asset_calculate_depreciation erpnext.patches.v10_0.add_guardian_role_for_parent_portal -erpnext.patches.v10_0.set_numeric_ranges_in_template_if_blank \ No newline at end of file +erpnext.patches.v10_0.set_numeric_ranges_in_template_if_blank +erpnext.patches.v10_0.update_assessment_plan +erpnext.patches.v10_0.update_assessment_result diff --git a/erpnext/patches/v10_0/update_assessment_plan.py b/erpnext/patches/v10_0/update_assessment_plan.py new file mode 100644 index 0000000000..174623c1a4 --- /dev/null +++ b/erpnext/patches/v10_0/update_assessment_plan.py @@ -0,0 +1,17 @@ +# 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('education', 'doctype', 'assessment_plan') + + frappe.db.sql(""" + UPDATE `tabAssessment Plan` as ap + INNER JOIN `tabStudent Group` as sg ON sg.name = ap.student_group + SET ap.academic_term = sg.academic_term, + ap.academic_year = sg.academic_year, + ap.program = sg.program + WHERE ap.docstatus = 1 + """) \ No newline at end of file diff --git a/erpnext/patches/v10_0/update_assessment_result.py b/erpnext/patches/v10_0/update_assessment_result.py new file mode 100644 index 0000000000..96218db972 --- /dev/null +++ b/erpnext/patches/v10_0/update_assessment_result.py @@ -0,0 +1,20 @@ +# 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('education', 'doctype', 'assessment_result') + + frappe.db.sql(""" + UPDATE `tabAssessment Result` AS ar + INNER JOIN `tabAssessment Plan` AS ap ON ap.name = ar.assessment_plan + SET ar.academic_term = ap.academic_term, + ar.academic_year = ap.academic_year, + ar.program = ap.program, + ar.course = ap.course, + ar.assessment_group = ap.assessment_group, + ar.student_group = ap.student_group + WHERE ap.docstatus = 1 + """) \ No newline at end of file From 9fbed5617f95d8306fbbebd111c3d0cd850f4305 Mon Sep 17 00:00:00 2001 From: rohitwaghchaure Date: Fri, 12 Jan 2018 16:22:33 +0530 Subject: [PATCH 12/15] [Fix] Wrong batch showing in the popup (#12421) --- erpnext/accounts/doctype/pos_profile/pos_profile.py | 2 +- erpnext/controllers/queries.py | 9 +++++---- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/erpnext/accounts/doctype/pos_profile/pos_profile.py b/erpnext/accounts/doctype/pos_profile/pos_profile.py index 846d79d610..0bce49c016 100644 --- a/erpnext/accounts/doctype/pos_profile/pos_profile.py +++ b/erpnext/accounts/doctype/pos_profile/pos_profile.py @@ -25,7 +25,7 @@ class POSProfile(Document): `tabPOS Profile User` pfu, `tabPOS Profile` pf where pf.name = pfu.parent and pfu.user = %s and pf.name != %s and pf.company = %s - and pfu.default=1""", (row.user, self.name, self.company)) + and pfu.default=1 and pf.disabled = 0""", (row.user, self.name, self.company)) if row.default and res: msgprint(_("Already set default in pos profile {0} for user {1}, kindly disabled default") diff --git a/erpnext/controllers/queries.py b/erpnext/controllers/queries.py index a71a08e7fc..cd74fb5717 100644 --- a/erpnext/controllers/queries.py +++ b/erpnext/controllers/queries.py @@ -414,10 +414,11 @@ def get_doctype_wise_filters(filters): @frappe.whitelist() def get_batch_numbers(doctype, txt, searchfield, start, page_len, filters): - query = 'select batch_id from `tabBatch` ' \ - 'where (`tabBatch`.expiry_date >= CURDATE() or `tabBatch`.expiry_date IS NULL)' + query = """select batch_id from `tabBatch` + where (expiry_date >= CURDATE() or expiry_date IS NULL) + and name like '{txt}'""".format(txt = frappe.db.escape('%{0}%'.format(txt))) - if filters and filters.get('item_code'): - query += 'where item = %(item_code)s' % filters + if filters and filters.get('item'): + query += " and item = '{item}'".format(item = frappe.db.escape(filters.get('item'))) return frappe.db.sql(query) From 7b78f6bee612e3cdf84d3e0de3081f786ce9926f Mon Sep 17 00:00:00 2001 From: rohitwaghchaure Date: Fri, 12 Jan 2018 16:28:16 +0530 Subject: [PATCH 13/15] Added rounded total in the POS and fix rounded issue in js side (#12457) --- .../gst_pos_invoice/gst_pos_invoice.json | 4 ++-- .../print_format/pos_invoice/pos_invoice.json | 6 ++--- erpnext/public/css/pos.css | 5 +++- .../public/js/controllers/taxes_and_totals.js | 3 ++- .../page/point_of_sale/point_of_sale.js | 23 ++++++++++++++++--- 5 files changed, 31 insertions(+), 10 deletions(-) diff --git a/erpnext/accounts/print_format/gst_pos_invoice/gst_pos_invoice.json b/erpnext/accounts/print_format/gst_pos_invoice/gst_pos_invoice.json index 6aec7e3f23..8d6cf3e2b6 100644 --- a/erpnext/accounts/print_format/gst_pos_invoice/gst_pos_invoice.json +++ b/erpnext/accounts/print_format/gst_pos_invoice/gst_pos_invoice.json @@ -7,10 +7,10 @@ "docstatus": 0, "doctype": "Print Format", "font": "Default", - "html": "\n\n

\n\t{{ doc.company }}
\n\t{% if doc.company_address_display %}\n\t\t{% set company_address = doc.company_address_display.replace(\"\\n\", \" \").replace(\"
\", \" \") %}\n\t\t{% if \"GSTIN\" not in company_address %}\n\t\t\t{{ company_address }}\n\t\t\t{{ _(\"GSTIN\") }}:{{ doc.company_gstin }}\n\t\t{% else %}\n\t\t\t{{ company_address.replace(\"GSTIN\", \"
GSTIN\") }}\n\t\t{% endif %}\n\t{% endif %}\n\t
\n\t{{ doc.select_print_heading or _(\"Invoice\") }}
\n

\n

\n\t{{ _(\"Receipt No\") }}: {{ doc.name }}
\n\t{{ _(\"Date\") }}: {{ doc.get_formatted(\"posting_date\") }}
\n\t{% if doc.grand_total > 50000 %}\n\t\t{% set customer_address = doc.address_display.replace(\"\\n\", \" \").replace(\"
\", \" \") %}\n\t\t{{ _(\"Customer\") }}:
\n\t\t{{ doc.customer_name }}
\n\t\t{{ customer_address }}\n\t{% endif %}\n

\n\n
\n\n\t\n\t\t\n\t\t\t\n\t\t\t\n\t\t\t\n\t\t\n\t\n\t\n\t\t{%- for item in doc.items -%}\n\t\t\n\t\t\t\n\t\t\t\n\t\t\t\n\t\t\n\t\t{%- endfor -%}\n\t\n
{{ _(\"Item\") }}{{ _(\"Qty\") }}{{ _(\"Amount\") }}
\n\t\t\t\t{{ item.item_code }}\n\t\t\t\t{%- if item.item_name != item.item_code -%}\n\t\t\t\t\t
{{ item.item_name }}\n\t\t\t\t{%- endif -%}\n\t\t\t\t{%- if item.gst_hsn_code -%}\n\t\t\t\t\t
{{ _(\"HSN/SAC\") }}: {{ item.gst_hsn_code }}\n\t\t\t\t{%- endif -%}\n\t\t\t\t{%- if item.serial_no -%}\n\t\t\t\t\t
{{ _(\"Serial No\") }}: {{ item.serial_no }}\n\t\t\t\t{%- endif -%}\n\t\t\t
{{ item.qty }}
@ {{ item.rate }}
{{ item.get_formatted(\"amount\") }}
\n\n\t\n\t\t\n\t\t\t{% if doc.flags.show_inclusive_tax_in_print %}\n\t\t\t\t\n\t\t\t\t\n\t\t\t{% else %}\n\t\t\t\t\n\t\t\t\t\n\t\t\t{% endif %}\n\t\t\n\t\t{%- for row in doc.taxes -%}\n\t\t {%- if not row.included_in_print_rate or doc.flags.show_inclusive_tax_in_print -%}\n\t\t\t\n\t\t\t\t\n\t\t\t\t\n\t\t\t\n\t\t {%- endif -%}\n\t\t{%- endfor -%}\n\t\t{%- if doc.discount_amount -%}\n\t\t\n\t\t\t\n\t\t\t\n\t\t\n\t\t{%- endif -%}\n\t\t\n\t\t\t\n\t\t\t\n\t\t\n\t\n
\n\t\t\t\t\t{{ _(\"Total Excl. Tax\") }}\n\t\t\t\t\n\t\t\t\t\t{{ doc.get_formatted(\"net_total\", doc) }}\n\t\t\t\t\n\t\t\t\t\t{{ _(\"Total\") }}\n\t\t\t\t\n\t\t\t\t\t{{ doc.get_formatted(\"total\", doc) }}\n\t\t\t\t
\n\t\t\t\t\t{{ row.description }}\n\t\t\t\t\n\t\t\t\t\t{{ row.get_formatted(\"tax_amount\", doc) }}\n\t\t\t\t
\n\t\t\t\t{{ _(\"Discount\") }}\n\t\t\t\n\t\t\t\t{{ doc.get_formatted(\"discount_amount\") }}\n\t\t\t
\n\t\t\t\t{{ _(\"Grand Total\") }}\n\t\t\t\n\t\t\t\t{{ doc.get_formatted(\"grand_total\") }}\n\t\t\t
\n

Tax Breakup:

\n
\n\t{{ doc.other_charges_calculation }}\n
\n

{{ doc.terms or \"\" }}

\n

{{ _(\"Thank you, please visit again.\") }}

", + "html": "\n\n

\n\t{{ doc.company }}
\n\t{% if doc.company_address_display %}\n\t\t{% set company_address = doc.company_address_display.replace(\"\\n\", \" \").replace(\"
\", \" \") %}\n\t\t{% if \"GSTIN\" not in company_address %}\n\t\t\t{{ company_address }}\n\t\t\t{{ _(\"GSTIN\") }}:{{ doc.company_gstin }}\n\t\t{% else %}\n\t\t\t{{ company_address.replace(\"GSTIN\", \"
GSTIN\") }}\n\t\t{% endif %}\n\t{% endif %}\n\t
\n\t{{ doc.select_print_heading or _(\"Invoice\") }}
\n

\n

\n\t{{ _(\"Receipt No\") }}: {{ doc.name }}
\n\t{{ _(\"Date\") }}: {{ doc.get_formatted(\"posting_date\") }}
\n\t{% if doc.grand_total > 50000 %}\n\t\t{% set customer_address = doc.address_display.replace(\"\\n\", \" \").replace(\"
\", \" \") %}\n\t\t{{ _(\"Customer\") }}:
\n\t\t{{ doc.customer_name }}
\n\t\t{{ customer_address }}\n\t{% endif %}\n

\n\n
\n\n\t\n\t\t\n\t\t\t\n\t\t\t\n\t\t\t\n\t\t\n\t\n\t\n\t\t{%- for item in doc.items -%}\n\t\t\n\t\t\t\n\t\t\t\n\t\t\t\n\t\t\n\t\t{%- endfor -%}\n\t\n
{{ _(\"Item\") }}{{ _(\"Qty\") }}{{ _(\"Amount\") }}
\n\t\t\t\t{{ item.item_code }}\n\t\t\t\t{%- if item.item_name != item.item_code -%}\n\t\t\t\t\t
{{ item.item_name }}\n\t\t\t\t{%- endif -%}\n\t\t\t\t{%- if item.gst_hsn_code -%}\n\t\t\t\t\t
{{ _(\"HSN/SAC\") }}: {{ item.gst_hsn_code }}\n\t\t\t\t{%- endif -%}\n\t\t\t\t{%- if item.serial_no -%}\n\t\t\t\t\t
{{ _(\"Serial No\") }}: {{ item.serial_no }}\n\t\t\t\t{%- endif -%}\n\t\t\t
{{ item.qty }}
@ {{ item.rate }}
{{ item.get_formatted(\"amount\") }}
\n\n\t\n\t\t\n\t\t\t{% if doc.flags.show_inclusive_tax_in_print %}\n\t\t\t\t\n\t\t\t\t\n\t\t\t{% else %}\n\t\t\t\t\n\t\t\t\t\n\t\t\t{% endif %}\n\t\t\n\t\t{%- for row in doc.taxes -%}\n\t\t {%- if not row.included_in_print_rate or doc.flags.show_inclusive_tax_in_print -%}\n\t\t\t\n\t\t\t\t\n\t\t\t\t\n\t\t\t\n\t\t {%- endif -%}\n\t\t{%- endfor -%}\n\t\t{%- if doc.discount_amount -%}\n\t\t\n\t\t\t\n\t\t\t\n\t\t\n\t\t{%- endif -%}\n\t\t\n\t\t\t\n\t\t\t\n\t\t\n\t\t{%- if doc.rounded_total -%}\n\t\t\n\t\t\t\n\t\t\t\n\t\t\n\t\t{%- endif -%}\n\t\n
\n\t\t\t\t\t{{ _(\"Total Excl. Tax\") }}\n\t\t\t\t\n\t\t\t\t\t{{ doc.get_formatted(\"net_total\", doc) }}\n\t\t\t\t\n\t\t\t\t\t{{ _(\"Total\") }}\n\t\t\t\t\n\t\t\t\t\t{{ doc.get_formatted(\"total\", doc) }}\n\t\t\t\t
\n\t\t\t\t\t{{ row.description }}\n\t\t\t\t\n\t\t\t\t\t{{ row.get_formatted(\"tax_amount\", doc) }}\n\t\t\t\t
\n\t\t\t\t{{ _(\"Discount\") }}\n\t\t\t\n\t\t\t\t{{ doc.get_formatted(\"discount_amount\") }}\n\t\t\t
\n\t\t\t\t{{ _(\"Grand Total\") }}\n\t\t\t\n\t\t\t\t{{ doc.get_formatted(\"grand_total\") }}\n\t\t\t
\n\t\t\t\t{{ _(\"Rounded Total\") }}\n\t\t\t\n\t\t\t\t{{ doc.get_formatted(\"rounded_total\") }}\n\t\t\t
\n

Tax Breakup:

\n
\n\t{{ doc.other_charges_calculation }}\n
\n

{{ doc.terms or \"\" }}

\n

{{ _(\"Thank you, please visit again.\") }}

", "idx": 0, "line_breaks": 0, - "modified": "2018-01-05 17:25:59.181985", + "modified": "2018-01-12 11:19:17.432600", "modified_by": "Administrator", "module": "Accounts", "name": "GST POS Invoice", diff --git a/erpnext/accounts/print_format/pos_invoice/pos_invoice.json b/erpnext/accounts/print_format/pos_invoice/pos_invoice.json index 112f0646a5..1613462a49 100644 --- a/erpnext/accounts/print_format/pos_invoice/pos_invoice.json +++ b/erpnext/accounts/print_format/pos_invoice/pos_invoice.json @@ -2,14 +2,14 @@ "align_labels_right": 0, "creation": "2011-12-21 11:08:55", "custom_format": 1, - "disabled": 0, + "disabled": 1, "doc_type": "Sales Invoice", "docstatus": 0, "doctype": "Print Format", - "html": "\n\n

\n\t{{ doc.company }}
\n\t{{ doc.select_print_heading or _(\"Invoice\") }}
\n

\n

\n\t{{ _(\"Receipt No\") }}: {{ doc.name }}
\n\t{{ _(\"Date\") }}: {{ doc.get_formatted(\"posting_date\") }}
\n\t{{ _(\"Customer\") }}: {{ doc.customer_name }}\n

\n\n
\n\n\t\n\t\t\n\t\t\t\n\t\t\t\n\t\t\t\n\t\t\n\t\n\t\n\t\t{%- for item in doc.items -%}\n\t\t\n\t\t\t\n\t\t\t\n\t\t\t\n\t\t\n\t\t{%- endfor -%}\n\t\n
{{ _(\"Item\") }}{{ _(\"Qty\") }}{{ _(\"Amount\") }}
\n\t\t\t\t{{ item.item_code }}\n\t\t\t\t{%- if item.item_name != item.item_code -%}\n\t\t\t\t\t
{{ item.item_name }}{%- endif -%}\n\t\t\t
{{ item.qty }}
@ {{ item.get_formatted(\"rate\") }}
{{ item.get_formatted(\"amount\") }}
\n\n\t\n\t\t\n\t\t\t{% if doc.flags.show_inclusive_tax_in_print %}\n\t\t\t\t\n\t\t\t\t\n\t\t\t{% else %}\n\t\t\t\t\n\t\t\t\t\n\t\t\t{% endif %}\n\t\t\n\t\t{%- for row in doc.taxes -%}\n\t\t {%- if not row.included_in_print_rate or doc.flags.show_inclusive_tax_in_print -%}\n\t\t\t\n\t\t\t\t\n\t\t\t\t\n\t\t\t\n\t\t {%- endif -%}\n\t\t{%- endfor -%}\n\n\t\t{%- if doc.discount_amount -%}\n\t\t\n\t\t\t\n\t\t\t\n\t\t\n\t\t{%- endif -%}\n\t\t\n\t\t\t\n\t\t\t\n\t\t\n\t\n
\n\t\t\t\t\t{{ _(\"Total Excl. Tax\") }}\n\t\t\t\t\n\t\t\t\t\t{{ doc.get_formatted(\"net_total\", doc) }}\n\t\t\t\t\n\t\t\t\t\t{{ _(\"Total\") }}\n\t\t\t\t\n\t\t\t\t\t{{ doc.get_formatted(\"total\", doc) }}\n\t\t\t\t
\n\t\t\t\t\t{{ row.description }}\n\t\t\t\t\n\t\t\t\t\t{{ row.get_formatted(\"tax_amount\", doc) }}\n\t\t\t\t
\n\t\t\t\t{{ _(\"Discount\") }}\n\t\t\t\n\t\t\t\t{{ doc.get_formatted(\"discount_amount\") }}\n\t\t\t
\n\t\t\t\t{{ _(\"Grand Total\") }}\n\t\t\t\n\t\t\t\t{{ doc.get_formatted(\"grand_total\") }}\n\t\t\t
\n
\n

{{ doc.terms or \"\" }}

\n

{{ _(\"Thank you, please visit again.\") }}

", + "html": "\n\n

\n\t{{ doc.company }}
\n\t{{ doc.select_print_heading or _(\"Invoice\") }}
\n

\n

\n\t{{ _(\"Receipt No\") }}: {{ doc.name }}
\n\t{{ _(\"Date\") }}: {{ doc.get_formatted(\"posting_date\") }}
\n\t{{ _(\"Customer\") }}: {{ doc.customer_name }}\n

\n\n
\n\n\t\n\t\t\n\t\t\t\n\t\t\t\n\t\t\t\n\t\t\n\t\n\t\n\t\t{%- for item in doc.items -%}\n\t\t\n\t\t\t\n\t\t\t\n\t\t\t\n\t\t\n\t\t{%- endfor -%}\n\t\n
{{ _(\"Item\") }}{{ _(\"Qty\") }}{{ _(\"Amount\") }}
\n\t\t\t\t{{ item.item_code }}\n\t\t\t\t{%- if item.item_name != item.item_code -%}\n\t\t\t\t\t
{{ item.item_name }}{%- endif -%}\n\t\t\t
{{ item.qty }}
@ {{ item.get_formatted(\"rate\") }}
{{ item.get_formatted(\"amount\") }}
\n\n\t\n\t\t\n\t\t\t{% if doc.flags.show_inclusive_tax_in_print %}\n\t\t\t\t\n\t\t\t\t\n\t\t\t{% else %}\n\t\t\t\t\n\t\t\t\t\n\t\t\t{% endif %}\n\t\t\n\t\t{%- for row in doc.taxes -%}\n\t\t {%- if not row.included_in_print_rate or doc.flags.show_inclusive_tax_in_print -%}\n\t\t\t\n\t\t\t\t\n\t\t\t\t\n\t\t\t\n\t\t {%- endif -%}\n\t\t{%- endfor -%}\n\n\t\t{%- if doc.discount_amount -%}\n\t\t\n\t\t\t\n\t\t\t\n\t\t\n\t\t{%- endif -%}\n\t\t\n\t\t\t\n\t\t\t\n\t\t\n\t\t{%- if doc.rounded_total -%}\n\t\t\n\t\t\t\n\t\t\t\n\t\t\n\t\t{%- endif -%}\n\t\n
\n\t\t\t\t\t{{ _(\"Total Excl. Tax\") }}\n\t\t\t\t\n\t\t\t\t\t{{ doc.get_formatted(\"net_total\", doc) }}\n\t\t\t\t\n\t\t\t\t\t{{ _(\"Total\") }}\n\t\t\t\t\n\t\t\t\t\t{{ doc.get_formatted(\"total\", doc) }}\n\t\t\t\t
\n\t\t\t\t\t{{ row.description }}\n\t\t\t\t\n\t\t\t\t\t{{ row.get_formatted(\"tax_amount\", doc) }}\n\t\t\t\t
\n\t\t\t\t{{ _(\"Discount\") }}\n\t\t\t\n\t\t\t\t{{ doc.get_formatted(\"discount_amount\") }}\n\t\t\t
\n\t\t\t\t{{ _(\"Grand Total\") }}\n\t\t\t\n\t\t\t\t{{ doc.get_formatted(\"grand_total\") }}\n\t\t\t
\n\t\t\t\t{{ _(\"Rounded Total\") }}\n\t\t\t\n\t\t\t\t{{ doc.get_formatted(\"rounded_total\") }}\n\t\t\t
\n
\n

{{ doc.terms or \"\" }}

\n

{{ _(\"Thank you, please visit again.\") }}

", "idx": 1, "line_breaks": 0, - "modified": "2018-01-05 17:23:40.403289", + "modified": "2018-01-12 11:18:54.229254", "modified_by": "Administrator", "module": "Accounts", "name": "POS Invoice", diff --git a/erpnext/public/css/pos.css b/erpnext/public/css/pos.css index bc81182f32..e2d301df0d 100644 --- a/erpnext/public/css/pos.css +++ b/erpnext/public/css/pos.css @@ -169,5 +169,8 @@ input[type=number]::-webkit-outer-spin-button { height: 60px; } .grand-total .grand-total-value { - font-size: 24px; + font-size: 18px; +} +.rounded-total-value { + font-size: 18px; } diff --git a/erpnext/public/js/controllers/taxes_and_totals.js b/erpnext/public/js/controllers/taxes_and_totals.js index 8abb8bea11..4847dae555 100644 --- a/erpnext/public/js/controllers/taxes_and_totals.js +++ b/erpnext/public/js/controllers/taxes_and_totals.js @@ -434,7 +434,8 @@ erpnext.taxes_and_totals = erpnext.payments.extend({ } else if (frappe.sys_defaults.disable_rounded_total) { disable_rounded_total = frappe.sys_defaults.disable_rounded_total; } - if(disable_rounded_total) { + + if (cint(disable_rounded_total)) { this.frm.doc.rounded_total = 0; this.frm.doc.base_rounded_total = 0; return; diff --git a/erpnext/selling/page/point_of_sale/point_of_sale.js b/erpnext/selling/page/point_of_sale/point_of_sale.js index 1e121d84db..0876228d42 100644 --- a/erpnext/selling/page/point_of_sale/point_of_sale.js +++ b/erpnext/selling/page/point_of_sale/point_of_sale.js @@ -585,16 +585,28 @@ class POSCart { this.wrapper.find('.grand-total-value').text( format_currency(this.frm.doc.grand_total, this.frm.currency)); + this.wrapper.find('.rounded-total-value').text( + format_currency(this.frm.doc.rounded_total, this.frm.currency)); const customer = this.frm.doc.customer; this.customer_field.set_value(customer); } get_grand_total() { + let total = this.get_total_template('Grand Total', 'grand-total-value'); + + if (!cint(frappe.sys_defaults.disable_rounded_total)) { + total += this.get_total_template('Rounded Total', 'rounded-total-value'); + } + + return total; + } + + get_total_template(label, class_name) { return `
-
${__('Grand Total')}
-
0.00
+
${__(label)}
+
0.00
`; } @@ -671,6 +683,10 @@ class POSCart { this.$grand_total.find('.grand-total-value').text( format_currency(this.frm.doc.grand_total, this.frm.currency) ); + + this.$grand_total.find('.rounded-total-value').text( + format_currency(this.frm.doc.rounded_total, this.frm.currency) + ); } make_customer_field() { @@ -1381,7 +1397,8 @@ class Payment { set_title() { let title = __('Total Amount {0}', - [format_currency(this.frm.doc.grand_total, this.frm.doc.currency)]); + [format_currency(this.frm.doc.rounded_total || this.frm.doc.grand_total, + this.frm.doc.currency)]); this.dialog.set_title(title); } From b19fd5704355f67ab9f0ecf521e648faefc00ef5 Mon Sep 17 00:00:00 2001 From: Manas Solanki Date: Fri, 12 Jan 2018 16:28:30 +0530 Subject: [PATCH 14/15] [fix] set required quantity if item in bom found (#12460) --- .../manufacturing/doctype/production_order/production_order.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/erpnext/manufacturing/doctype/production_order/production_order.py b/erpnext/manufacturing/doctype/production_order/production_order.py index 7c56d97974..7cfbab002a 100644 --- a/erpnext/manufacturing/doctype/production_order/production_order.py +++ b/erpnext/manufacturing/doctype/production_order/production_order.py @@ -462,7 +462,8 @@ class ProductionOrder(Document): if reset_only_qty: for d in self.get("required_items"): - d.required_qty = item_dict.get(d.item_code).get("qty") + if item_dict.get(d.item_code): + d.required_qty = item_dict.get(d.item_code).get("qty") else: for item in sorted(item_dict.values(), key=lambda d: d['idx']): self.append('required_items', { From 59edc6028d3b204c0f0b81788b21790cba0160b4 Mon Sep 17 00:00:00 2001 From: Saurabh Date: Fri, 12 Jan 2018 17:24:26 +0600 Subject: [PATCH 15/15] bumped to version 10.0.8 --- erpnext/__init__.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/erpnext/__init__.py b/erpnext/__init__.py index 63ade1228b..c1ec5715e6 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.0.7' +__version__ = '10.0.8' def get_default_company(user=None): '''Get default company for user'''