From f6418c14ddbee812a0a719aed82dc5599c48ed02 Mon Sep 17 00:00:00 2001 From: "mergify[bot]" <37929162+mergify[bot]@users.noreply.github.com> Date: Thu, 2 Nov 2023 14:02:07 +0530 Subject: [PATCH] fix: `TypeError` in PR for non-stock item (backport #37819) (backport #37841) (#37853) fix: `TypeError` in PR for non-stock item (cherry picked from commit 028b3e2fbf52cdb7561e8d63b54d5918b5bc8af4) (cherry picked from commit ef4471f8c0e2e5018770276d4941e1cbb6d67a50) Co-authored-by: s-aga-r --- erpnext/stock/doctype/purchase_receipt/purchase_receipt.py | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/erpnext/stock/doctype/purchase_receipt/purchase_receipt.py b/erpnext/stock/doctype/purchase_receipt/purchase_receipt.py index cde3dd6d412a..10bd335468d5 100644 --- a/erpnext/stock/doctype/purchase_receipt/purchase_receipt.py +++ b/erpnext/stock/doctype/purchase_receipt/purchase_receipt.py @@ -601,11 +601,10 @@ def make_divisional_loss_gl_entry(item, outgoing_amount): make_rate_difference_entry(d) make_sub_contracting_gl_entries(d) make_divisional_loss_gl_entry(d, outgoing_amount) - elif ( - d.warehouse not in warehouse_with_no_account - or d.rejected_warehouse not in warehouse_with_no_account + elif (d.warehouse and d.warehouse not in warehouse_with_no_account) or ( + d.rejected_warehouse and d.rejected_warehouse not in warehouse_with_no_account ): - warehouse_with_no_account.append(d.warehouse) + warehouse_with_no_account.append(d.warehouse or d.rejected_warehouse) if d.is_fixed_asset: self.update_assets(d, d.valuation_rate)