From 6c49fa20b596a5b11dca8dcb455c2b81fc99fd5f Mon Sep 17 00:00:00 2001 From: Nabin Hait Date: Wed, 5 Oct 2016 11:27:52 +0530 Subject: [PATCH 01/10] Fixed precision of rate field --- erpnext/public/js/controllers/taxes_and_totals.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/erpnext/public/js/controllers/taxes_and_totals.js b/erpnext/public/js/controllers/taxes_and_totals.js index 2149f6d35e..4e1288cedf 100644 --- a/erpnext/public/js/controllers/taxes_and_totals.js +++ b/erpnext/public/js/controllers/taxes_and_totals.js @@ -25,11 +25,11 @@ erpnext.taxes_and_totals = erpnext.payments.extend({ item.total_margin = item.price_list_rate + item.margin_rate_or_amount; } - item.rate = flt(item.total_margin , 2); + item.rate = flt(item.total_margin , precision("rate", item)); if(item.discount_percentage){ discount_value = flt(item.total_margin) * flt(item.discount_percentage) / 100; - item.rate = flt((item.total_margin) - (discount_value), precision('rate')); + item.rate = flt((item.total_margin) - (discount_value), precision('rate', item)); } }, From 9ac2fc932daa0966fb206ad470b431eb7c092f27 Mon Sep 17 00:00:00 2001 From: Nabin Hait Date: Wed, 5 Oct 2016 12:20:25 +0530 Subject: [PATCH 02/10] Validate dates, fixes #6542 --- erpnext/projects/doctype/timesheet/timesheet.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/erpnext/projects/doctype/timesheet/timesheet.py b/erpnext/projects/doctype/timesheet/timesheet.py index a30a21b514..cb23ff848c 100644 --- a/erpnext/projects/doctype/timesheet/timesheet.py +++ b/erpnext/projects/doctype/timesheet/timesheet.py @@ -145,7 +145,7 @@ class Timesheet(Document): def validate_dates(self): for data in self.time_logs: - if time_diff_in_hours(data.to_time, data.from_time) < 0: + if data.from_time and data.to_time and time_diff_in_hours(data.to_time, data.from_time) < 0: frappe.throw(_("To date cannot be before from date")) def validate_time_logs(self): From 219148d23d416a35c78f39de9a8426651a51311e Mon Sep 17 00:00:00 2001 From: Nabin Hait Date: Wed, 5 Oct 2016 12:24:26 +0530 Subject: [PATCH 03/10] Sales Personwise transaction summary - total row --- .../sales_person_wise_transaction_summary.json | 4 ++-- .../sales_person_wise_transaction_summary.py | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/erpnext/selling/report/sales_person_wise_transaction_summary/sales_person_wise_transaction_summary.json b/erpnext/selling/report/sales_person_wise_transaction_summary/sales_person_wise_transaction_summary.json index 0612dc02e5..af28e20bd3 100644 --- a/erpnext/selling/report/sales_person_wise_transaction_summary/sales_person_wise_transaction_summary.json +++ b/erpnext/selling/report/sales_person_wise_transaction_summary/sales_person_wise_transaction_summary.json @@ -1,5 +1,5 @@ { - "add_total_row": 0, + "add_total_row": 1, "apply_user_permissions": 1, "creation": "2013-05-03 11:31:05", "disabled": 0, @@ -7,7 +7,7 @@ "doctype": "Report", "idx": 1, "is_standard": "Yes", - "modified": "2016-01-28 04:22:49.476068", + "modified": "2016-10-05 12:26:15.736596", "modified_by": "Administrator", "module": "Selling", "name": "Sales Person-wise Transaction Summary", diff --git a/erpnext/selling/report/sales_person_wise_transaction_summary/sales_person_wise_transaction_summary.py b/erpnext/selling/report/sales_person_wise_transaction_summary/sales_person_wise_transaction_summary.py index e9930f32fa..0c6914dace 100644 --- a/erpnext/selling/report/sales_person_wise_transaction_summary/sales_person_wise_transaction_summary.py +++ b/erpnext/selling/report/sales_person_wise_transaction_summary/sales_person_wise_transaction_summary.py @@ -39,7 +39,7 @@ def get_columns(filters): _("Customer") + ":Link/Customer:140", _("Territory") + ":Link/Territory:100", _("Posting Date") + ":Date:100", _("Item Code") + ":Link/Item:120", _("Item Group") + ":Link/Item Group:120", _("Brand") + ":Link/Brand:120", _("Qty") + ":Float:100", _("Amount") + ":Currency:120", - _("Sales Person") + ":Link/Sales Person:140", _("Contribution %") + ":Float:110", + _("Sales Person") + ":Link/Sales Person:140", _("Contribution %") + "::110", _("Contribution Amount") + ":Currency:140"] def get_entries(filters): From 9501b38e8ba73cb02c9d62a1c181674a26b8e534 Mon Sep 17 00:00:00 2001 From: Nabin Hait Date: Wed, 5 Oct 2016 12:35:11 +0530 Subject: [PATCH 04/10] Update remove_doctypes_and_reports.py --- erpnext/patches/v7_0/remove_doctypes_and_reports.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/erpnext/patches/v7_0/remove_doctypes_and_reports.py b/erpnext/patches/v7_0/remove_doctypes_and_reports.py index 3c45be4377..03461dee1f 100644 --- a/erpnext/patches/v7_0/remove_doctypes_and_reports.py +++ b/erpnext/patches/v7_0/remove_doctypes_and_reports.py @@ -13,7 +13,8 @@ def execute(): 'doctype': 'Custom Field', 'label': data.label, 'dt': 'Timesheet Detail', - 'fieldname': data.fieldname + 'fieldname': data.fieldname, + 'fieldtype': data.fieldtype or "Data" }).insert(ignore_permissions=True) frappe.db.sql("""delete from `tabCustom Field` where dt = 'Time Log'""") @@ -22,4 +23,4 @@ def execute(): report = "Daily Time Log Summary" if frappe.db.exists("Report", report): - frappe.delete_doc('Report', report) \ No newline at end of file + frappe.delete_doc('Report', report) From 163e3598c7c43c964615adc0b958e22f6721a18b Mon Sep 17 00:00:00 2001 From: Rohit Waghchaure Date: Wed, 5 Oct 2016 13:38:02 +0530 Subject: [PATCH 05/10] [Fix] POS wildcard search for customers, items --- erpnext/accounts/page/pos/pos.js | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) diff --git a/erpnext/accounts/page/pos/pos.js b/erpnext/accounts/page/pos/pos.js index fa88481652..a5ce985860 100644 --- a/erpnext/accounts/page/pos/pos.js +++ b/erpnext/accounts/page/pos/pos.js @@ -359,11 +359,14 @@ erpnext.pos.PointOfSale = erpnext.taxes_and_totals.extend({ get_customers: function(key){ var me = this; key = key.toLowerCase().trim() + var re = new RegExp('%', 'g'); + var reg = new RegExp(key.replace(re, '\\w*\\s*[a-zA-Z0-9]*')) + if(key){ return $.grep(this.customers, function(data) { - if(data.name.toLowerCase().match(key) - || data.customer_name.toLowerCase().match(key) - || (data.customer_group && data.customer_group.toLowerCase().match(key))){ + if(reg.test(data.name.toLowerCase()) + || reg.test(data.customer_name.toLowerCase()) + || (data.customer_group && reg.test(data.customer_group.toLowerCase()))){ return data } }) @@ -431,7 +434,9 @@ erpnext.pos.PointOfSale = erpnext.taxes_and_totals.extend({ }) } - key = this.search.$input.val().toLowerCase(); + key = this.search.$input.val().toLowerCase(); + var re = new RegExp('%', 'g'); + var reg = new RegExp(key.replace(re, '\\w*\\s*[a-zA-Z0-9]*')) search_status = true if(key){ @@ -447,8 +452,8 @@ erpnext.pos.PointOfSale = erpnext.taxes_and_totals.extend({ } else if(item.barcode == me.search.$input.val()) { search_status = false; return item.barcode == me.search.$input.val(); - } else if((item.item_code.toLowerCase().match(key)) || - (item.item_name.toLowerCase().match(key)) || (item.item_group.toLowerCase().match(key))) { + } else if(reg.test(item.item_code.toLowerCase()) || reg.test(item.description.toLowerCase()) || + reg.test(item.item_name.toLowerCase()) || reg.test(item.item_group.toLowerCase()) ){ return true } } From e86eaf543cec46ef72dc5a9cfe03c95592e98a3e Mon Sep 17 00:00:00 2001 From: Rohit Waghchaure Date: Wed, 5 Oct 2016 14:45:15 +0530 Subject: [PATCH 06/10] removed sync master data onload of the pos page --- erpnext/accounts/page/pos/pos.js | 13 ------------- 1 file changed, 13 deletions(-) diff --git a/erpnext/accounts/page/pos/pos.js b/erpnext/accounts/page/pos/pos.js index a5ce985860..668b377fda 100644 --- a/erpnext/accounts/page/pos/pos.js +++ b/erpnext/accounts/page/pos/pos.js @@ -15,13 +15,11 @@ frappe.pages['pos'].refresh = function(wrapper) { window.onbeforeunload = function () { return wrapper.pos.beforeunload() } - wrapper.pos.on_refresh_page() } erpnext.pos.PointOfSale = erpnext.taxes_and_totals.extend({ init: function(wrapper){ - this.load = true; this.page = wrapper.page; this.wrapper = $(wrapper).find('.page-content'); this.set_indicator(); @@ -31,17 +29,6 @@ erpnext.pos.PointOfSale = erpnext.taxes_and_totals.extend({ this.si_docs = this.get_doc_from_localstorage(); }, - on_refresh_page: function() { - var me = this; - if(this.load){ - this.load = false; - }else if(this.connection_status){ - this.onload(); - }else{ - this.create_new(); - } - }, - beforeunload: function(e){ if(this.connection_status == false && frappe.get_route()[0] == "pos"){ e = e || window.event; From 2704a4a8fc03f551d40fc3418e62383486b294e8 Mon Sep 17 00:00:00 2001 From: Nabin Hait Date: Wed, 5 Oct 2016 16:14:42 +0530 Subject: [PATCH 07/10] Update production_order.py --- .../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 2bf32048aa..250d6e65a3 100644 --- a/erpnext/manufacturing/doctype/production_order/production_order.py +++ b/erpnext/manufacturing/doctype/production_order/production_order.py @@ -55,7 +55,8 @@ class ProductionOrder(Document): if not self.expected_delivery_date: self.expected_delivery_date = so[0].delivery_date - self.project = so[0].project + if so[0].project: + self.project = so[0].project self.validate_production_order_against_so() else: From 33fafb77288f3413e257efcfbbf5e1434fed78ae Mon Sep 17 00:00:00 2001 From: Nabin Hait Date: Wed, 5 Oct 2016 16:43:13 +0530 Subject: [PATCH 08/10] Set warranty claim resolution date as today only if it is not set --- erpnext/support/doctype/warranty_claim/warranty_claim.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/erpnext/support/doctype/warranty_claim/warranty_claim.py b/erpnext/support/doctype/warranty_claim/warranty_claim.py index b4427bebd5..a3428a25af 100644 --- a/erpnext/support/doctype/warranty_claim/warranty_claim.py +++ b/erpnext/support/doctype/warranty_claim/warranty_claim.py @@ -19,7 +19,7 @@ class WarrantyClaim(TransactionBase): if session['user'] != 'Guest' and not self.customer: frappe.throw(_("Customer is required")) - if self.status=="Closed" and \ + if self.status=="Closed" and not self.resolution_date and \ frappe.db.get_value("Warranty Claim", self.name, "status")!="Closed": self.resolution_date = now_datetime() From cccc45edc57159f60d9d4c3a31db3ef6383d1296 Mon Sep 17 00:00:00 2001 From: Nabin Hait Date: Wed, 5 Oct 2016 17:15:43 +0530 Subject: [PATCH 09/10] Don't throw expense account validation on fetching item details --- .../accounts/doctype/purchase_invoice/purchase_invoice.py | 6 +++--- erpnext/controllers/accounts_controller.py | 4 ++-- erpnext/controllers/buying_controller.py | 2 +- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/erpnext/accounts/doctype/purchase_invoice/purchase_invoice.py b/erpnext/accounts/doctype/purchase_invoice/purchase_invoice.py index 914c9be0a8..d741a6008a 100644 --- a/erpnext/accounts/doctype/purchase_invoice/purchase_invoice.py +++ b/erpnext/accounts/doctype/purchase_invoice/purchase_invoice.py @@ -58,7 +58,7 @@ class PurchaseInvoice(BuyingController): self.check_for_closed_status() self.validate_with_previous_doc() self.validate_uom_is_integer("uom", "qty") - self.set_expense_account() + self.set_expense_account(for_validate=True) self.set_against_expense_account() self.validate_write_off_account() self.validate_multiple_billing("Purchase Receipt", "pr_detail", "amount", "items") @@ -155,7 +155,7 @@ class PurchaseInvoice(BuyingController): super(PurchaseInvoice, self).validate_warehouse() - def set_expense_account(self): + def set_expense_account(self, for_validate=False): auto_accounting_for_stock = cint(frappe.defaults.get_global_default("auto_accounting_for_stock")) if auto_accounting_for_stock: @@ -181,7 +181,7 @@ class PurchaseInvoice(BuyingController): else: item.expense_account = stock_not_billed_account - elif not item.expense_account: + elif not item.expense_account and for_validate: throw(_("Expense account is mandatory for item {0}").format(item.item_code or item.item_name)) def set_against_expense_account(self): diff --git a/erpnext/controllers/accounts_controller.py b/erpnext/controllers/accounts_controller.py index 8927da7f78..e245875468 100644 --- a/erpnext/controllers/accounts_controller.py +++ b/erpnext/controllers/accounts_controller.py @@ -144,7 +144,7 @@ class AccountsController(TransactionBase): self.conversion_rate = get_exchange_rate(self.currency, self.company_currency) - def set_missing_item_details(self): + def set_missing_item_details(self, for_validate=False): """set missing item values""" from erpnext.stock.get_item_details import get_item_details @@ -196,7 +196,7 @@ class AccountsController(TransactionBase): (1.0 - (flt(item.discount_percentage) / 100.0)), item.precision("rate")) if self.doctype == "Purchase Invoice": - self.set_expense_account() + self.set_expense_account(for_validate) def set_taxes(self): if not self.meta.get_field("taxes"): diff --git a/erpnext/controllers/buying_controller.py b/erpnext/controllers/buying_controller.py index 88acfb7c17..8bc081b3b5 100644 --- a/erpnext/controllers/buying_controller.py +++ b/erpnext/controllers/buying_controller.py @@ -62,7 +62,7 @@ class BuyingController(StockController): if getattr(self, "supplier", None): self.update_if_missing(get_party_details(self.supplier, party_type="Supplier", ignore_permissions=self.flags.ignore_permissions)) - self.set_missing_item_details() + self.set_missing_item_details(for_validate) def set_supplier_from_item_default(self): if self.meta.get_field("supplier") and not self.supplier: From a162b3f0cd38cebdea6a051d574e256eeecacf14 Mon Sep 17 00:00:00 2001 From: Nabin Hait Date: Wed, 5 Oct 2016 17:48:11 +0600 Subject: [PATCH 10/10] bumped to version 7.0.55 --- erpnext/__init__.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/erpnext/__init__.py b/erpnext/__init__.py index 03c30a1b0b..ceb8ca2653 100644 --- a/erpnext/__init__.py +++ b/erpnext/__init__.py @@ -2,7 +2,7 @@ from __future__ import unicode_literals import frappe -__version__ = '7.0.54' +__version__ = '7.0.55' def get_default_company(user=None): '''Get default company for user'''