From c44290955e3e812cf3e87b26d9cc418b4b3d1fa3 Mon Sep 17 00:00:00 2001 From: Nabin Hait Date: Sat, 21 Oct 2017 11:20:18 +0530 Subject: [PATCH 1/3] Minor fix in patches (#11268) --- erpnext/patches/v8_0/disable_instructor_role.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/erpnext/patches/v8_0/disable_instructor_role.py b/erpnext/patches/v8_0/disable_instructor_role.py index 94ebd9cac6..4ba78d172c 100644 --- a/erpnext/patches/v8_0/disable_instructor_role.py +++ b/erpnext/patches/v8_0/disable_instructor_role.py @@ -12,6 +12,7 @@ def execute(): domains = frappe.db.sql_list("select domain from tabCompany") if "Education" not in domains: - role = frappe.get_doc("Role", "Instructor") - role.disabled = 1 - role.save(ignore_permissions=True) \ No newline at end of file + if frappe.db.exists("Role", "Instructor"): + role = frappe.get_doc("Role", "Instructor") + role.disabled = 1 + role.save(ignore_permissions=True) \ No newline at end of file From 5fdd26f1e70fc5d6d41136056240179e8d8265f2 Mon Sep 17 00:00:00 2001 From: rohitwaghchaure Date: Sat, 21 Oct 2017 11:23:45 +0530 Subject: [PATCH 2/3] [fix] Discount amount not reset for new order in offline pos (#11258) --- erpnext/accounts/doctype/sales_invoice/pos.py | 2 +- erpnext/accounts/page/pos/pos.js | 14 +++++++++++--- 2 files changed, 12 insertions(+), 4 deletions(-) diff --git a/erpnext/accounts/doctype/sales_invoice/pos.py b/erpnext/accounts/doctype/sales_invoice/pos.py index 04f7e1be4f..6856f62d0c 100644 --- a/erpnext/accounts/doctype/sales_invoice/pos.py +++ b/erpnext/accounts/doctype/sales_invoice/pos.py @@ -88,7 +88,7 @@ def update_pos_profile_data(doc, pos_profile, company_data): doc.naming_series = pos_profile.get('naming_series') or 'SINV-' doc.letter_head = pos_profile.get('letter_head') or company_data.default_letter_head doc.ignore_pricing_rule = pos_profile.get('ignore_pricing_rule') or 0 - doc.apply_discount_on = pos_profile.get('apply_discount_on') or '' + doc.apply_discount_on = pos_profile.get('apply_discount_on') or 'Grand Total' doc.customer_group = pos_profile.get('customer_group') or get_root('Customer Group') doc.territory = pos_profile.get('territory') or get_root('Territory') doc.terms = frappe.db.get_value('Terms and Conditions', pos_profile.get('tc_name'), 'terms') or doc.terms or '' diff --git a/erpnext/accounts/page/pos/pos.js b/erpnext/accounts/page/pos/pos.js index 57a8a186b9..c442062ab6 100644 --- a/erpnext/accounts/page/pos/pos.js +++ b/erpnext/accounts/page/pos/pos.js @@ -84,6 +84,7 @@ erpnext.pos.PointOfSale = erpnext.taxes_and_totals.extend({ this.get_data_from_server(function () { me.make_control(); me.create_new(); + me.make(); }); }, @@ -382,7 +383,6 @@ erpnext.pos.PointOfSale = erpnext.taxes_and_totals.extend({ }, setup: function () { - this.make(); this.set_primary_action(); this.party_field.$input.attr('disabled', false); if(this.selected_row) { @@ -1341,6 +1341,12 @@ erpnext.pos.PointOfSale = erpnext.taxes_and_totals.extend({ this.wrapper.find('input.discount-percentage').on("change", function () { me.frm.doc.additional_discount_percentage = flt($(this).val(), precision("additional_discount_percentage")); + + if(me.frm.doc.additional_discount_percentage && me.frm.doc.discount_amount) { + // Reset discount amount + me.frm.doc.discount_amount = 0; + } + var total = me.frm.doc.grand_total if (me.frm.doc.apply_discount_on == 'Net Total') { @@ -1348,15 +1354,15 @@ erpnext.pos.PointOfSale = erpnext.taxes_and_totals.extend({ } me.frm.doc.discount_amount = flt(total * flt(me.frm.doc.additional_discount_percentage) / 100, precision("discount_amount")); - me.wrapper.find('input.discount-amount').val(me.frm.doc.discount_amount) me.refresh(); + me.wrapper.find('input.discount-amount').val(me.frm.doc.discount_amount) }); this.wrapper.find('input.discount-amount').on("change", function () { me.frm.doc.discount_amount = flt($(this).val(), precision("discount_amount")); me.frm.doc.additional_discount_percentage = 0.0; - me.wrapper.find('input.discount-percentage').val(0); me.refresh(); + me.wrapper.find('input.discount-percentage').val(0); }); }, @@ -1517,6 +1523,8 @@ erpnext.pos.PointOfSale = erpnext.taxes_and_totals.extend({ var me = this; this.wrapper.find(".net-total").text(format_currency(me.frm.doc.total, me.frm.doc.currency)); this.wrapper.find(".grand-total").text(format_currency(me.frm.doc.grand_total, me.frm.doc.currency)); + this.wrapper.find('input.discount-percentage').val(this.frm.doc.additional_discount_percentage); + this.wrapper.find('input.discount-amount').val(this.frm.doc.discount_amount); }, set_primary_action: function () { From e7eda65968572ffc7bf4dbc985206f60d146e441 Mon Sep 17 00:00:00 2001 From: Nabin Hait Date: Sat, 21 Oct 2017 11:59:39 +0600 Subject: [PATCH 3/3] bumped to version 9.1.7 --- erpnext/__init__.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/erpnext/__init__.py b/erpnext/__init__.py index 42f538df66..0c7daad89f 100644 --- a/erpnext/__init__.py +++ b/erpnext/__init__.py @@ -4,7 +4,7 @@ import inspect import frappe from erpnext.hooks import regional_overrides -__version__ = '9.1.6' +__version__ = '9.1.7' def get_default_company(user=None): '''Get default company for user'''