From e796d2844c9d14612658a7bf9df12153aec56252 Mon Sep 17 00:00:00 2001 From: Deepesh Garg <42651287+deepeshgarg007@users.noreply.github.com> Date: Fri, 17 May 2019 15:39:22 +0530 Subject: [PATCH 1/4] fix: Unable to create item variant based on manufacturer (#17652) * fix: Unable to create item variant against manufacturer * fix: Spacing fixes * fix: Spacing fixes in item.js --- erpnext/stock/doctype/item/item.js | 42 ++++++++++++++++++------------ 1 file changed, 25 insertions(+), 17 deletions(-) diff --git a/erpnext/stock/doctype/item/item.js b/erpnext/stock/doctype/item/item.js index 42c84da933..bfc5e6d438 100644 --- a/erpnext/stock/doctype/item/item.js +++ b/erpnext/stock/doctype/item/item.js @@ -375,10 +375,18 @@ $.extend(erpnext.item, { show_modal_for_manufacturers: function(frm) { var dialog = new frappe.ui.Dialog({ fields: [ - {fieldtype:'Link', options:'Manufacturer', - reqd:1, label:'Manufacturer'}, - {fieldtype:'Data', label:'Manufacturer Part Number', - fieldname: 'manufacturer_part_no'}, + { + fieldtype: 'Link', + fieldname: 'manufacturer', + options: 'Manufacturer', + label: 'Manufacturer', + reqd: 1, + }, + { + fieldtype: 'Data', + label: 'Manufacturer Part Number', + fieldname: 'manufacturer_part_no' + }, ] }); @@ -389,7 +397,7 @@ $.extend(erpnext.item, { // call the server to make the variant data.template = frm.doc.name; frappe.call({ - method:"erpnext.controllers.item_variant.get_variant", + method: "erpnext.controllers.item_variant.get_variant", args: data, callback: function(r) { var doclist = frappe.model.sync(r.message); @@ -464,7 +472,7 @@ $.extend(erpnext.item, { me.multiple_variant_dialog.hide(); frappe.call({ - method:"erpnext.controllers.item_variant.enqueue_multiple_variant_creation", + method: "erpnext.controllers.item_variant.enqueue_multiple_variant_creation", args: { "item": frm.doc.name, "args": selected_attributes @@ -514,9 +522,9 @@ $.extend(erpnext.item, { let p = new Promise(resolve => { if(!d.numeric_values) { frappe.call({ - method:"frappe.client.get_list", - args:{ - doctype:"Item Attribute Value", + method: "frappe.client.get_list", + args: { + doctype: "Item Attribute Value", filters: [ ["parent","=", d.attribute] ], @@ -534,9 +542,9 @@ $.extend(erpnext.item, { }); } else { frappe.call({ - method:"frappe.client.get", - args:{ - doctype:"Item Attribute", + method: "frappe.client.get", + args: { + doctype: "Item Attribute", name: d.attribute } }).then((r) => { @@ -599,7 +607,7 @@ $.extend(erpnext.item, { var args = d.get_values(); if(!args) return; frappe.call({ - method:"erpnext.controllers.item_variant.get_variant", + method: "erpnext.controllers.item_variant.get_variant", btn: d.get_primary_btn(), args: { "template": frm.doc.name, @@ -622,7 +630,7 @@ $.extend(erpnext.item, { } else { d.hide(); frappe.call({ - method:"erpnext.controllers.item_variant.create_variant", + method: "erpnext.controllers.item_variant.create_variant", args: { "item": frm.doc.name, "args": d.get_values() @@ -660,8 +668,8 @@ $.extend(erpnext.item, { .on('input', function(e) { var term = e.target.value; frappe.call({ - method:"erpnext.stock.doctype.item.item.get_item_attribute", - args:{ + method: "erpnext.stock.doctype.item.item.get_item_attribute", + args: { parent: i, attribute_value: term }, @@ -723,7 +731,7 @@ frappe.ui.form.on("UOM Conversion Detail", { var row = locals[cdt][cdn]; if (row.uom) { frappe.call({ - method:"erpnext.stock.doctype.item.item.get_uom_conv_factor", + method: "erpnext.stock.doctype.item.item.get_uom_conv_factor", args: { "uom": row.uom, "stock_uom": frm.doc.stock_uom From a4c9134d332dda02ea73ffa80593a83c1d6476a2 Mon Sep 17 00:00:00 2001 From: deepeshgarg007 Date: Fri, 17 May 2019 15:39:23 +0530 Subject: [PATCH 2/4] fix: Inactive Sales Item report fixes --- .../inactive_sales_items/inactive_sales_items.py | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/erpnext/accounts/report/inactive_sales_items/inactive_sales_items.py b/erpnext/accounts/report/inactive_sales_items/inactive_sales_items.py index b670e6e91f..7dea80cbe2 100644 --- a/erpnext/accounts/report/inactive_sales_items/inactive_sales_items.py +++ b/erpnext/accounts/report/inactive_sales_items/inactive_sales_items.py @@ -28,7 +28,7 @@ def get_columns(): "width": 150 }, { - "fieldname": "item_name", + "fieldname": "item", "fieldtype": "Link", "options": "Item", "label": "Item", @@ -82,12 +82,12 @@ def get_data(filters): row = { "territory": territory.name, "item_group": item.item_group, - "item": item.name, + "item": item.item_code, "item_name": item.item_name } - if sales_invoice_data.get((territory.name,item.name)): - item_obj = sales_invoice_data[(territory.name,item.name)] + if sales_invoice_data.get((territory.name,item.item_code)): + item_obj = sales_invoice_data[(territory.name,item.item_code)] if item_obj.days_since_last_order > cint(filters['days']): row.update({ "territory": item_obj.territory, @@ -111,15 +111,15 @@ def get_sales_details(filters): date_field = "s.transaction_date" if filters["based_on"] == "Sales Order" else "s.posting_date" sales_data = frappe.db.sql(""" - select s.territory, s.customer, si.item_group, si.item_name, si.qty, {date_field} as last_order_date, + select s.territory, s.customer, si.item_group, si.item_code, si.qty, {date_field} as last_order_date, DATEDIFF(CURDATE(), {date_field}) as days_since_last_order from `tab{doctype}` s, `tab{doctype} Item` si where s.name = si.parent and s.docstatus = 1 - group by si.name order by days_since_last_order """ #nosec + order by days_since_last_order """ #nosec .format(date_field = date_field, doctype = filters['based_on']), as_dict=1) for d in sales_data: - item_details_map.setdefault((d.territory,d.item_name), d) + item_details_map.setdefault((d.territory,d.item_code), d) return item_details_map @@ -149,6 +149,6 @@ def get_items(filters): "name": filters["item"] }) - items = frappe.get_all("Item", fields=["name", "item_group", "item_name"], filters=filters_dict, order_by="name") + items = frappe.get_all("Item", fields=["name", "item_group", "item_name", "item_code"], filters=filters_dict, order_by="name") return items From 249d47cd1c60a6145a6031dfdd13e79cfe0a247c Mon Sep 17 00:00:00 2001 From: Rushabh Mehta Date: Sat, 18 May 2019 10:53:01 +0530 Subject: [PATCH 3/4] fix(readme): logo URL --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index b1979d0045..db8dd7904d 100644 --- a/README.md +++ b/README.md @@ -1,5 +1,5 @@
- +

ERPNext

ERP made simple

From fc86df64532dfd63d01d27ba2ba99b0e0720a530 Mon Sep 17 00:00:00 2001 From: Anurag Mishra <32095923+Anurag810@users.noreply.github.com> Date: Sat, 18 May 2019 13:03:08 +0530 Subject: [PATCH 4/4] fix: Allow return if delivery note or sales order is required in selling settings(v12) (#17631) * fix: Allow retrun if delivery note or sales order is required in selling settings * fix: combined condition * style: refactor --- erpnext/accounts/doctype/sales_invoice/sales_invoice.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/erpnext/accounts/doctype/sales_invoice/sales_invoice.py b/erpnext/accounts/doctype/sales_invoice/sales_invoice.py index ae253cc2f3..20b5fb391e 100644 --- a/erpnext/accounts/doctype/sales_invoice/sales_invoice.py +++ b/erpnext/accounts/doctype/sales_invoice/sales_invoice.py @@ -501,12 +501,15 @@ class SalesInvoice(SellingController): def so_dn_required(self): """check in manage account if sales order / delivery note required or not.""" + if self.is_return: + return dic = {'Sales Order':['so_required', 'is_pos'],'Delivery Note':['dn_required', 'update_stock']} for i in dic: if frappe.db.get_single_value('Selling Settings', dic[i][0]) == 'Yes': for d in self.get('items'): - if (d.item_code and frappe.get_cached_value('Item', d.item_code, 'is_stock_item') == 1 - and not d.get(i.lower().replace(' ','_')) and not self.get(dic[i][1])): + is_stock_item = frappe.get_cached_value('Item', d.item_code, 'is_stock_item') + if d.item_code and is_stock_item == 1\ + and not d.get(i.lower().replace(' ','_')) and not self.get(dic[i][1]): msgprint(_("{0} is mandatory for Item {1}").format(i,d.item_code), raise_exception=1)