test: Fix permission error

This commit is contained in:
Suraj Shetty 2021-05-10 18:39:09 +05:30
parent 018ccc2b6d
commit 404e7d07c5

View File

@ -316,10 +316,11 @@ class TestStockLedgerEntry(unittest.TestCase):
# Set User with Stock User role but not Stock Manager
try:
user = frappe.get_doc("User", "test@example.com")
frappe.set_user(user.name)
user.add_roles("Stock User")
user.remove_roles("Stock Manager")
frappe.set_user(user.name)
stock_entry_on_today = make_stock_entry(target="_Test Warehouse - _TC", qty=10, basic_rate=100)
back_dated_se_1 = make_stock_entry(target="_Test Warehouse - _TC", qty=10, basic_rate=100,
posting_date=add_days(today(), -1), do_not_submit=True)