fix: Accounting Dimension custom fields should be admin owned (#19525)

* fix: Accounting Dimension custom fileds should be admin owned

* fix: Update query

* fix: Travis
This commit is contained in:
Deepesh Garg
2019-11-08 12:42:38 +05:30
committed by Nabin Hait
parent a839510b33
commit 7aef9f3b43
3 changed files with 25 additions and 1 deletions

View File

@@ -0,0 +1,17 @@
from __future__ import unicode_literals
import frappe
from erpnext.accounts.doctype.accounting_dimension.accounting_dimension import get_doctypes_with_dimensions
def execute():
accounting_dimensions = frappe.db.sql("""select fieldname from
`tabAccounting Dimension`""", as_dict=1)
doclist = get_doctypes_with_dimensions()
for dimension in accounting_dimensions:
frappe.db.sql("""
UPDATE `tabCustom Field`
SET owner = 'Administrator'
WHERE fieldname = %s
AND dt IN (%s)""" % #nosec
('%s', ', '.join(['%s']* len(doclist))), tuple([dimension.fieldname] + doclist))