From 4bbad7f44819bb9a2db2163879fb8cedfcd83871 Mon Sep 17 00:00:00 2001 From: viralkansodiya15 <98073516+viralpatel15@users.noreply.github.com> Date: Thu, 26 Oct 2023 11:45:47 +0530 Subject: [PATCH 1/3] fix: set docstatus filter to ignore cancel document --- .../stock/doctype/landed_cost_voucher/landed_cost_voucher.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/erpnext/stock/doctype/landed_cost_voucher/landed_cost_voucher.py b/erpnext/stock/doctype/landed_cost_voucher/landed_cost_voucher.py index 7f0dc2df9f..5e35c16365 100644 --- a/erpnext/stock/doctype/landed_cost_voucher/landed_cost_voucher.py +++ b/erpnext/stock/doctype/landed_cost_voucher/landed_cost_voucher.py @@ -205,7 +205,7 @@ class LandedCostVoucher(Document): ) docs = frappe.db.get_all( "Asset", - filters={receipt_document_type: item.receipt_document, "item_code": item.item_code}, + filters={receipt_document_type: item.receipt_document, "item_code": item.item_code, "docstatus":['!=', 2]}, fields=["name", "docstatus"], ) if not docs or len(docs) != item.qty: From de58c679918229c15925cd3257cc5ddbc7c20473 Mon Sep 17 00:00:00 2001 From: viralkansodiya15 <98073516+viralpatel15@users.noreply.github.com> Date: Mon, 30 Oct 2023 10:44:17 +0530 Subject: [PATCH 2/3] fix: linter test solve --- .../landed_cost_voucher/landed_cost_voucher.py | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/erpnext/stock/doctype/landed_cost_voucher/landed_cost_voucher.py b/erpnext/stock/doctype/landed_cost_voucher/landed_cost_voucher.py index 5e35c16365..69b4cc1cf1 100644 --- a/erpnext/stock/doctype/landed_cost_voucher/landed_cost_voucher.py +++ b/erpnext/stock/doctype/landed_cost_voucher/landed_cost_voucher.py @@ -204,10 +204,14 @@ class LandedCostVoucher(Document): "purchase_invoice" if item.receipt_document_type == "Purchase Invoice" else "purchase_receipt" ) docs = frappe.db.get_all( - "Asset", - filters={receipt_document_type: item.receipt_document, "item_code": item.item_code, "docstatus":['!=', 2]}, - fields=["name", "docstatus"], - ) + "Asset", ++ filters={ ++ receipt_document_type: item.receipt_document, ++ "item_code": item.item_code, ++ "docstatus": ["!=", 2], ++ }, + fields=["name", "docstatus"], + ) if not docs or len(docs) != item.qty: frappe.throw( _( From a15484fe3d38923b2e4ae3128b475ea1b6fa364c Mon Sep 17 00:00:00 2001 From: viralkansodiya15 <98073516+viralpatel15@users.noreply.github.com> Date: Mon, 30 Oct 2023 13:01:25 +0530 Subject: [PATCH 3/3] fix: solve linter test and update --- .../landed_cost_voucher/landed_cost_voucher.py | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/erpnext/stock/doctype/landed_cost_voucher/landed_cost_voucher.py b/erpnext/stock/doctype/landed_cost_voucher/landed_cost_voucher.py index 69b4cc1cf1..8bbc660899 100644 --- a/erpnext/stock/doctype/landed_cost_voucher/landed_cost_voucher.py +++ b/erpnext/stock/doctype/landed_cost_voucher/landed_cost_voucher.py @@ -204,14 +204,14 @@ class LandedCostVoucher(Document): "purchase_invoice" if item.receipt_document_type == "Purchase Invoice" else "purchase_receipt" ) docs = frappe.db.get_all( - "Asset", -+ filters={ -+ receipt_document_type: item.receipt_document, -+ "item_code": item.item_code, -+ "docstatus": ["!=", 2], -+ }, - fields=["name", "docstatus"], - ) + "Asset", + filters={ + receipt_document_type: item.receipt_document, + "item_code": item.item_code, + "docstatus": ["!=", 2], + }, + fields=["name", "docstatus"], + ) if not docs or len(docs) != item.qty: frappe.throw( _(