Skip to content
This repository has been archived by the owner on Mar 28, 2020. It is now read-only.

Commit

Permalink
add patches
Browse files Browse the repository at this point in the history
  • Loading branch information
barredterra committed Mar 21, 2019
1 parent a5a4b67 commit bcb596c
Show file tree
Hide file tree
Showing 3 changed files with 32 additions and 0 deletions.
2 changes: 2 additions & 0 deletions it_management/patches.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
it_management.patches.0_1.task_checklist
it_management.patches.0_1.configuration_item_table
17 changes: 17 additions & 0 deletions it_management/patches/0_1/configuration_item_table.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
import frappe

"""
Column `linked_configuration_item` in `Configuration Item Table` has been renamed to `configuration_item`
UPDATE `tabConfiguration Item Table`
SET configuration_item = linked_configuration_item
WHERE linked_configuration_item is not NULL and configuration_item is NULL
"""

filters={'linked_configuration_item':("!=", ""), 'configuration_item':("=", "")}
cit_list = frappe.get_list("Configuration Item Table", filters=filters)

for name in cit_list:
tl = frappe.get_doc("Configuration Item Table", name)
tl.configuration_item = tl.linked_configuration_item
tl.save()
13 changes: 13 additions & 0 deletions it_management/patches/0_1/task_checklist.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
import frappe

"""
`checklist_table` in `Task` has been renamed to `task_checklist`
"""

tc_list = frappe.get_list("Task Checklist", filters={'parentfield':'checklist_table'})

for name in tc_list:
tl = frappe.get_doc("Task Checklist", name)
tl.parentfield = 'task_checklist'
tl.save()

0 comments on commit bcb596c

Please sign in to comment.