mirror of
https://github.com/frappe/erpnext.git
synced 2026-02-17 08:35:00 +00:00
fix: not authorized to update entries after freezing accounts (backport #27937)
* fix: not authorized to update entries after freezing accounts (#27937)
* fix: not authorized to update entries after freezing accounts
* fix: Add test case
* fix(patch): patched to requeue failed reposts(check_freezing_date)
* chore: misc fixes
Co-authored-by: Deepesh Garg <deepeshgarg6@gmail.com>
Co-authored-by: Ankush Menat <ankushmenat@gmail.com>
(cherry picked from commit 2bb383b178)
# Conflicts:
# erpnext/patches.txt
* fix: resolve conflict
Co-authored-by: Noah Jacob <noahjacobkurian@gmail.com>
Co-authored-by: Ankush Menat <ankush@iwebnotes.com>
This commit is contained in:
@@ -2327,6 +2327,18 @@ class TestSalesInvoice(unittest.TestCase):
|
||||
si.reload()
|
||||
self.assertEqual(si.status, "Paid")
|
||||
|
||||
def test_sales_invoice_submission_post_account_freezing_date(self):
|
||||
frappe.db.set_value('Accounts Settings', None, 'acc_frozen_upto', add_days(getdate(), 1))
|
||||
si = create_sales_invoice(do_not_save=True)
|
||||
si.posting_date = add_days(getdate(), 1)
|
||||
si.save()
|
||||
|
||||
self.assertRaises(frappe.ValidationError, si.submit)
|
||||
si.posting_date = getdate()
|
||||
si.submit()
|
||||
|
||||
frappe.db.set_value('Accounts Settings', None, 'acc_frozen_upto', None)
|
||||
|
||||
def get_sales_invoice_for_e_invoice():
|
||||
si = make_sales_invoice_for_ewaybill()
|
||||
si.naming_series = 'INV-2020-.#####'
|
||||
|
||||
@@ -293,7 +293,7 @@ def check_freezing_date(posting_date, adv_adj=False):
|
||||
if acc_frozen_upto:
|
||||
frozen_accounts_modifier = frappe.db.get_value( 'Accounts Settings', None,'frozen_accounts_modifier')
|
||||
if getdate(posting_date) <= getdate(acc_frozen_upto) \
|
||||
and not frozen_accounts_modifier in frappe.get_roles() or frappe.session.user == 'Administrator':
|
||||
and (frozen_accounts_modifier not in frappe.get_roles() or frappe.session.user == 'Administrator'):
|
||||
frappe.throw(_("You are not authorized to add or update entries before {0}").format(formatdate(acc_frozen_upto)))
|
||||
|
||||
def set_as_cancel(voucher_type, voucher_no):
|
||||
|
||||
@@ -323,3 +323,4 @@ erpnext.patches.v13_0.shopping_cart_to_ecommerce
|
||||
erpnext.patches.v13_0.set_status_in_maintenance_schedule_table
|
||||
erpnext.patches.v13_0.add_default_interview_notification_templates
|
||||
erpnext.patches.v13_0.trim_sales_invoice_custom_field_length
|
||||
erpnext.patches.v13_0.requeue_failed_reposts
|
||||
|
||||
13
erpnext/patches/v13_0/requeue_failed_reposts.py
Normal file
13
erpnext/patches/v13_0/requeue_failed_reposts.py
Normal file
@@ -0,0 +1,13 @@
|
||||
import frappe
|
||||
from frappe.utils import cstr
|
||||
|
||||
|
||||
def execute():
|
||||
|
||||
reposts = frappe.get_all("Repost Item Valuation",
|
||||
{"status": "Failed", "modified": [">", "2021-10-05"] },
|
||||
["name", "modified", "error_log"])
|
||||
|
||||
for repost in reposts:
|
||||
if "check_freezing_date" in cstr(repost.error_log):
|
||||
frappe.db.set_value("Repost Item Valuation", repost.name, "status", "Queued")
|
||||
Reference in New Issue
Block a user