From efa191c72e27e9117e5f2d3f7ab9fbcb4d53917e Mon Sep 17 00:00:00 2001 From: Manas Solanki Date: Fri, 15 Jun 2018 18:04:12 +0530 Subject: [PATCH 01/11] [minor fix] change the unicode/str to the datetime obejct (#14534) --- erpnext/hr/doctype/leave_application/leave_application.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/erpnext/hr/doctype/leave_application/leave_application.py b/erpnext/hr/doctype/leave_application/leave_application.py index eb5aec604d..8d6db5c437 100755 --- a/erpnext/hr/doctype/leave_application/leave_application.py +++ b/erpnext/hr/doctype/leave_application/leave_application.py @@ -117,7 +117,7 @@ class LeaveApplication(Document): frappe.db.sql("""update `tabAttendance` set status = %s, leave_type = %s\ where name = %s""",(status, self.leave_type, d.name)) - elif self.to_date <= nowdate(): + elif getdate(self.to_date) <= getdate(nowdate()): for dt in daterange(getdate(self.from_date), getdate(self.to_date)): date = dt.strftime("%Y-%m-%d") if not date == self.half_day_date: From e0adb6bbd64a6adcc328d8c7581ca3b8456a1e2d Mon Sep 17 00:00:00 2001 From: Zarrar Date: Mon, 18 Jun 2018 15:49:12 +0530 Subject: [PATCH 02/11] cost_center overridden by company's default fix in SI (#14560) --- erpnext/selling/doctype/quotation/quotation.py | 1 + 1 file changed, 1 insertion(+) diff --git a/erpnext/selling/doctype/quotation/quotation.py b/erpnext/selling/doctype/quotation/quotation.py index 6d9c170aef..ad06bd2ddb 100644 --- a/erpnext/selling/doctype/quotation/quotation.py +++ b/erpnext/selling/doctype/quotation/quotation.py @@ -185,6 +185,7 @@ def _make_sales_invoice(source_name, target_doc=None, ignore_permissions=False): target.run_method("calculate_taxes_and_totals") def update_item(obj, target, source_parent): + target.cost_center = None target.stock_qty = flt(obj.qty) * flt(obj.conversion_factor) doclist = get_mapped_doc("Quotation", source_name, { From ae02209b6a1af3ceaf327012dbb3826533bf2e13 Mon Sep 17 00:00:00 2001 From: Nabin Hait Date: Mon, 18 Jun 2018 16:13:37 +0530 Subject: [PATCH 03/11] Removed autoname of child table --- .../asset_maintenance_task/asset_maintenance_task.json | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/erpnext/assets/doctype/asset_maintenance_task/asset_maintenance_task.json b/erpnext/assets/doctype/asset_maintenance_task/asset_maintenance_task.json index bdf9054156..48757e8631 100644 --- a/erpnext/assets/doctype/asset_maintenance_task/asset_maintenance_task.json +++ b/erpnext/assets/doctype/asset_maintenance_task/asset_maintenance_task.json @@ -3,7 +3,7 @@ "allow_guest_to_view": 0, "allow_import": 0, "allow_rename": 0, - "autoname": "field:maintenance_task", + "autoname": "", "beta": 0, "creation": "2017-10-20 07:10:55.903571", "custom": 0, @@ -42,7 +42,7 @@ "reqd": 1, "search_index": 0, "set_only_once": 0, - "unique": 1 + "unique": 0 }, { "allow_bulk_edit": 0, @@ -625,7 +625,7 @@ "issingle": 0, "istable": 1, "max_attachments": 0, - "modified": "2017-11-28 12:22:34.151430", + "modified": "2018-06-18 16:12:04.330021", "modified_by": "Administrator", "module": "Assets", "name": "Asset Maintenance Task", From 0bef91c2419cfc2c3ab0b254851127461c2b180a Mon Sep 17 00:00:00 2001 From: Nabin Hait Date: Mon, 18 Jun 2018 16:33:48 +0530 Subject: [PATCH 04/11] minor fix in item type validation --- erpnext/controllers/buying_controller.py | 1 + 1 file changed, 1 insertion(+) diff --git a/erpnext/controllers/buying_controller.py b/erpnext/controllers/buying_controller.py index 48b82bde40..38beccdce0 100644 --- a/erpnext/controllers/buying_controller.py +++ b/erpnext/controllers/buying_controller.py @@ -459,6 +459,7 @@ class BuyingController(StockController): def validate_items(self): # validate items to see if they have is_purchase_item or is_subcontracted_item enabled + if self.doctype=="Material Request": return if hasattr(self, "is_subcontracted") and self.is_subcontracted == 'Yes': validate_item_type(self, "is_sub_contracted_item", "subcontracted") From 8eeb5694ba57f19a377e6e2d8cd7d283d1c20c2b Mon Sep 17 00:00:00 2001 From: Nabin Hait Date: Mon, 18 Jun 2018 16:43:32 +0530 Subject: [PATCH 05/11] Fixed qty in item-wise sales history report --- .../item_wise_sales_history/item_wise_sales_history.json | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/erpnext/selling/report/item_wise_sales_history/item_wise_sales_history.json b/erpnext/selling/report/item_wise_sales_history/item_wise_sales_history.json index 0eb6228077..7f9ef884c6 100644 --- a/erpnext/selling/report/item_wise_sales_history/item_wise_sales_history.json +++ b/erpnext/selling/report/item_wise_sales_history/item_wise_sales_history.json @@ -7,12 +7,12 @@ "doctype": "Report", "idx": 3, "is_standard": "Yes", - "modified": "2017-02-24 20:08:44.614482", + "modified": "2018-06-18 16:42:05.860309", "modified_by": "Administrator", "module": "Selling", "name": "Item-wise Sales History", "owner": "Administrator", - "query": "select\n so_item.item_code as \"Item Code:Link/Item:120\",\n\tso_item.item_name as \"Item Name::120\",\n so_item.item_group as \"Item Group:Link/Item Group:120\",\n\tso_item.description as \"Description::150\",\n\tso_item.qty as \"Qty:Float:100\",\n\tso_item.stock_uom as \"UOM:Link/UOM:80\",\n\tso_item.base_rate as \"Rate:Currency:120\",\n\tso_item.base_amount as \"Amount:Currency:120\",\n\tso.name as \"Sales Order:Link/Sales Order:120\",\n\tso.transaction_date as \"Transaction Date:Date:140\",\n\tso.customer as \"Customer:Link/Customer:130\",\n cu.customer_name as \"Customer Name::150\",\n\tso.territory as \"Territory:Link/Territory:130\",\n so.project as \"Project:Link/Project:130\",\n\tifnull(so_item.delivered_qty, 0) as \"Delivered Qty:Float:120\",\n\tifnull(so_item.billed_amt, 0) as \"Billed Amount:Currency:120\",\n\tso.company as \"Company:Link/Company:\"\nfrom\n\t`tabSales Order` so, `tabSales Order Item` so_item, `tabCustomer` cu\nwhere\n\tso.name = so_item.parent and so.customer=cu.name\n\tand so.docstatus = 1\norder by so.name desc", + "query": "select\n so_item.item_code as \"Item Code:Link/Item:120\",\n\tso_item.item_name as \"Item Name::120\",\n so_item.item_group as \"Item Group:Link/Item Group:120\",\n\tso_item.description as \"Description::150\",\n\tso_item.qty as \"Qty:Data:100\",\n\tso_item.uom as \"UOM:Link/UOM:80\",\n\tso_item.base_rate as \"Rate:Currency:120\",\n\tso_item.base_amount as \"Amount:Currency:120\",\n\tso.name as \"Sales Order:Link/Sales Order:120\",\n\tso.transaction_date as \"Transaction Date:Date:140\",\n\tso.customer as \"Customer:Link/Customer:130\",\n cu.customer_name as \"Customer Name::150\",\n\tso.territory as \"Territory:Link/Territory:130\",\n so.project as \"Project:Link/Project:130\",\n\tifnull(so_item.delivered_qty, 0) as \"Delivered Qty:Float:120\",\n\tifnull(so_item.billed_amt, 0) as \"Billed Amount:Currency:120\",\n\tso.company as \"Company:Link/Company:\"\nfrom\n\t`tabSales Order` so, `tabSales Order Item` so_item, `tabCustomer` cu\nwhere\n\tso.name = so_item.parent and so.customer=cu.name\n\tand so.docstatus = 1\norder by so.name desc", "ref_doctype": "Sales Order", "report_name": "Item-wise Sales History", "report_type": "Query Report", From 875c941f3d0ff2127fb7f9e7258a92234d5410ef Mon Sep 17 00:00:00 2001 From: Nabin Hait Date: Mon, 18 Jun 2018 17:40:42 +0530 Subject: [PATCH 06/11] fixes in setting itemised tax breakup --- erpnext/public/js/controllers/taxes_and_totals.js | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/erpnext/public/js/controllers/taxes_and_totals.js b/erpnext/public/js/controllers/taxes_and_totals.js index 865a5ffd77..b6690cbcbe 100644 --- a/erpnext/public/js/controllers/taxes_and_totals.js +++ b/erpnext/public/js/controllers/taxes_and_totals.js @@ -339,11 +339,7 @@ erpnext.taxes_and_totals = erpnext.payments.extend({ set_item_wise_tax: function(item, tax, tax_rate, current_tax_amount) { // store tax breakup for each item let tax_detail = tax.item_wise_tax_detail; - - let key = item.item_code; - if(item.item_name && !Object.keys(tax_detail).includes(item.item_name)) { - key = item.item_name; - } + let key = item.item_code || item.item_name; let item_wise_tax_amount = current_tax_amount * this.frm.doc.conversion_rate; if (tax_detail && tax_detail[key]) From ba1cdc6c5773c782fc987c35645e1e55d29031bf Mon Sep 17 00:00:00 2001 From: Zarrar Date: Tue, 19 Jun 2018 10:45:47 +0530 Subject: [PATCH 07/11] fix opening invoice related authorization control - item=None (#14567) --- .../doctype/authorization_control/authorization_control.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/erpnext/setup/doctype/authorization_control/authorization_control.py b/erpnext/setup/doctype/authorization_control/authorization_control.py index 2240e0c28b..b419850b0b 100644 --- a/erpnext/setup/doctype/authorization_control/authorization_control.py +++ b/erpnext/setup/doctype/authorization_control/authorization_control.py @@ -40,7 +40,7 @@ class AuthorizationControl(TransactionBase): chk = 1 add_cond1,add_cond2 = '','' if based_on == 'Itemwise Discount': - add_cond1 += " and master_name = '"+cstr(frappe.db.escape(item)).replace("'", "\\'")+"'" + add_cond1 += " and master_name = '"+frappe.db.escape(cstr(item))+"'" itemwise_exists = frappe.db.sql("""select value from `tabAuthorization Rule` where transaction = %s and value <= %s and based_on = %s and company = %s and docstatus != 2 %s %s""" % From a125a6199c0a829345eea322045650b83f2cb3de Mon Sep 17 00:00:00 2001 From: Nabin Hait Date: Tue, 19 Jun 2018 12:06:48 +0530 Subject: [PATCH 08/11] Allowed paid amount against debit/credit note --- erpnext/accounts/doctype/payment_entry/payment_entry.js | 4 ++++ erpnext/accounts/doctype/payment_entry/payment_entry.py | 5 +++-- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/erpnext/accounts/doctype/payment_entry/payment_entry.js b/erpnext/accounts/doctype/payment_entry/payment_entry.js index 776bacfcce..fc3eed36e9 100644 --- a/erpnext/accounts/doctype/payment_entry/payment_entry.js +++ b/erpnext/accounts/doctype/payment_entry/payment_entry.js @@ -588,6 +588,10 @@ frappe.ui.form.on('Payment Entry', { allocate_party_amount_against_ref_docs: function(frm, paid_amount) { var total_positive_outstanding_including_order = 0; var total_negative_outstanding = 0; + var total_deductions = frappe.utils.sum($.map(frm.doc.deductions || [], + function(d) { return flt(d.amount) })); + + paid_amount -= total_deductions; $.each(frm.doc.references || [], function(i, row) { if(flt(row.outstanding_amount) > 0) diff --git a/erpnext/accounts/doctype/payment_entry/payment_entry.py b/erpnext/accounts/doctype/payment_entry/payment_entry.py index 2f8e6b83a2..4e998596b0 100644 --- a/erpnext/accounts/doctype/payment_entry/payment_entry.py +++ b/erpnext/accounts/doctype/payment_entry/payment_entry.py @@ -337,14 +337,15 @@ class PaymentEntry(AccountsController): total_negative_outstanding = sum([abs(flt(d.outstanding_amount)) for d in self.get("references") if flt(d.outstanding_amount) < 0]) - party_amount = self.paid_amount if self.payment_type=="Receive" else self.received_amount + paid_amount = self.paid_amount if self.payment_type=="Receive" else self.received_amount + additional_charges = sum([flt(d.amount) for d in self.deductions]) if not total_negative_outstanding: frappe.throw(_("Cannot {0} {1} {2} without any negative outstanding invoice") .format(self.payment_type, ("to" if self.party_type=="Customer" else "from"), self.party_type), InvalidPaymentEntry) - elif party_amount > total_negative_outstanding: + elif paid_amount - additional_charges > total_negative_outstanding: frappe.throw(_("Paid Amount cannot be greater than total negative outstanding amount {0}") .format(total_negative_outstanding), InvalidPaymentEntry) From 42f2d1a7a8b88a76679ccbfbbec9b7ca41974a3a Mon Sep 17 00:00:00 2001 From: Zarrar Date: Wed, 20 Jun 2018 10:50:11 +0530 Subject: [PATCH 09/11] fix incase no customer fetched (#14596) --- erpnext/projects/doctype/timesheet/timesheet.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/erpnext/projects/doctype/timesheet/timesheet.py b/erpnext/projects/doctype/timesheet/timesheet.py index 98e961d97f..d2f18682a0 100644 --- a/erpnext/projects/doctype/timesheet/timesheet.py +++ b/erpnext/projects/doctype/timesheet/timesheet.py @@ -420,9 +420,10 @@ def get_timesheets_list(doctype, txt, filters, limit_start, limit_page_length=20 # find customer name from contact. customer = frappe.db.sql('''SELECT dl.link_name FROM `tabContact` AS c inner join \ `tabDynamic Link` AS dl ON c.first_name=dl.link_name WHERE c.email_id=%s''',user) - # find list of Sales Invoice for made for customer. - sales_invoice = frappe.db.sql('''SELECT name FROM `tabSales Invoice` WHERE customer = %s''',customer) + if customer: + # find list of Sales Invoice for made for customer. + sales_invoice = frappe.db.sql('''SELECT name FROM `tabSales Invoice` WHERE customer = %s''',customer) # Return timesheet related data to web portal. return frappe. db.sql('''SELECT ts.name, tsd.activity_type, ts.status, ts.total_billable_hours, \ tsd.sales_invoice, tsd.project FROM `tabTimesheet` AS ts inner join `tabTimesheet Detail` \ From 99017b173d89d26c82fd3d9a8fd8c2758bfe6759 Mon Sep 17 00:00:00 2001 From: Zarrar Date: Wed, 20 Jun 2018 14:53:13 +0530 Subject: [PATCH 10/11] naming for asset maintenance task should be task name (#14607) --- .../doctype/asset_maintenance_task/asset_maintenance_task.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/erpnext/assets/doctype/asset_maintenance_task/asset_maintenance_task.py b/erpnext/assets/doctype/asset_maintenance_task/asset_maintenance_task.py index 2a5666d506..d98cc310b3 100644 --- a/erpnext/assets/doctype/asset_maintenance_task/asset_maintenance_task.py +++ b/erpnext/assets/doctype/asset_maintenance_task/asset_maintenance_task.py @@ -7,4 +7,5 @@ import frappe from frappe.model.document import Document class AssetMaintenanceTask(Document): - pass + def autoname(self): + self.name = self.maintenance_task From 98b7bb5679f1900a98c04f7bb44bb570b582f63a Mon Sep 17 00:00:00 2001 From: Saurabh Date: Wed, 20 Jun 2018 15:51:40 +0600 Subject: [PATCH 11/11] bumped to version 10.1.39 --- erpnext/__init__.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/erpnext/__init__.py b/erpnext/__init__.py index 3492977e79..d6d575785d 100644 --- a/erpnext/__init__.py +++ b/erpnext/__init__.py @@ -5,7 +5,7 @@ import frappe from erpnext.hooks import regional_overrides from frappe.utils import getdate -__version__ = '10.1.38' +__version__ = '10.1.39' def get_default_company(user=None): '''Get default company for user'''