From fbeaabffc9a5f1073c225476a07cb0c6ebe8f3e7 Mon Sep 17 00:00:00 2001 From: anandbaburajan Date: Fri, 3 Feb 2023 22:58:22 +0530 Subject: [PATCH 1/2] fix: allow PI cancel if linked asset is cancelled (cherry picked from commit b961321de5447fe8049472f51ae89f1a3ff76665) --- erpnext/controllers/buying_controller.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/erpnext/controllers/buying_controller.py b/erpnext/controllers/buying_controller.py index ffd021773c9..5e9ed1ecf7d 100644 --- a/erpnext/controllers/buying_controller.py +++ b/erpnext/controllers/buying_controller.py @@ -755,6 +755,8 @@ class BuyingController(StockController, Subcontracting): asset.purchase_date = self.posting_date asset.supplier = self.supplier elif self.docstatus == 2: + if asset.docstatus == 2: + break if asset.docstatus == 0: asset.set(field, None) asset.supplier = None From d6b0e622eada2a4bf638484dfc3546a8e32ecde4 Mon Sep 17 00:00:00 2001 From: anandbaburajan Date: Sat, 4 Feb 2023 11:20:26 +0530 Subject: [PATCH 2/2] chore: use continue, not break (cherry picked from commit 3380dc5deaac8df145f424153254466b35ddd02b) --- erpnext/controllers/buying_controller.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/erpnext/controllers/buying_controller.py b/erpnext/controllers/buying_controller.py index 5e9ed1ecf7d..56ecb45fdff 100644 --- a/erpnext/controllers/buying_controller.py +++ b/erpnext/controllers/buying_controller.py @@ -756,7 +756,7 @@ class BuyingController(StockController, Subcontracting): asset.supplier = self.supplier elif self.docstatus == 2: if asset.docstatus == 2: - break + continue if asset.docstatus == 0: asset.set(field, None) asset.supplier = None