From 89b0e5023a8c7f1d6466f148611a56f95416676d Mon Sep 17 00:00:00 2001 From: "mergify[bot]" <37929162+mergify[bot]@users.noreply.github.com> Date: Fri, 29 Oct 2021 15:40:14 +0530 Subject: [PATCH 01/19] fix: Skip empty rows while updating unsaved BOM cost (#28136) (#28141) - Dont try to get valuation rate if row has no item code - Dont try to add exploded items if row has no item code (cherry picked from commit 292419bc9ebc405ef8a4861125070abb0d321db1) Co-authored-by: Marica --- erpnext/manufacturing/doctype/bom/bom.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/erpnext/manufacturing/doctype/bom/bom.py b/erpnext/manufacturing/doctype/bom/bom.py index 0d324eb2070..9fddc0a33dd 100644 --- a/erpnext/manufacturing/doctype/bom/bom.py +++ b/erpnext/manufacturing/doctype/bom/bom.py @@ -240,6 +240,9 @@ class BOM(WebsiteGenerator): existing_bom_cost = self.total_cost for d in self.get("items"): + if not d.item_code: + continue + rate = self.get_rm_rate({ "company": self.company, "item_code": d.item_code, @@ -549,7 +552,7 @@ class BOM(WebsiteGenerator): for d in self.get('items'): if d.bom_no: self.get_child_exploded_items(d.bom_no, d.stock_qty) - else: + elif d.item_code: self.add_to_cur_exploded_items(frappe._dict({ 'item_code' : d.item_code, 'item_name' : d.item_name, From ba537b0b93a0d14459310d47c282b7c6b6d51e0e Mon Sep 17 00:00:00 2001 From: Ankush Menat Date: Fri, 29 Oct 2021 15:41:55 +0530 Subject: [PATCH 02/19] fix: py2 string formatting --- erpnext/patches/v11_0/rename_bom_wo_fields.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/erpnext/patches/v11_0/rename_bom_wo_fields.py b/erpnext/patches/v11_0/rename_bom_wo_fields.py index 55dce6355cd..f055f9450c1 100644 --- a/erpnext/patches/v11_0/rename_bom_wo_fields.py +++ b/erpnext/patches/v11_0/rename_bom_wo_fields.py @@ -7,7 +7,7 @@ from frappe.model.utils.rename_field import rename_field def execute(): # updating column value to handle field change from Data to Currency - frappe.db.sql(f"update `tabBOM` set base_scrap_material_cost = '0' where trim(coalesce(base_scrap_material_cost, ''))= ''") + frappe.db.sql("update `tabBOM` set base_scrap_material_cost = '0' where trim(coalesce(base_scrap_material_cost, ''))= ''") for doctype in ['BOM Explosion Item', 'BOM Item', 'Work Order Item', 'Item']: if frappe.db.has_column(doctype, 'allow_transfer_for_manufacture'): From 55aaefb53c0963b974aedb318dc08b3c251f762f Mon Sep 17 00:00:00 2001 From: marination Date: Tue, 2 Nov 2021 15:49:58 +0530 Subject: [PATCH 03/19] fix: Remove warehouse filter on Batch field for Material Receipt (cherry picked from commit 048210a8f67fe0544216361d7342619581318570) --- erpnext/stock/doctype/stock_entry/stock_entry.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/erpnext/stock/doctype/stock_entry/stock_entry.js b/erpnext/stock/doctype/stock_entry/stock_entry.js index 85750cf40f5..db11f1afc5e 100644 --- a/erpnext/stock/doctype/stock_entry/stock_entry.js +++ b/erpnext/stock/doctype/stock_entry/stock_entry.js @@ -78,7 +78,9 @@ frappe.ui.form.on('Stock Entry', { } } - filters["warehouse"] = item.s_warehouse || item.t_warehouse; + if (frm.doc.purpose != "Material Receipt") { + filters["warehouse"] = item.s_warehouse || item.t_warehouse; + } return { query : "erpnext.controllers.queries.get_batch_no", From bf5f0a226e55e9c4e1362d0241731dbadb1fc78f Mon Sep 17 00:00:00 2001 From: marination Date: Tue, 2 Nov 2021 15:57:41 +0530 Subject: [PATCH 04/19] chore: Add comment above fix for future reference (cherry picked from commit 48886ee70524132d1f4cf6751b56ccbc96d765a5) --- erpnext/stock/doctype/stock_entry/stock_entry.js | 2 ++ 1 file changed, 2 insertions(+) diff --git a/erpnext/stock/doctype/stock_entry/stock_entry.js b/erpnext/stock/doctype/stock_entry/stock_entry.js index db11f1afc5e..0db796210a7 100644 --- a/erpnext/stock/doctype/stock_entry/stock_entry.js +++ b/erpnext/stock/doctype/stock_entry/stock_entry.js @@ -78,6 +78,8 @@ frappe.ui.form.on('Stock Entry', { } } + // User could want to select a manually created empty batch (no warehouse) + // or a pre-existing batch if (frm.doc.purpose != "Material Receipt") { filters["warehouse"] = item.s_warehouse || item.t_warehouse; } From 117718d410fb0a2b1d472a8934d5ff4b821b74ba Mon Sep 17 00:00:00 2001 From: "mergify[bot]" <37929162+mergify[bot]@users.noreply.github.com> Date: Tue, 2 Nov 2021 23:09:44 +0530 Subject: [PATCH 05/19] fix: ignore unsupported methods while resyncing (#28210) (#28211) (cherry picked from commit 72a050fb0b5289f25f0a6a3ebc314e1671e56c11) Co-authored-by: Ankush Menat --- .../erpnext_integrations/doctype/shopify_log/shopify_log.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/erpnext/erpnext_integrations/doctype/shopify_log/shopify_log.py b/erpnext/erpnext_integrations/doctype/shopify_log/shopify_log.py index a2b6af99b21..fb3b244a15c 100644 --- a/erpnext/erpnext_integrations/doctype/shopify_log/shopify_log.py +++ b/erpnext/erpnext_integrations/doctype/shopify_log/shopify_log.py @@ -64,5 +64,8 @@ def dump_request_data(data, event="create/order"): @frappe.whitelist() def resync(method, name, request_data): frappe.db.set_value("Shopify Log", name, "status", "Queued", update_modified=False) + if not method.startswith("erpnext.erpnext_integrations.connectors.shopify_connection"): + return + frappe.enqueue(method=method, queue='short', timeout=300, is_async=True, **{"order": json.loads(request_data), "request_id": name}) From 97544e2bbcd271215306772a40c01bdaeccf6350 Mon Sep 17 00:00:00 2001 From: Anuja Pawar Date: Fri, 22 Oct 2021 19:26:31 +0530 Subject: [PATCH 06/19] fix: check if gst_category exist (cherry picked from commit 59c31bb124048a0bbf203311ff7e4ce09feadb28) --- erpnext/regional/india/utils.py | 24 +++++++++++++----------- 1 file changed, 13 insertions(+), 11 deletions(-) diff --git a/erpnext/regional/india/utils.py b/erpnext/regional/india/utils.py index 5685c174737..ca9ab014019 100644 --- a/erpnext/regional/india/utils.py +++ b/erpnext/regional/india/utils.py @@ -30,12 +30,13 @@ def validate_gstin_for_india(doc, method): gst_category = [] - if len(doc.links): - link_doctype = doc.links[0].get("link_doctype") - link_name = doc.links[0].get("link_name") + if hasattr(doc, 'gst_category'): + if len(doc.links): + link_doctype = doc.links[0].get("link_doctype") + link_name = doc.links[0].get("link_name") - if link_doctype in ["Customer", "Supplier"]: - gst_category = frappe.db.get_value(link_doctype, {'name': link_name}, ['gst_category']) + if link_doctype in ["Customer", "Supplier"]: + gst_category = frappe.db.get_value(link_doctype, {'name': link_name}, ['gst_category']) doc.gstin = doc.gstin.upper().strip() if not doc.gstin or doc.gstin == 'NA': @@ -66,12 +67,13 @@ def validate_tax_category(doc, method): frappe.throw(_("Intra State tax category for GST State {0} already exists").format(doc.gst_state)) def update_gst_category(doc, method): - for link in doc.links: - if link.link_doctype in ['Customer', 'Supplier']: - if doc.get('gstin'): - frappe.db.sql(""" - UPDATE `tab{0}` SET gst_category = %s WHERE name = %s AND gst_category = 'Unregistered' - """.format(link.link_doctype), ("Registered Regular", link.link_name)) #nosec + if hasattr(doc, 'gst_category'): + for link in doc.links: + if link.link_doctype in ['Customer', 'Supplier']: + if doc.get('gstin'): + frappe.db.sql(""" + UPDATE `tab{0}` SET gst_category = %s WHERE name = %s AND gst_category = 'Unregistered' + """.format(link.link_doctype), ("Registered Regular", link.link_name)) #nosec def set_gst_state_and_state_number(doc): if not doc.gst_state: From f76139dceb52665133a6e8e04943a6121755d494 Mon Sep 17 00:00:00 2001 From: Anuja Pawar Date: Fri, 22 Oct 2021 20:43:54 +0530 Subject: [PATCH 07/19] fix: sider (cherry picked from commit 4f538376243647b779b0b35a2017264881d4ed41) --- erpnext/regional/india/utils.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/erpnext/regional/india/utils.py b/erpnext/regional/india/utils.py index ca9ab014019..2b236f829d2 100644 --- a/erpnext/regional/india/utils.py +++ b/erpnext/regional/india/utils.py @@ -73,7 +73,7 @@ def update_gst_category(doc, method): if doc.get('gstin'): frappe.db.sql(""" UPDATE `tab{0}` SET gst_category = %s WHERE name = %s AND gst_category = 'Unregistered' - """.format(link.link_doctype), ("Registered Regular", link.link_name)) #nosec + """.format(link.link_doctype), ("Registered Regular", link.link_name)) #nosec def set_gst_state_and_state_number(doc): if not doc.gst_state: From 8c84d6a1d9e6e8e1ef72dbb456869ea6b25e3a03 Mon Sep 17 00:00:00 2001 From: Anuja Pawar Date: Fri, 22 Oct 2021 20:44:49 +0530 Subject: [PATCH 08/19] fix: sider (cherry picked from commit 6a3bd882b42f62db4404841b4e338ead938b7417) --- erpnext/regional/india/utils.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/erpnext/regional/india/utils.py b/erpnext/regional/india/utils.py index 2b236f829d2..77926fa01d2 100644 --- a/erpnext/regional/india/utils.py +++ b/erpnext/regional/india/utils.py @@ -72,8 +72,8 @@ def update_gst_category(doc, method): if link.link_doctype in ['Customer', 'Supplier']: if doc.get('gstin'): frappe.db.sql(""" - UPDATE `tab{0}` SET gst_category = %s WHERE name = %s AND gst_category = 'Unregistered' - """.format(link.link_doctype), ("Registered Regular", link.link_name)) #nosec + UPDATE `tab{0}` SET gst_category = %s WHERE name = %s AND gst_category = 'Unregistered' """ + .format(link.link_doctype), ("Registered Regular", link.link_name)) #nosec def set_gst_state_and_state_number(doc): if not doc.gst_state: From fa5e018330b46340f8347806bd7d40a67658d082 Mon Sep 17 00:00:00 2001 From: Anuja Pawar Date: Fri, 29 Oct 2021 21:32:20 +0530 Subject: [PATCH 09/19] fix: re-writing sql query with ORM methods (cherry picked from commit bc1e7bc15fd9e21ed6d4f0438ca649944316bfdc) --- erpnext/regional/india/utils.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/erpnext/regional/india/utils.py b/erpnext/regional/india/utils.py index 77926fa01d2..635ef3c307e 100644 --- a/erpnext/regional/india/utils.py +++ b/erpnext/regional/india/utils.py @@ -71,9 +71,9 @@ def update_gst_category(doc, method): for link in doc.links: if link.link_doctype in ['Customer', 'Supplier']: if doc.get('gstin'): - frappe.db.sql(""" - UPDATE `tab{0}` SET gst_category = %s WHERE name = %s AND gst_category = 'Unregistered' """ - .format(link.link_doctype), ("Registered Regular", link.link_name)) #nosec + gst_category = frappe.db.get_value(link.link_doctype, link.link_name, 'gst_category') + if gst_category == 'Unregistered': + frappe.db.set_value(link.link_doctype, link.link_name, 'gst_category', 'Registered Regular') def set_gst_state_and_state_number(doc): if not doc.gst_state: From 4b1befb691cb6dcd9ee8b9f0fcfce14e18d6407c Mon Sep 17 00:00:00 2001 From: Anuja Pawar Date: Mon, 1 Nov 2021 11:38:02 +0530 Subject: [PATCH 10/19] fix: update set_value query (cherry picked from commit dd3cadd46b28d980154b0f6ccc1204fd5ce4fa66) --- erpnext/regional/india/utils.py | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/erpnext/regional/india/utils.py b/erpnext/regional/india/utils.py index 635ef3c307e..3aa35332857 100644 --- a/erpnext/regional/india/utils.py +++ b/erpnext/regional/india/utils.py @@ -71,9 +71,7 @@ def update_gst_category(doc, method): for link in doc.links: if link.link_doctype in ['Customer', 'Supplier']: if doc.get('gstin'): - gst_category = frappe.db.get_value(link.link_doctype, link.link_name, 'gst_category') - if gst_category == 'Unregistered': - frappe.db.set_value(link.link_doctype, link.link_name, 'gst_category', 'Registered Regular') + frappe.db.set_value(link.link_doctype, { 'name': link.link_name, 'gst_category': 'Unregistered' }, 'gst_category', 'Registered Regular') def set_gst_state_and_state_number(doc): if not doc.gst_state: From d119b4321d6ed6c22985b0346233a0a3d899ddb8 Mon Sep 17 00:00:00 2001 From: Anuja Pawar Date: Tue, 2 Nov 2021 23:29:06 +0530 Subject: [PATCH 11/19] fix: sider (cherry picked from commit f2fbcc81249f0c36a8188bcd09095b48b3e933e1) --- erpnext/regional/india/utils.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/erpnext/regional/india/utils.py b/erpnext/regional/india/utils.py index 3aa35332857..6be2832ec28 100644 --- a/erpnext/regional/india/utils.py +++ b/erpnext/regional/india/utils.py @@ -71,7 +71,7 @@ def update_gst_category(doc, method): for link in doc.links: if link.link_doctype in ['Customer', 'Supplier']: if doc.get('gstin'): - frappe.db.set_value(link.link_doctype, { 'name': link.link_name, 'gst_category': 'Unregistered' }, 'gst_category', 'Registered Regular') + frappe.db.set_value(link.link_doctype, {'name': link.link_name, 'gst_category': 'Unregistered'}, 'gst_category', 'Registered Regular') def set_gst_state_and_state_number(doc): if not doc.gst_state: From 80ba0cf978c1795acdefe8e2ec245bbbe78c721b Mon Sep 17 00:00:00 2001 From: "mergify[bot]" <37929162+mergify[bot]@users.noreply.github.com> Date: Tue, 9 Nov 2021 16:05:37 +0530 Subject: [PATCH 12/19] fix: specify fields to be set in Lead (backport #28288) * fix: specify fields to be set in Lead (#28288) (cherry picked from commit da22744e0fd7e19a6536aa653ebd78a83fafbac1) # Conflicts: # erpnext/shopping_cart/cart.py * fix: merge conflict Co-authored-by: Sagar Vora --- erpnext/shopping_cart/cart.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/erpnext/shopping_cart/cart.py b/erpnext/shopping_cart/cart.py index 891aeb0d609..1c593bc1a36 100644 --- a/erpnext/shopping_cart/cart.py +++ b/erpnext/shopping_cart/cart.py @@ -175,7 +175,9 @@ def add_new_address(doc): def create_lead_for_item_inquiry(lead, subject, message): lead = frappe.parse_json(lead) lead_doc = frappe.new_doc('Lead') - lead_doc.update(lead) + for fieldname in ("lead_name", "company_name", "email_id", "phone"): + lead_doc.set(fieldname, lead.get(fieldname)) + lead_doc.set('lead_owner', '') try: From f79651c54d272dc0685f45b7f01583713d6e1c2a Mon Sep 17 00:00:00 2001 From: "mergify[bot]" <37929162+mergify[bot]@users.noreply.github.com> Date: Fri, 12 Nov 2021 14:10:49 +0530 Subject: [PATCH 13/19] fix(WooCommerce): always expect signature in webhook requests (#28371) (cherry picked from commit 24b048925bb758cad3cb0fa59a571165320132f8) Co-authored-by: Sagar Vora --- .../erpnext_integrations/connectors/woocommerce_connection.py | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/erpnext/erpnext_integrations/connectors/woocommerce_connection.py b/erpnext/erpnext_integrations/connectors/woocommerce_connection.py index 6dedaa8c530..e0fdb36000e 100644 --- a/erpnext/erpnext_integrations/connectors/woocommerce_connection.py +++ b/erpnext/erpnext_integrations/connectors/woocommerce_connection.py @@ -14,8 +14,7 @@ def verify_request(): ) if frappe.request.data and \ - frappe.get_request_header("X-Wc-Webhook-Signature") and \ - not sig == bytes(frappe.get_request_header("X-Wc-Webhook-Signature").encode()): + not sig == frappe.get_request_header("X-Wc-Webhook-Signature", "").encode(): frappe.throw(_("Unverified Webhook Data")) frappe.set_user(woocommerce_settings.creation_user) From d2af2b31e526195280b83fa31b09c761c01302d1 Mon Sep 17 00:00:00 2001 From: "mergify[bot]" <37929162+mergify[bot]@users.noreply.github.com> Date: Fri, 12 Nov 2021 14:53:51 +0530 Subject: [PATCH 14/19] fix: validate hmac unconditionally (#28375) (cherry picked from commit c0f06bc8e382a0543a476f119989f7422a21add0) Co-authored-by: Ankush Menat --- erpnext/erpnext_integrations/utils.py | 1 - 1 file changed, 1 deletion(-) diff --git a/erpnext/erpnext_integrations/utils.py b/erpnext/erpnext_integrations/utils.py index 84f7f5a5d41..ab20e82aa90 100644 --- a/erpnext/erpnext_integrations/utils.py +++ b/erpnext/erpnext_integrations/utils.py @@ -18,7 +18,6 @@ def validate_webhooks_request(doctype, hmac_key, secret_key='secret'): ) if frappe.request.data and \ - frappe.get_request_header(hmac_key) and \ not sig == bytes(frappe.get_request_header(hmac_key).encode()): frappe.throw(_("Unverified Webhook Data")) frappe.set_user(settings.modified_by) From 8e7ee953c1cc31874f422a3c4639a8eda14d730f Mon Sep 17 00:00:00 2001 From: "mergify[bot]" <37929162+mergify[bot]@users.noreply.github.com> Date: Wed, 17 Nov 2021 09:50:18 +0530 Subject: [PATCH 15/19] chore: remove woocommerce package (#25736) (#28424) This is not used anywhere. It was added in this commit https://github.com/frappe/erpnext/commit/df83148d7ccb15ba18b59c7d9b761a3651bb1dec even there it isn't being used. (cherry picked from commit e1ab290911cbdfb62b9150e3c85da8567868d8e5) Co-authored-by: Ankush Menat --- requirements.txt | 1 - 1 file changed, 1 deletion(-) diff --git a/requirements.txt b/requirements.txt index 9f8379c3a9a..6783d72af3f 100644 --- a/requirements.txt +++ b/requirements.txt @@ -7,5 +7,4 @@ plaid-python~=7.2.1 PyGithub==1.44.1 python-stdnum==1.12 Unidecode==1.1.1 -WooCommerce==2.1.1 pycryptodome==3.9.8 From 1b78c501a1c20ab0a9d9c4f72dbdd78b5ef88376 Mon Sep 17 00:00:00 2001 From: "mergify[bot]" <37929162+mergify[bot]@users.noreply.github.com> Date: Fri, 26 Nov 2021 17:36:16 +0530 Subject: [PATCH 16/19] fix: incorrect balance for warehouses (#28583) (#28585) (cherry picked from commit 7ff30a4b2b64df191836f0d7695c7007167fb076) Co-authored-by: Noah Jacob --- .../warehouse_wise_item_balance_age_and_value.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/erpnext/stock/report/warehouse_wise_item_balance_age_and_value/warehouse_wise_item_balance_age_and_value.py b/erpnext/stock/report/warehouse_wise_item_balance_age_and_value/warehouse_wise_item_balance_age_and_value.py index ebcb106b02a..a5628d9b4f7 100644 --- a/erpnext/stock/report/warehouse_wise_item_balance_age_and_value/warehouse_wise_item_balance_age_and_value.py +++ b/erpnext/stock/report/warehouse_wise_item_balance_age_and_value/warehouse_wise_item_balance_age_and_value.py @@ -39,8 +39,8 @@ def execute(filters=None): item_balance.setdefault((item, item_map[item]["item_group"]), []) total_stock_value = 0.00 for wh in warehouse_list: - row += [qty_dict.bal_qty] if wh.name in warehouse else [0.00] - total_stock_value += qty_dict.bal_val if wh.name in warehouse else 0.00 + row += [qty_dict.bal_qty] if wh.name == warehouse else [0.00] + total_stock_value += qty_dict.bal_val if wh.name == warehouse else 0.00 item_balance[(item, item_map[item]["item_group"])].append(row) item_value.setdefault((item, item_map[item]["item_group"]),[]) From 23946cea2e23edf78e9073ddf4bdc429374d1cc4 Mon Sep 17 00:00:00 2001 From: Saqib Date: Mon, 29 Nov 2021 15:13:22 +0530 Subject: [PATCH 17/19] fix: debit & credit currency in bank transaction (#28574) --- .../accounts/doctype/bank_transaction/bank_transaction.json | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/erpnext/accounts/doctype/bank_transaction/bank_transaction.json b/erpnext/accounts/doctype/bank_transaction/bank_transaction.json index 39937bb3645..b63fb5e573b 100644 --- a/erpnext/accounts/doctype/bank_transaction/bank_transaction.json +++ b/erpnext/accounts/doctype/bank_transaction/bank_transaction.json @@ -271,6 +271,7 @@ "label": "Debit", "length": 0, "no_copy": 0, + "options": "currency", "permlevel": 0, "precision": "", "print_hide": 0, @@ -304,6 +305,7 @@ "label": "Credit", "length": 0, "no_copy": 0, + "options": "currency", "permlevel": 0, "precision": "", "print_hide": 0, @@ -632,6 +634,7 @@ "label": "Allocated Amount", "length": 0, "no_copy": 0, + "options": "currency", "permlevel": 0, "precision": "", "print_hide": 0, @@ -731,6 +734,7 @@ "label": "Unallocated Amount", "length": 0, "no_copy": 0, + "options": "currency", "permlevel": 0, "precision": "", "print_hide": 0, @@ -755,7 +759,7 @@ "issingle": 0, "istable": 0, "max_attachments": 0, - "modified": "2019-05-11 05:27:55.244721", + "modified": "2021-11-26 12:44:55.244721", "modified_by": "Administrator", "module": "Accounts", "name": "Bank Transaction", From 1fce25180c595495a18cd3551b8264a54afebc80 Mon Sep 17 00:00:00 2001 From: Ankush Menat Date: Mon, 29 Nov 2021 12:36:47 +0530 Subject: [PATCH 18/19] chore: correct docstrings (cherry picked from commit c7701ace80e5ce62e6a41db170b4e1f461ce970f) --- erpnext/stock/doctype/item/item.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/erpnext/stock/doctype/item/item.py b/erpnext/stock/doctype/item/item.py index bdaa63cd872..917854a3ee0 100644 --- a/erpnext/stock/doctype/item/item.py +++ b/erpnext/stock/doctype/item/item.py @@ -206,10 +206,11 @@ class Item(WebsiteGenerator): 'route')) + '/' + self.scrub((self.item_name if self.item_name else self.item_code) + '-' + random_string(5)) def validate_website_image(self): + """Validate if the website image is a public file""" + if frappe.flags.in_import: return - """Validate if the website image is a public file""" auto_set_website_image = False if not self.website_image and self.image: auto_set_website_image = True @@ -239,10 +240,11 @@ class Item(WebsiteGenerator): self.website_image = None def make_thumbnail(self): + """Make a thumbnail of `website_image`""" + if frappe.flags.in_import: return - """Make a thumbnail of `website_image`""" import requests.exceptions if not self.is_new() and self.website_image != frappe.db.get_value(self.doctype, self.name, "website_image"): From 24c004b53704f48a9289d607fdd6591db87bfd6b Mon Sep 17 00:00:00 2001 From: Ankush Menat Date: Wed, 24 Nov 2021 19:07:39 +0530 Subject: [PATCH 19/19] fix: use get_all instead of get_list for child tables (cherry picked from commit f8623390241affb06f278ef5700aa0294b5cc726) --- .../report/bom_stock_calculated/bom_stock_calculated.py | 2 +- erpnext/regional/report/eway_bill/eway_bill.py | 4 ++-- erpnext/stock/doctype/item/test_item.py | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/erpnext/manufacturing/report/bom_stock_calculated/bom_stock_calculated.py b/erpnext/manufacturing/report/bom_stock_calculated/bom_stock_calculated.py index 40b2e03c92a..c53d3389163 100644 --- a/erpnext/manufacturing/report/bom_stock_calculated/bom_stock_calculated.py +++ b/erpnext/manufacturing/report/bom_stock_calculated/bom_stock_calculated.py @@ -88,7 +88,7 @@ def get_bom_stock(filters): GROUP BY bom_item.item_code""".format(qty_field=qty_field, table=table, conditions=conditions, bom=bom), as_dict=1) def get_manufacturer_records(): - details = frappe.get_list('Item Manufacturer', fields = ["manufacturer", "manufacturer_part_no", "parent"]) + details = frappe.get_all('Item Manufacturer', fields = ["manufacturer", "manufacturer_part_no", "parent"]) manufacture_details = frappe._dict() for detail in details: dic = manufacture_details.setdefault(detail.get('parent'), {}) diff --git a/erpnext/regional/report/eway_bill/eway_bill.py b/erpnext/regional/report/eway_bill/eway_bill.py index 5b9896be2a1..2cafc6d355e 100644 --- a/erpnext/regional/report/eway_bill/eway_bill.py +++ b/erpnext/regional/report/eway_bill/eway_bill.py @@ -104,14 +104,14 @@ def set_address_details(row, special_characters): row.update({'ship_to_state': row.to_state}) def set_taxes(row, filters): - taxes = frappe.get_list("Sales Taxes and Charges", + taxes = frappe.get_all("Sales Taxes and Charges", filters={ 'parent': row.dn_id }, fields=('item_wise_tax_detail', 'account_head')) account_list = ["cgst_account", "sgst_account", "igst_account", "cess_account"] - taxes_list = frappe.get_list("GST Account", + taxes_list = frappe.get_all("GST Account", filters={ "parent": "GST Settings", "company": filters.company diff --git a/erpnext/stock/doctype/item/test_item.py b/erpnext/stock/doctype/item/test_item.py index 5074040d891..0c2d1b1ed57 100644 --- a/erpnext/stock/doctype/item/test_item.py +++ b/erpnext/stock/doctype/item/test_item.py @@ -468,7 +468,7 @@ class TestItem(unittest.TestCase): item_doc.save() # Check values saved correctly - barcodes = frappe.get_list( + barcodes = frappe.get_all( 'Item Barcode', fields=['barcode', 'barcode_type'], filters={'parent': item_code})