From 6a03f995463d76e95c09543160addc9ea8b26283 Mon Sep 17 00:00:00 2001 From: Mihir Kandoi Date: Tue, 4 Feb 2025 11:46:11 +0530 Subject: [PATCH] fix: logical error failing tests (cherry picked from commit fee318a275f30e86fccff1d6e16aae8d1b091212) --- erpnext/controllers/accounts_controller.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/erpnext/controllers/accounts_controller.py b/erpnext/controllers/accounts_controller.py index 87671568bd8..715a73e0da6 100644 --- a/erpnext/controllers/accounts_controller.py +++ b/erpnext/controllers/accounts_controller.py @@ -817,10 +817,13 @@ class AccountsController(TransactionBase): item.get(fieldname) is None or fieldname in force_item_fields or ( - fieldname in ["serial_no", "batch_no", "rate", "price_list_rate"] + fieldname in ["serial_no", "batch_no"] and item.get("use_serial_batch_fields") ) ): + if fieldname == "batch_no" and not item.batch_no: + item.set("rate", ret.get("rate")) + item.set("price_list_rate", ret.get("price_list_rate")) item.set(fieldname, value) elif fieldname in ["cost_center", "conversion_factor"] and not item.get(