So I guess you are trying to write a record rule. You can not use the context for record rule because it is not safe. Any user can fill the context with any value.
If you need a specific value available in the evaluation context of record rule, you must override Rule._get_context.
__name__ = 'ir.rule'
pool = Pool()
User = pool.get('res.user')
Party = pool.get('party.party')
context = super()._get_context()
user = User(Transaction().user)
context['party_id'] = EvalEnvironment(
i wrote this code but still no luck am i doing something wrong ?
an example would be greatly appreciated