From b482e3876dccb2547330b95c1c8d4f2cf7039918 Mon Sep 17 00:00:00 2001 From: Dany Robert Date: Wed, 23 Nov 2022 18:59:15 +0530 Subject: [PATCH] fix: check for session user rather than owner --- .../repost_item_valuation/repost_item_valuation.py | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/erpnext/stock/doctype/repost_item_valuation/repost_item_valuation.py b/erpnext/stock/doctype/repost_item_valuation/repost_item_valuation.py index b62933821c..a98d16e390 100644 --- a/erpnext/stock/doctype/repost_item_valuation/repost_item_valuation.py +++ b/erpnext/stock/doctype/repost_item_valuation/repost_item_valuation.py @@ -36,11 +36,12 @@ class RepostItemValuation(Document): ) if not acc_settings.acc_frozen_upto: return - if acc_settings.frozen_accounts_modifier and self.owner in get_users_with_role( - acc_settings.frozen_accounts_modifier - ): - return if getdate(self.posting_date) <= getdate(acc_settings.acc_frozen_upto): + if acc_settings.frozen_accounts_modifier and frappe.session.user in get_users_with_role( + acc_settings.frozen_accounts_modifier + ): + frappe.msgprint(_("Caution: This might alter frozen accounts.")) + return frappe.throw( _("You cannot repost item valuation before {}").format(acc_settings.acc_frozen_upto) )