From 37d3686372519b9d0b4a3693391b9dffccb48159 Mon Sep 17 00:00:00 2001 From: Shreya Shah Date: Mon, 8 Oct 2018 14:17:16 +0530 Subject: [PATCH 1/4] fix(setup_taxes): Pop if frappe.message_log (#15615) --- erpnext/setup/setup_wizard/operations/taxes_setup.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/erpnext/setup/setup_wizard/operations/taxes_setup.py b/erpnext/setup/setup_wizard/operations/taxes_setup.py index dd5c0372e4..50bea41301 100644 --- a/erpnext/setup/setup_wizard/operations/taxes_setup.py +++ b/erpnext/setup/setup_wizard/operations/taxes_setup.py @@ -50,7 +50,7 @@ def make_tax_account(company, account_name, tax_rate): "tax_rate": flt(tax_rate) if tax_rate else None }).insert(ignore_permissions=True, ignore_mandatory=True) except frappe.NameError: - frappe.message_log.pop() + if frappe.message_log: frappe.message_log.pop() abbr = frappe.db.get_value('Company', company, 'abbr') account = '{0} - {1}'.format(account_name, abbr) return frappe.get_doc('Account', account) From 4fb9230d16b339be3c026dd8aaf34e4359966de0 Mon Sep 17 00:00:00 2001 From: Shreya Shah Date: Mon, 8 Oct 2018 14:18:03 +0530 Subject: [PATCH 2/4] Add missing method link_to_mrs to buying.js (#15613) --- erpnext/public/js/controllers/buying.js | 63 +++++++++++++++++++++++++ 1 file changed, 63 insertions(+) diff --git a/erpnext/public/js/controllers/buying.js b/erpnext/public/js/controllers/buying.js index 11655e9218..7065794369 100644 --- a/erpnext/public/js/controllers/buying.js +++ b/erpnext/public/js/controllers/buying.js @@ -227,6 +227,69 @@ erpnext.buying.BuyingController = erpnext.TransactionController.extend({ tc_name: function() { this.get_terms(); + }, + + link_to_mrs: function() { + var my_items = []; + for (var i in cur_frm.doc.items) { + if(!cur_frm.doc.items[i].material_request){ + my_items.push(cur_frm.doc.items[i].item_code); + } + } + frappe.call({ + method: "erpnext.buying.utils.get_linked_material_requests", + args:{ + items: my_items + }, + callback: function(r) { + if(!r.message) { + frappe.throw(__("No pending Material Requests found to link for the given items.")) + } + else { + var i = 0; + var item_length = cur_frm.doc.items.length; + while (i < item_length) { + var qty = cur_frm.doc.items[i].qty; + (r.message[0] || []).forEach(function(d) { + if (d.qty > 0 && qty > 0 && cur_frm.doc.items[i].item_code == d.item_code && !cur_frm.doc.items[i].material_request_item) + { + cur_frm.doc.items[i].material_request = d.mr_name; + cur_frm.doc.items[i].material_request_item = d.mr_item; + var my_qty = Math.min(qty, d.qty); + qty = qty - my_qty; + d.qty = d.qty - my_qty; + cur_frm.doc.items[i].stock_qty = my_qty*cur_frm.doc.items[i].conversion_factor; + cur_frm.doc.items[i].qty = my_qty; + + frappe.msgprint("Assigning " + d.mr_name + " to " + d.item_code + " (row " + cur_frm.doc.items[i].idx + ")"); + if (qty > 0) + { + frappe.msgprint("Splitting " + qty + " units of " + d.item_code); + var newrow = frappe.model.add_child(cur_frm.doc, cur_frm.doc.items[i].doctype, "items"); + item_length++; + + for (var key in cur_frm.doc.items[i]) + { + newrow[key] = cur_frm.doc.items[i][key]; + } + + newrow.idx = item_length; + newrow["stock_qty"] = newrow.conversion_factor*qty; + newrow["qty"] = qty; + + newrow["material_request"] = ""; + newrow["material_request_item"] = ""; + + } + } + }); + i++; + } + refresh_field("items"); + //cur_frm.save(); + } + } + }); } }); From 5fcccda883059e68b5ef83f25f1b4819769ac80c Mon Sep 17 00:00:00 2001 From: Zarrar Date: Mon, 8 Oct 2018 14:30:53 +0530 Subject: [PATCH 3/4] [Minor] Supplier Quotation (#15578) * throw meaningful error if RFQ does not have selected supplier * Update supplier_quotation.py * codacy fix --- .../doctype/supplier_quotation/supplier_quotation.py | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/erpnext/buying/doctype/supplier_quotation/supplier_quotation.py b/erpnext/buying/doctype/supplier_quotation/supplier_quotation.py index b221a08959..5b4356a747 100644 --- a/erpnext/buying/doctype/supplier_quotation/supplier_quotation.py +++ b/erpnext/buying/doctype/supplier_quotation/supplier_quotation.py @@ -60,7 +60,12 @@ class SupplierQuotation(BuyingController): for rfq in rfq_list: doc = frappe.get_doc('Request for Quotation', rfq) doc_sup = frappe.get_all('Request for Quotation Supplier', filters= - {'parent': doc.name, 'supplier': self.supplier}, fields=['name', 'quote_status'])[0] + {'parent': doc.name, 'supplier': self.supplier}, fields=['name', 'quote_status']) + + doc_sup = doc_sup[0] if doc_sup else None + if not doc_sup: + frappe.throw(_("Supplier {0} not found in {1}").format(self.supplier, + " Request for Quotation {0} ".format(doc.name))) quote_status = _('Received') for item in doc.items: @@ -152,4 +157,4 @@ def make_quotation(source_name, target_doc=None): } }, target_doc) - return doclist \ No newline at end of file + return doclist From b509b06edf0d0b3b4467e39c0f531a497ddd20d1 Mon Sep 17 00:00:00 2001 From: Ameya Shenoy Date: Mon, 8 Oct 2018 09:37:37 +0000 Subject: [PATCH 4/4] bumped to version 10.1.57 --- erpnext/__init__.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/erpnext/__init__.py b/erpnext/__init__.py index ca6d6bef8b..0457b7e477 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.56' +__version__ = '10.1.57' def get_default_company(user=None): '''Get default company for user'''