fix: ignore permissions while creating repost

If user reached this code then they already have permission to create
stock transaction, hence ignore permission checks while
creating/cancelling repost item valuation entries.

(cherry picked from commit aa024fc9da)
This commit is contained in:
Ankush Menat
2021-11-18 12:51:26 +05:30
committed by Ankush Menat
parent 1267543064
commit 636a6fcae0
2 changed files with 2 additions and 0 deletions

View File

@@ -676,5 +676,6 @@ def create_repost_item_valuation_entry(args):
repost_entry.company = args.company
repost_entry.allow_zero_rate = args.allow_zero_rate
repost_entry.flags.ignore_links = True
repost_entry.flags.ignore_permissions = True
repost_entry.save()
repost_entry.submit()

View File

@@ -113,6 +113,7 @@ def validate_cancellation(args):
frappe.throw(_("Cannot cancel the transaction. Reposting of item valuation on submission is not completed yet."))
if repost_entry.status == 'Queued':
doc = frappe.get_doc("Repost Item Valuation", repost_entry.name)
doc.flags.ignore_permissions = True
doc.cancel()
doc.delete()