fix: allow operators, make weighting_function mandatory

This commit is contained in:
Sagar Vora 2019-01-23 16:42:28 +05:30
parent 9aeabce3d3
commit f51661b225
3 changed files with 22 additions and 2 deletions

View File

@ -252,7 +252,7 @@
"read_only": 0, "read_only": 0,
"remember_last_selected_value": 0, "remember_last_selected_value": 0,
"report_hide": 0, "report_hide": 0,
"reqd": 0, "reqd": 1,
"search_index": 0, "search_index": 0,
"set_only_once": 0, "set_only_once": 0,
"unique": 0 "unique": 0

View File

@ -507,4 +507,5 @@ erpnext.patches.v10_0.set_discount_amount
erpnext.patches.v10_0.recalculate_gross_margin_for_project erpnext.patches.v10_0.recalculate_gross_margin_for_project
erpnext.patches.v10_0.delete_hub_documents erpnext.patches.v10_0.delete_hub_documents
erpnext.patches.v10_0.update_user_image_in_employee erpnext.patches.v10_0.update_user_image_in_employee
erpnext.patches.v10_0.repost_gle_for_purchase_receipts_with_rejected_items erpnext.patches.v10_0.repost_gle_for_purchase_receipts_with_rejected_items
erpnext.patches.v10_0.allow_operators_in_supplier_scorecard

View File

@ -0,0 +1,19 @@
# Copyright (c) 2019, Frappe and Contributors
# License: GNU General Public License v3. See license.txt
from __future__ import unicode_literals
import frappe
def execute():
for criteria in frappe.get_all('Supplier Scorecard Criteria', fields=['name', 'formula'], limit_page_length=None):
frappe.db.set_value('Supplier Scorecard Criteria', criteria.name,
'formula', criteria.formula.replace('&lt;','<').replace('&gt;','>'))
for criteria in frappe.get_all('Supplier Scorecard Scoring Criteria', fields=['name', 'formula'], limit_page_length=None):
if criteria.formula: # not mandatory
frappe.db.set_value('Supplier Scorecard Scoring Criteria', criteria.name,
'formula', criteria.formula.replace('&lt;','<').replace('&gt;','>'))
for sc in frappe.get_all('Supplier Scorecard', fields=['name', 'weighting_function'], limit_page_length=None):
frappe.db.set_value('Supplier Scorecard', sc.name, 'weighting_function',
sc.weighting_function.replace('&lt;','<').replace('&gt;','>'))