fix: assign duplicate_items_msg outside conditional (#31639)
duplicate_items_msg was defined inside if the statement of stock_item so when duplicate was found in non_stock_item it raised referenced before assignment
(cherry picked from commit 8e23c6ad69dee213f0252d2b231317490fab760f)
Co-authored-by: Maharshi Patel <39730881+maharshivpatel@users.noreply.github.com>