mirror of
https://github.com/frappe/erpnext.git
synced 2026-05-27 17:04:47 +00:00
fix: patch failing while migrating from v7 to v13
This commit is contained in:
@@ -307,6 +307,8 @@ auto_cancel_exempted_doctypes= [
|
|||||||
"Inpatient Medication Entry"
|
"Inpatient Medication Entry"
|
||||||
]
|
]
|
||||||
|
|
||||||
|
after_migrate = ["erpnext.setup.install.update_select_perm_after_install"]
|
||||||
|
|
||||||
scheduler_events = {
|
scheduler_events = {
|
||||||
"cron": {
|
"cron": {
|
||||||
"0/30 * * * *": [
|
"0/30 * * * *": [
|
||||||
|
|||||||
@@ -771,4 +771,4 @@ erpnext.patches.v12_0.add_gst_category_in_delivery_note
|
|||||||
erpnext.patches.v12_0.purchase_receipt_status
|
erpnext.patches.v12_0.purchase_receipt_status
|
||||||
erpnext.patches.v13_0.fix_non_unique_represents_company
|
erpnext.patches.v13_0.fix_non_unique_represents_company
|
||||||
erpnext.patches.v12_0.add_document_type_field_for_italy_einvoicing
|
erpnext.patches.v12_0.add_document_type_field_for_italy_einvoicing
|
||||||
erpnext.patches.v13_0.make_non_standard_user_type #31-03-2020
|
erpnext.patches.v13_0.make_non_standard_user_type #13-04-2021
|
||||||
@@ -2,7 +2,23 @@
|
|||||||
# License: GNU General Public License v3. See license.txt
|
# License: GNU General Public License v3. See license.txt
|
||||||
|
|
||||||
from __future__ import unicode_literals
|
from __future__ import unicode_literals
|
||||||
|
import frappe
|
||||||
|
from six import iteritems
|
||||||
from erpnext.setup.install import add_non_standard_user_types
|
from erpnext.setup.install import add_non_standard_user_types
|
||||||
|
|
||||||
def execute():
|
def execute():
|
||||||
|
doctype_dict = {
|
||||||
|
'projects': ['Timesheet'],
|
||||||
|
'payroll': ['Salary Slip', 'Employee Tax Exemption Declaration', 'Employee Tax Exemption Proof Submission'],
|
||||||
|
'hr': ['Employee', 'Expense Claim', 'Leave Application', 'Attendance Request', 'Compensatory Leave Request']
|
||||||
|
}
|
||||||
|
|
||||||
|
for module, doctypes in iteritems(doctype_dict):
|
||||||
|
for doctype in doctypes:
|
||||||
|
frappe.reload_doc(module, 'doctype', doctype)
|
||||||
|
|
||||||
|
|
||||||
|
frappe.flags.ignore_select_perm = True
|
||||||
|
frappe.flags.update_select_perm_after_migrate = True
|
||||||
|
|
||||||
add_non_standard_user_types()
|
add_non_standard_user_types()
|
||||||
@@ -233,3 +233,15 @@ def create_role_permissions_for_doctype(doc, data):
|
|||||||
args[perm] = 1
|
args[perm] = 1
|
||||||
|
|
||||||
doc.append('user_doctypes', args)
|
doc.append('user_doctypes', args)
|
||||||
|
|
||||||
|
def update_select_perm_after_install():
|
||||||
|
if not frappe.flags.update_select_perm_after_migrate:
|
||||||
|
return
|
||||||
|
|
||||||
|
frappe.flags.ignore_select_perm = False
|
||||||
|
for row in frappe.get_all('User Type', filters= {'is_standard': 0}):
|
||||||
|
print('Updating user type :- ', row.name)
|
||||||
|
doc = frappe.get_doc('User Type', row.name)
|
||||||
|
doc.save()
|
||||||
|
|
||||||
|
frappe.flags.update_select_perm_after_migrate = False
|
||||||
|
|||||||
Reference in New Issue
Block a user