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.
This commit is contained in:
Ankush Menat 2021-11-18 12:51:26 +05:30 committed by Ankush Menat
parent 42f1dd98dd
commit aa024fc9da
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.company = args.company
repost_entry.allow_zero_rate = args.allow_zero_rate repost_entry.allow_zero_rate = args.allow_zero_rate
repost_entry.flags.ignore_links = True repost_entry.flags.ignore_links = True
repost_entry.flags.ignore_permissions = True
repost_entry.save() repost_entry.save()
repost_entry.submit() repost_entry.submit()

View File

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