Set numeric ranges in Item tamplate if blank (#12199)
This commit is contained in:
parent
28ce1c0c3a
commit
ca674bec42
@ -484,3 +484,4 @@ erpnext.patches.v10_0.copy_projects_renamed_fields
|
||||
erpnext.patches.v10_0.enabled_regional_print_format_based_on_country
|
||||
erpnext.patches.v10_0.update_asset_calculate_depreciation
|
||||
erpnext.patches.v10_0.add_guardian_role_for_parent_portal
|
||||
erpnext.patches.v10_0.set_numeric_ranges_in_template_if_blank
|
@ -0,0 +1,35 @@
|
||||
# Copyright (c) 2017, Frappe and Contributors
|
||||
# License: GNU General Public License v3. See license.txt
|
||||
|
||||
from __future__ import unicode_literals
|
||||
import frappe
|
||||
|
||||
def execute():
|
||||
item_numeric_attributes = frappe.db.sql("""
|
||||
select name, numeric_values, from_range, to_range, increment
|
||||
from `tabItem Attribute`
|
||||
where numeric_values = 1
|
||||
""", as_dict=1)
|
||||
|
||||
for d in item_numeric_attributes:
|
||||
frappe.db.sql("""
|
||||
update `tabItem Variant Attribute`
|
||||
set
|
||||
from_range = CASE
|
||||
WHEN from_range = 0 THEN %(from_range)s
|
||||
ELSE from_range
|
||||
END,
|
||||
to_range = CASE
|
||||
WHEN to_range = 0 THEN %(to_range)s
|
||||
ELSE to_range
|
||||
END,
|
||||
increment = CASE
|
||||
WHEN increment = 0 THEN %(increment)s
|
||||
ELSE increment
|
||||
END,
|
||||
numeric_values = %(numeric_values)s
|
||||
where
|
||||
attribute = %(name)s
|
||||
and exists(select name from tabItem
|
||||
where name=`tabItem Variant Attribute`.parent and has_variants=1)
|
||||
""", d)
|
@ -1532,7 +1532,7 @@
|
||||
"report_hide": 0,
|
||||
"reqd": 0,
|
||||
"search_index": 0,
|
||||
"set_only_once": 1,
|
||||
"set_only_once": 0,
|
||||
"unique": 0
|
||||
},
|
||||
{
|
||||
@ -3453,7 +3453,7 @@
|
||||
"issingle": 0,
|
||||
"istable": 0,
|
||||
"max_attachments": 1,
|
||||
"modified": "2017-12-13 07:20:25.932499",
|
||||
"modified": "2017-12-27 15:47:17.039337",
|
||||
"modified_by": "Administrator",
|
||||
"module": "Stock",
|
||||
"name": "Item",
|
||||
|
Loading…
x
Reference in New Issue
Block a user