From ce5b93ca771aa84c52828ec63889b503bf1cb905 Mon Sep 17 00:00:00 2001 From: rohitwaghchaure Date: Tue, 30 Jan 2018 10:39:46 +0530 Subject: [PATCH 01/14] [Fix] Allow user to edit rate in online POS (#12701) --- .../accounts/doctype/sales_invoice/sales_invoice.py | 5 ++++- erpnext/selling/page/point_of_sale/point_of_sale.js | 13 ++++++++++++- 2 files changed, 16 insertions(+), 2 deletions(-) diff --git a/erpnext/accounts/doctype/sales_invoice/sales_invoice.py b/erpnext/accounts/doctype/sales_invoice/sales_invoice.py index b6c84052a6..df1284cf39 100644 --- a/erpnext/accounts/doctype/sales_invoice/sales_invoice.py +++ b/erpnext/accounts/doctype/sales_invoice/sales_invoice.py @@ -242,7 +242,10 @@ class SalesInvoice(SellingController): super(SalesInvoice, self).set_missing_values(for_validate) if pos: - return {"print_format": pos.get("print_format_for_online") } + return { + "print_format": pos.get("print_format_for_online"), + "allow_edit_rate": pos.get("allow_user_to_edit_rate") + } def update_time_sheet(self, sales_invoice): for d in self.timesheets: 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 0876228d42..f5bc6c2499 100644 --- a/erpnext/selling/page/point_of_sale/point_of_sale.js +++ b/erpnext/selling/page/point_of_sale/point_of_sale.js @@ -463,6 +463,7 @@ erpnext.pos.PointOfSale = class PointOfSale { if (r.message) { this.frm.meta.default_print_format = r.message.print_format || 'POS Invoice'; + this.frm.allow_edit_rate = r.message.allow_edit_rate; } } @@ -727,6 +728,7 @@ class POSCart { disable_highlight: ['Qty', 'Disc', 'Rate', 'Pay'], reset_btns: ['Qty', 'Disc', 'Rate', 'Pay'], del_btn: 'Del', + disable_btns: !this.frm.allow_edit_rate ? ['Rate']: [], wrapper: this.wrapper.find('.number-pad-container'), onclick: (btn_value) => { // on click @@ -1257,7 +1259,7 @@ class NumberPad { constructor({ wrapper, onclick, button_array, add_class={}, disable_highlight=[], - reset_btns=[], del_btn='', + reset_btns=[], del_btn='', disable_btns }) { this.wrapper = wrapper; this.onclick = onclick; @@ -1266,6 +1268,7 @@ class NumberPad { this.disable_highlight = disable_highlight; this.reset_btns = reset_btns; this.del_btn = del_btn; + this.disable_btns = disable_btns; this.make_dom(); this.bind_events(); this.value = ''; @@ -1296,6 +1299,14 @@ class NumberPad { } this.set_class(); + + this.disable_btns.forEach((btn) => { + const $btn = this.get_btn(btn); + $btn.prop("disabled", true) + $btn.hover(() => { + $btn.css('cursor','not-allowed'); + }) + }) } set_class() { From 585254456e43f8512faa13c852b58ce9ec188eb2 Mon Sep 17 00:00:00 2001 From: Nabin Hait Date: Tue, 30 Jan 2018 12:11:22 +0530 Subject: [PATCH 02/14] Check credit limit while making DN, if bypassed on SO (#12702) --- .../doctype/sales_invoice/sales_invoice.py | 7 ++- .../selling/doctype/customer/customer.json | 49 +++++++++++++++---- erpnext/selling/doctype/customer/customer.py | 11 +++-- .../doctype/sales_order/sales_order.py | 9 ---- .../doctype/delivery_note/delivery_note.py | 19 +++++-- 5 files changed, 66 insertions(+), 29 deletions(-) diff --git a/erpnext/accounts/doctype/sales_invoice/sales_invoice.py b/erpnext/accounts/doctype/sales_invoice/sales_invoice.py index df1284cf39..f37fe6114c 100644 --- a/erpnext/accounts/doctype/sales_invoice/sales_invoice.py +++ b/erpnext/accounts/doctype/sales_invoice/sales_invoice.py @@ -224,12 +224,17 @@ class SalesInvoice(SellingController): from erpnext.selling.doctype.customer.customer import check_credit_limit validate_against_credit_limit = False + bypass_credit_limit_check_at_sales_order = cint(frappe.db.get_value("Customer", self.customer, + "bypass_credit_limit_check_at_sales_order")) + if bypass_credit_limit_check_at_sales_order: + validate_against_credit_limit = True + for d in self.get("items"): if not (d.sales_order or d.delivery_note): validate_against_credit_limit = True break if validate_against_credit_limit: - check_credit_limit(self.customer, self.company) + check_credit_limit(self.customer, self.company, bypass_credit_limit_check_at_sales_order) def set_missing_values(self, for_validate=False): pos = self.set_pos_fields(for_validate) diff --git a/erpnext/selling/doctype/customer/customer.json b/erpnext/selling/doctype/customer/customer.json index b618bf3fbc..b2577d5878 100644 --- a/erpnext/selling/doctype/customer/customer.json +++ b/erpnext/selling/doctype/customer/customer.json @@ -1002,9 +1002,9 @@ "bold": 0, "collapsible": 0, "columns": 0, - "depends_on": "", - "fieldname": "payment_terms", - "fieldtype": "Link", + "default": "0", + "fieldname": "bypass_credit_limit_check_at_sales_order", + "fieldtype": "Check", "hidden": 0, "ignore_user_permissions": 0, "ignore_xss_filter": 0, @@ -1012,10 +1012,9 @@ "in_global_search": 0, "in_list_view": 0, "in_standard_filter": 0, - "label": "Default Payment Terms Template", + "label": "Bypass credit limit check at Sales Order", "length": 0, "no_copy": 0, - "options": "Payment Terms Template", "permlevel": 0, "precision": "", "print_hide": 0, @@ -1034,9 +1033,8 @@ "bold": 0, "collapsible": 0, "columns": 0, - "default": "0", - "fieldname": "bypass_credit_limit_check_at_sales_order", - "fieldtype": "Check", + "fieldname": "column_break_34", + "fieldtype": "Column Break", "hidden": 0, "ignore_user_permissions": 0, "ignore_xss_filter": 0, @@ -1044,7 +1042,6 @@ "in_global_search": 0, "in_list_view": 0, "in_standard_filter": 0, - "label": "Bypass credit limit check at Sales Order", "length": 0, "no_copy": 0, "permlevel": 0, @@ -1059,6 +1056,38 @@ "set_only_once": 0, "unique": 0 }, + { + "allow_bulk_edit": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "depends_on": "", + "fieldname": "payment_terms", + "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": "Default Payment Terms Template", + "length": 0, + "no_copy": 0, + "options": "Payment Terms Template", + "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, @@ -1354,7 +1383,7 @@ "issingle": 0, "istable": 0, "max_attachments": 0, - "modified": "2017-12-13 18:17:19.894331", + "modified": "2018-01-30 11:52:05.497363", "modified_by": "Administrator", "module": "Selling", "name": "Customer", diff --git a/erpnext/selling/doctype/customer/customer.py b/erpnext/selling/doctype/customer/customer.py index eaa82b3713..2284f85374 100644 --- a/erpnext/selling/doctype/customer/customer.py +++ b/erpnext/selling/doctype/customer/customer.py @@ -185,12 +185,14 @@ def get_customer_list(doctype, txt, searchfield, start, page_len, filters): ("%%%s%%" % txt, "%%%s%%" % txt, "%%%s%%" % txt, "%%%s%%" % txt, start, page_len)) -def check_credit_limit(customer, company): - customer_outstanding = get_customer_outstanding(customer, company) +def check_credit_limit(customer, company, ignore_outstanding_sales_order=False, extra_amount=0): + customer_outstanding = get_customer_outstanding(customer, company, ignore_outstanding_sales_order) + if extra_amount > 0: + customer_outstanding += flt(extra_amount) credit_limit = get_credit_limit(customer, company) if credit_limit > 0 and flt(customer_outstanding) > credit_limit: - msgprint(_("Credit limit has been crossed for customer {0} {1}/{2}") + msgprint(_("Credit limit has been crossed for customer {0} ({1}/{2})") .format(customer, customer_outstanding, credit_limit)) # If not authorized person raise exception @@ -231,7 +233,8 @@ def get_customer_outstanding(customer, company, ignore_outstanding_sales_order=F and dn.customer=%s and dn.company=%s and dn.docstatus = 1 and dn.status not in ('Closed', 'Stopped') and ifnull(dn_item.against_sales_order, '') = '' - and ifnull(dn_item.against_sales_invoice, '') = ''""", (customer, company), as_dict=True) + and ifnull(dn_item.against_sales_invoice, '') = '' + """, (customer, company), as_dict=True) outstanding_based_on_dn = 0.0 diff --git a/erpnext/selling/doctype/sales_order/sales_order.py b/erpnext/selling/doctype/sales_order/sales_order.py index 1c3354c212..42cde9f2fd 100644 --- a/erpnext/selling/doctype/sales_order/sales_order.py +++ b/erpnext/selling/doctype/sales_order/sales_order.py @@ -484,11 +484,6 @@ def make_delivery_note(source_name, target_doc=None): else: target.po_no = source.po_no - # Since the credit limit check is bypassed at sales order level, - # we need to check it at delivery note - if cint(frappe.db.get_value("Customer", source.customer, "bypass_credit_limit_check_at_sales_order")): - check_credit_limit(source.customer, source.company) - target.ignore_pricing_rule = 1 target.run_method("set_missing_values") target.run_method("calculate_taxes_and_totals") @@ -553,10 +548,6 @@ def make_sales_invoice(source_name, target_doc=None, ignore_permissions=False): target.run_method("set_missing_values") target.run_method("calculate_taxes_and_totals") - # Since the credit limit check is bypassed at sales order level, we need to check it at sales invoice - if cint(frappe.db.get_value("Customer", source.customer, "bypass_credit_limit_check_at_sales_order")): - check_credit_limit(source.customer, source.company) - # set company address target.update(get_company_address(target.company)) if target.company_address: diff --git a/erpnext/stock/doctype/delivery_note/delivery_note.py b/erpnext/stock/doctype/delivery_note/delivery_note.py index dd00398695..65f384f6d9 100644 --- a/erpnext/stock/doctype/delivery_note/delivery_note.py +++ b/erpnext/stock/doctype/delivery_note/delivery_note.py @@ -235,13 +235,22 @@ class DeliveryNote(SellingController): def check_credit_limit(self): from erpnext.selling.doctype.customer.customer import check_credit_limit + extra_amount = 0 validate_against_credit_limit = False - for d in self.get("items"): - if not (d.against_sales_order or d.against_sales_invoice): - validate_against_credit_limit = True - break + bypass_credit_limit_check_at_sales_order = cint(frappe.db.get_value("Customer", self.customer, + "bypass_credit_limit_check_at_sales_order")) + if bypass_credit_limit_check_at_sales_order: + validate_against_credit_limit = True + extra_amount = self.base_grand_total + else: + for d in self.get("items"): + if not (d.against_sales_order or d.against_sales_invoice): + validate_against_credit_limit = True + break + if validate_against_credit_limit: - check_credit_limit(self.customer, self.company) + check_credit_limit(self.customer, self.company, + bypass_credit_limit_check_at_sales_order, extra_amount) def validate_packed_qty(self): """ From 2f4854ad1ac5295f30c3222252df36a01bf34f84 Mon Sep 17 00:00:00 2001 From: tundebabzy Date: Tue, 30 Jan 2018 07:48:15 +0100 Subject: [PATCH 03/14] create new dialog everytime (#12696) --- erpnext/stock/doctype/item/item.js | 5 ----- 1 file changed, 5 deletions(-) diff --git a/erpnext/stock/doctype/item/item.js b/erpnext/stock/doctype/item/item.js index 4e61bd9fe6..f7250e47ea 100644 --- a/erpnext/stock/doctype/item/item.js +++ b/erpnext/stock/doctype/item/item.js @@ -317,11 +317,6 @@ $.extend(erpnext.item, { show_multiple_variants_dialog: function(frm) { var me = this; - if(me.multiple_variant_dialog) { - me.multiple_variant_dialog.show(); - return; - } - let promises = []; let attr_val_fields = {}; From b9e8b917b695d244b72062f13b7a062cd7754db8 Mon Sep 17 00:00:00 2001 From: Nabin Hait Date: Tue, 30 Jan 2018 15:08:33 +0530 Subject: [PATCH 04/14] Removed ui-tests from travis --- .travis.yml | 34 ---------------------------------- 1 file changed, 34 deletions(-) diff --git a/.travis.yml b/.travis.yml index 43b40786be..d6fc930471 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,13 +1,6 @@ language: python dist: trusty -addons: - apt: - sources: - - google-chrome - packages: - - google-chrome-stable - python: - "2.7" @@ -29,15 +22,6 @@ install: - cp -r $TRAVIS_BUILD_DIR/test_sites/test_site ~/frappe-bench/sites/ before_script: - - wget http://chromedriver.storage.googleapis.com/2.33/chromedriver_linux64.zip - - unzip chromedriver_linux64.zip - - sudo apt-get install libnss3 - - sudo apt-get --only-upgrade install google-chrome-stable - - sudo cp chromedriver /usr/local/bin/. - - sudo chmod +x /usr/local/bin/chromedriver - - export DISPLAY=:99.0 - - sh -e /etc/init.d/xvfb start - - sleep 3 - mysql -u root -ptravis -e 'create database test_frappe' - echo "USE mysql;\nCREATE USER 'test_frappe'@'localhost' IDENTIFIED BY 'test_frappe';\nFLUSH PRIVILEGES;\n" | mysql -u root -ptravis - echo "USE mysql;\nGRANT ALL PRIVILEGES ON \`test_frappe\`.* TO 'test_frappe'@'localhost';\n" | mysql -u root -ptravis @@ -58,24 +42,6 @@ jobs: - set -e - bench run-tests env: Server Side Test - - # stage - script: - - bench --verbose run-setup-wizard-ui-test - - bench execute erpnext.setup.utils.enable_all_roles_and_domains - - bench run-ui-tests --app erpnext - env: Client Side Test - - # stage - script: - - bench --verbose run-setup-wizard-ui-test - - bench execute erpnext.setup.utils.enable_all_roles_and_domains - - bench run-ui-tests --app erpnext --test-list erpnext/tests/ui/tests2.txt - env: Client Side Test - 2 - - # stage - script: - - bench --verbose run-setup-wizard-ui-test - - bench execute erpnext.setup.utils.enable_all_roles_and_domains - - bench run-ui-tests --app erpnext --test-list erpnext/tests/ui/agriculture.txt - env: Agriculture Client Side Test - # stage script: - wget http://build.erpnext.com/20171108_190013_955977f8_database.sql.gz From 4eae6c985ca4f0956d4fd91325d313016d6da8d8 Mon Sep 17 00:00:00 2001 From: Nabin Hait Date: Tue, 30 Jan 2018 15:27:29 +0530 Subject: [PATCH 05/14] Fixed test records for supplier --- erpnext/buying/doctype/supplier/test_records.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/erpnext/buying/doctype/supplier/test_records.json b/erpnext/buying/doctype/supplier/test_records.json index 370ce8dad1..2536721326 100644 --- a/erpnext/buying/doctype/supplier/test_records.json +++ b/erpnext/buying/doctype/supplier/test_records.json @@ -8,7 +8,7 @@ { "doctype": "Supplier", "supplier_name": "_Test Supplier P", - "supplier_type": "_Test Supplier Type", + "supplier_type": "_Test Supplier Type" }, { "doctype": "Supplier", From 0f75a022f2dfb5b38a256e39649362b16652afb2 Mon Sep 17 00:00:00 2001 From: Nabin Hait Date: Tue, 30 Jan 2018 15:32:17 +0530 Subject: [PATCH 06/14] Minor fix in old patch --- erpnext/patches.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/erpnext/patches.txt b/erpnext/patches.txt index 3a18efc1a6..dbd098d119 100644 --- a/erpnext/patches.txt +++ b/erpnext/patches.txt @@ -345,7 +345,7 @@ erpnext.patches.v7_0.repost_bin_qty_and_item_projected_qty erpnext.patches.v7_1.set_prefered_contact_email execute:frappe.reload_doc('accounts', 'doctype', 'accounts_settings') execute:frappe.db.set_value("Accounts Settings", "Accounts Settings", "unlink_payment_on_cancellation_of_invoice", 0) -execute:frappe.db.sql("update `tabStock Entry` set total_amount = null where purpose in('Repack', 'Manufacture')") +execute:frappe.db.sql("update `tabStock Entry` set total_amount = 0 where purpose in('Repack', 'Manufacture')") erpnext.patches.v7_1.save_stock_settings erpnext.patches.v7_0.repost_gle_for_pi_with_update_stock #2016-11-01 erpnext.patches.v7_1.add_account_user_role_for_timesheet From 927d13fadbfa0c813718bfca8373e2d705e7717b Mon Sep 17 00:00:00 2001 From: Nabin Hait Date: Tue, 30 Jan 2018 15:59:44 +0530 Subject: [PATCH 07/14] Minor fix in old patch --- erpnext/patches/v7_0/update_status_of_po_so.py | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/erpnext/patches/v7_0/update_status_of_po_so.py b/erpnext/patches/v7_0/update_status_of_po_so.py index c0b6f59eaf..d630e8f0f2 100644 --- a/erpnext/patches/v7_0/update_status_of_po_so.py +++ b/erpnext/patches/v7_0/update_status_of_po_so.py @@ -20,7 +20,10 @@ def update_po_per_received_per_billed(): where parent = `tabPurchase Order`.name), 2), `tabPurchase Order`.per_billed = ifnull(round((select sum( if(amount > ifnull(billed_amt, 0), ifnull(billed_amt, 0), amount)) / sum(amount) *100 from `tabPurchase Order Item` - where parent = `tabPurchase Order`.name), 2), 0)""") + where parent = `tabPurchase Order`.name), 2), 0) + where + net_total > 0 + """) def update_so_per_delivered_per_billed(): frappe.db.sql(""" @@ -32,7 +35,10 @@ def update_so_per_delivered_per_billed(): where parent = `tabSales Order`.name), 2), `tabSales Order`.per_billed = ifnull(round((select sum( if(amount > ifnull(billed_amt, 0), ifnull(billed_amt, 0), amount)) / sum(amount) *100 from `tabSales Order Item` - where parent = `tabSales Order`.name), 2), 0)""") + where parent = `tabSales Order`.name), 2), 0) + where + net_total > 0 + """) def update_status(): frappe.db.sql(""" From dba5e7645b03104524429ba60a29d8bdfcfe4100 Mon Sep 17 00:00:00 2001 From: Nabin Hait Date: Tue, 30 Jan 2018 16:38:47 +0530 Subject: [PATCH 08/14] Minor fix in old patch --- .../manufacturing/doctype/production_order/production_order.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/erpnext/manufacturing/doctype/production_order/production_order.py b/erpnext/manufacturing/doctype/production_order/production_order.py index 7cfbab002a..d3b7c5a498 100644 --- a/erpnext/manufacturing/doctype/production_order/production_order.py +++ b/erpnext/manufacturing/doctype/production_order/production_order.py @@ -490,7 +490,7 @@ class ProductionOrder(Document): and detail.parent = entry.name and detail.item_code = %s''', (self.name, d.item_code))[0][0] - d.db_set('transferred_qty', transferred_qty, update_modified = False) + d.db_set('transferred_qty', flt(transferred_qty), update_modified = False) @frappe.whitelist() From bc640fe6a62f525de597be884d9116e18f019f0e Mon Sep 17 00:00:00 2001 From: Nabin Hait Date: Tue, 30 Jan 2018 19:26:28 +0530 Subject: [PATCH 09/14] minor fix in old patch --- erpnext/patches/v8_1/set_delivery_date_in_so_item.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/erpnext/patches/v8_1/set_delivery_date_in_so_item.py b/erpnext/patches/v8_1/set_delivery_date_in_so_item.py index aa5cbc50bc..e3e23a584e 100644 --- a/erpnext/patches/v8_1/set_delivery_date_in_so_item.py +++ b/erpnext/patches/v8_1/set_delivery_date_in_so_item.py @@ -13,11 +13,11 @@ def execute(): frappe.db.sql(""" update `tabSales Order` so, `tabSales Order Item` so_item - set so_item.delivery_date = so.delivery_date + set so_item.delivery_date = if(ifnull(so.delivery_date, '0000-00-00'), ifnull(so.delivery_date, '0000-00-00'), '0000-00-00') where so.name = so_item.parent and so.order_type = 'Sales' and (so_item.delivery_date is null or so_item.delivery_date = '' or so_item.delivery_date = '0000-00-00') - and (so.delivery_date is not null and so.delivery_date != '' + and (so.delivery_date is not null and so.delivery_date != '' and so.delivery_date != "" and so.delivery_date != '0000-00-00') """) From dea99cc3a8b22d4bd6258f21ba9c3aa7a10429bb Mon Sep 17 00:00:00 2001 From: Zarrar Date: Wed, 31 Jan 2018 13:07:04 +0530 Subject: [PATCH 10/14] treeview not set when routed from bom form (#12707) --- erpnext/manufacturing/doctype/bom/bom.py | 2 +- erpnext/manufacturing/doctype/bom/bom_tree.js | 20 ++++++++++++++++++- 2 files changed, 20 insertions(+), 2 deletions(-) diff --git a/erpnext/manufacturing/doctype/bom/bom.py b/erpnext/manufacturing/doctype/bom/bom.py index a06645ad9f..fb52d5260c 100644 --- a/erpnext/manufacturing/doctype/bom/bom.py +++ b/erpnext/manufacturing/doctype/bom/bom.py @@ -592,7 +592,7 @@ def validate_bom_no(item, bom_no): @frappe.whitelist() def get_children(doctype, parent=None, is_root=False, **filters): - if not parent: + if not parent or parent=="BOM": frappe.msgprint(_('Please select a BOM')) return diff --git a/erpnext/manufacturing/doctype/bom/bom_tree.js b/erpnext/manufacturing/doctype/bom/bom_tree.js index 854f6334d7..6cbd7a2ab1 100644 --- a/erpnext/manufacturing/doctype/bom/bom_tree.js +++ b/erpnext/manufacturing/doctype/bom/bom_tree.js @@ -11,7 +11,8 @@ frappe.treeview_settings["BOM"] = { title: "BOM", breadcrumb: "Manufacturing", disable_add_node: true, - root_label: "All Bill of Materials", //fieldname from filters + root_label: "BOM", //fieldname from filters + get_tree_root: false, get_label: function(node) { if(node.data.qty) { return node.data.qty + " x " + node.data.item_code; @@ -19,6 +20,23 @@ frappe.treeview_settings["BOM"] = { return node.data.item_code || node.data.value; } }, + onload: function(me) { + var label = frappe.get_route()[0] + "/" + frappe.get_route()[1]; + if(frappe.pages[label]) { + delete frappe.pages[label]; + } + + var filter = me.opts.filters[0]; + if(frappe.route_options && frappe.route_options[filter.fieldname]) { + var val = frappe.route_options[filter.fieldname]; + delete frappe.route_options[filter.fieldname]; + filter.default = ""; + me.args[filter.fieldname] = val; + me.root_label = val; + me.page.set_title(val); + } + me.make_tree(); + }, toolbar: [ { toggle_btn: true }, { From e37e5d61343bb06bc5721bee13f9a31fcafad308 Mon Sep 17 00:00:00 2001 From: Nabin Hait Date: Wed, 31 Jan 2018 14:59:59 +0530 Subject: [PATCH 11/14] minor fix in patch for mariadb version --- erpnext/patches/v8_1/set_delivery_date_in_so_item.py | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/erpnext/patches/v8_1/set_delivery_date_in_so_item.py b/erpnext/patches/v8_1/set_delivery_date_in_so_item.py index e3e23a584e..2e81571072 100644 --- a/erpnext/patches/v8_1/set_delivery_date_in_so_item.py +++ b/erpnext/patches/v8_1/set_delivery_date_in_so_item.py @@ -8,16 +8,14 @@ def execute(): frappe.db.sql(""" update `tabSales Order` set delivery_date = final_delivery_date - where (delivery_date is null or delivery_date = '' or delivery_date = '0000-00-00') + where (delivery_date is null or delivery_date = '0000-00-00') and order_type = 'Sales'""") frappe.db.sql(""" update `tabSales Order` so, `tabSales Order Item` so_item - set so_item.delivery_date = if(ifnull(so.delivery_date, '0000-00-00'), ifnull(so.delivery_date, '0000-00-00'), '0000-00-00') + set so_item.delivery_date = so.delivery_date where so.name = so_item.parent and so.order_type = 'Sales' - and (so_item.delivery_date is null or so_item.delivery_date = '' - or so_item.delivery_date = '0000-00-00') - and (so.delivery_date is not null and so.delivery_date != '' and so.delivery_date != "" - and so.delivery_date != '0000-00-00') - """) + and (so_item.delivery_date is null or so_item.delivery_date = '0000-00-00') + and (so.delivery_date is not null and so.delivery_date != '0000-00-00') + """) \ No newline at end of file From 7918b92d951ffa058a15476a48ad78523ae86766 Mon Sep 17 00:00:00 2001 From: Nabin Hait Date: Wed, 31 Jan 2018 15:30:03 +0530 Subject: [PATCH 12/14] Invalid date value comparison, fixes for mariadb 10.2.3+ --- erpnext/accounts/doctype/tax_rule/tax_rule.py | 4 ++-- erpnext/controllers/queries.py | 2 +- erpnext/patches/v7_1/set_currency_exchange_date.py | 2 +- erpnext/patches/v7_2/rename_att_date_attendance.py | 2 +- erpnext/patches/v7_2/update_salary_slips.py | 3 +-- 5 files changed, 6 insertions(+), 7 deletions(-) diff --git a/erpnext/accounts/doctype/tax_rule/tax_rule.py b/erpnext/accounts/doctype/tax_rule/tax_rule.py index 9c091e8c9d..2e92e05458 100644 --- a/erpnext/accounts/doctype/tax_rule/tax_rule.py +++ b/erpnext/accounts/doctype/tax_rule/tax_rule.py @@ -130,8 +130,8 @@ def get_party_details(party, party_type, args=None): def get_tax_template(posting_date, args): """Get matching tax rule""" args = frappe._dict(args) - conditions = ["""(from_date is null or from_date = '' or from_date <= '{0}') - and (to_date is null or to_date = '' or to_date >= '{0}')""".format(posting_date)] + conditions = ["""(from_date is null or from_date <= '{0}') + and (to_date is null or to_date >= '{0}')""".format(posting_date)] for key, value in args.iteritems(): if key=="use_for_shopping_cart": diff --git a/erpnext/controllers/queries.py b/erpnext/controllers/queries.py index 53f9ecb986..139586f1e2 100644 --- a/erpnext/controllers/queries.py +++ b/erpnext/controllers/queries.py @@ -257,7 +257,7 @@ def get_delivery_notes_to_be_billed(doctype, txt, searchfield, start, page_len, def get_batch_no(doctype, txt, searchfield, start, page_len, filters): cond = "" if filters.get("posting_date"): - cond = "and (ifnull(batch.expiry_date, '')='' or batch.expiry_date >= %(posting_date)s)" + cond = "and (batch.expiry_date is null or batch.expiry_date >= %(posting_date)s)" batch_nos = None args = { diff --git a/erpnext/patches/v7_1/set_currency_exchange_date.py b/erpnext/patches/v7_1/set_currency_exchange_date.py index 7d8e4f0415..630b7d4229 100644 --- a/erpnext/patches/v7_1/set_currency_exchange_date.py +++ b/erpnext/patches/v7_1/set_currency_exchange_date.py @@ -5,5 +5,5 @@ def execute(): frappe.db.sql(""" update `tabCurrency Exchange` set `date` = '2010-01-01' - where date is null or date = '' or date = '0000-00-00' + where date is null or date = '0000-00-00' """) \ No newline at end of file diff --git a/erpnext/patches/v7_2/rename_att_date_attendance.py b/erpnext/patches/v7_2/rename_att_date_attendance.py index f7caf706db..b2658ba7f1 100644 --- a/erpnext/patches/v7_2/rename_att_date_attendance.py +++ b/erpnext/patches/v7_2/rename_att_date_attendance.py @@ -7,7 +7,7 @@ def execute(): frappe.reload_doc("hr", "doctype", "attendance") frappe.db.sql("""update `tabAttendance` set attendance_date = att_date - where attendance_date is null or attendance_date = '' or attendance_date = '0000-00-00'""") + where attendance_date is null or attendance_date = '0000-00-00'""") update_reports("Attendance", "att_date", "attendance_date") update_users_report_view_settings("Attendance", "att_date", "attendance_date") diff --git a/erpnext/patches/v7_2/update_salary_slips.py b/erpnext/patches/v7_2/update_salary_slips.py index 22bb1d82dc..c6bca8e7b9 100644 --- a/erpnext/patches/v7_2/update_salary_slips.py +++ b/erpnext/patches/v7_2/update_salary_slips.py @@ -9,8 +9,7 @@ def execute(): salary_slips = frappe.db.sql("""select month, name, fiscal_year from `tabSalary Slip` where (month is not null and month != '') and - (start_date is null or start_date = '') and - (end_date is null or end_date = '') and docstatus != 2""", as_dict=True) + start_date is null and end_date is null and docstatus != 2""", as_dict=True) for salary_slip in salary_slips: if not cint(salary_slip.month): From 4e05f02038c137001b06b905b8028611c1f66ba2 Mon Sep 17 00:00:00 2001 From: Zarrar Date: Wed, 31 Jan 2018 15:33:51 +0530 Subject: [PATCH 13/14] error in throw message rectify (#12719) --- erpnext/stock/doctype/batch/batch.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/erpnext/stock/doctype/batch/batch.py b/erpnext/stock/doctype/batch/batch.py index 1c66ea6443..eca0475974 100644 --- a/erpnext/stock/doctype/batch/batch.py +++ b/erpnext/stock/doctype/batch/batch.py @@ -116,7 +116,7 @@ def set_batch_nos(doc, warehouse_field, throw = False): else: batch_qty = get_batch_qty(batch_no=d.batch_no, warehouse=warehouse) if flt(batch_qty, d.precision("qty")) < flt(qty, d.precision("qty")): - frappe.throw(_("Row #{0}: The batch {1} has only {2} qty. Please select another batch which has {3} qty available or split the row into multiple rows, to deliver/issue from multiple batches").format(d.idx, d.batch_no, batch_qty, d.stock_qty)) + frappe.throw(_("Row #{0}: The batch {1} has only {2} qty. Please select another batch which has {3} qty available or split the row into multiple rows, to deliver/issue from multiple batches").format(d.idx, d.batch_no, batch_qty, qty)) @frappe.whitelist() def get_batch_no(item_code, warehouse, qty=1, throw=False): From bff1971bb277794cae2cef9c047d46a8cd87a433 Mon Sep 17 00:00:00 2001 From: Nabin Hait Date: Wed, 31 Jan 2018 16:09:15 +0600 Subject: [PATCH 14/14] bumped to version 10.0.18 --- erpnext/__init__.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/erpnext/__init__.py b/erpnext/__init__.py index 1b88bdc5b9..96ad60f866 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.17' +__version__ = '10.0.18' def get_default_company(user=None): '''Get default company for user'''