Fix patches for Travis

This commit is contained in:
Shreya 2018-05-17 18:58:47 +05:30
parent 6d2dfac44e
commit 70f9d07df8
8 changed files with 22 additions and 7 deletions

View File

@ -21,7 +21,8 @@ def execute():
frappe.reload_doc('stock', 'doctype', 'delivery_note')
for doctype in to_rename:
rename_field(doctype, 'subscription', 'auto_repeat')
if frappe.db.has_column(doctype, 'subscription'):
rename_field(doctype, 'subscription', 'auto_repeat')
subscriptions = frappe.db.sql('select * from `tabSubscription`', as_dict=1)

View File

@ -2,7 +2,7 @@ import frappe
from frappe.utils.nestedset import rebuild_tree
def execute():
for doctype in ['department', 'leave_period', 'staffing_plan', 'job_opening']:
for doctype in ['department', 'leave_period', 'staffing_plan', 'job_opening', 'payroll_entry']:
frappe.reload_doc("hr", "doctype", doctype)
companies = frappe.db.get_all("Company", fields=["name", "abbr"])

View File

@ -11,6 +11,7 @@ def execute():
frappe.reload_doc('assets', 'doctype', 'asset_category')
frappe.reload_doc('assets', 'doctype', 'asset')
frappe.reload_doc('assets', 'doctype', 'asset_movement')
frappe.reload_doc('assets', 'doctype', 'asset_category_account')
frappe.db.sql(""" update `tabAsset` ast, `tabWarehouse` wh
set ast.location = wh.warehouse_name where ast.warehouse = wh.name""")
@ -36,8 +37,8 @@ def execute():
frappe.db.sql(""" update `tabDepreciation Schedule` ds, `tabAsset` ast
set ds.depreciation_method = ast.depreciation_method, ds.finance_book_id = 1 where ds.parent = ast.name """)
for catergory in frappe.get_all('Asset Category'):
asset_category_doc = frappe.get_doc("Asset Category", catergory)
for category in frappe.get_all('Asset Category'):
asset_category_doc = frappe.get_doc("Asset Category", category)
row = asset_category_doc.append('finance_books', {
'depreciation_method': asset_category_doc.depreciation_method,
'total_number_of_depreciations': asset_category_doc.total_number_of_depreciations,

View File

@ -2,6 +2,7 @@ import frappe
from frappe.model.utils.rename_field import rename_field
def execute():
frappe.db.sql("""update `tabLeave Type` set max_days_allowed = '0' where trim(coalesce(max_days_allowed, '')) = ''""")
frappe.reload_doc("hr", "doctype", "leave_type")
frappe.db.sql_ddl("""ALTER table `tabLeave Type` modify max_days_allowed int(8) NOT NULL""")
rename_field("Leave Type", "max_days_allowed", "max_continuous_days_allowed")

View File

@ -3,6 +3,8 @@ import frappe
def execute():
frappe.reload_doc('hr', 'doctype', 'salary_structure')
frappe.reload_doc('hr', 'doctype', 'salary_structure_employee')
if not frappe.db.has_column('Salary Structure', 'employees'):
return
for ss in frappe.db.sql(""" select employee, name from `tabSalary Structure`""", as_dict=True):
ss_doc = frappe.get_doc('Salary Structure', ss.name)
salary_employee = ss_doc.append('employees',{})

View File

@ -10,6 +10,8 @@ earnings or deductions in existing salary slips
def execute():
frappe.reload_doc("accounts", "doctype", "salary_component_account")
frappe.reload_doc("hr", "doctype", "salary_component")
frappe.reload_doc("hr", "doctype", "taxable_salary_slab")
for s in frappe.db.sql('''select name, type, salary_component_abbr from `tabSalary Component`
where ifnull(type, "")="" or ifnull(salary_component_abbr, "") = ""''', as_dict=1):

View File

@ -10,6 +10,9 @@ def execute():
"BOM Item", "BOM Explosion Item", "BOM"):
frappe.reload_doctype(doctype)
frappe.reload_doc("stock", "doctype", "item")
frappe.reload_doc("stock", "doctype", "item_default")
# fetch all draft and submitted work orders
fields = ["name"]
if "source_warehouse" in frappe.db.get_table_columns("Work Order"):

View File

@ -7,12 +7,17 @@ from frappe.utils import getdate
from frappe.desk.doctype.auto_repeat.auto_repeat import get_next_schedule_date
def execute():
frappe.reload_doctype('Subscription')
frappe.reload_doc('accounts', 'doctype', 'subscription')
fields = ["name", "reference_doctype", "reference_document",
"start_date", "frequency", "repeat_on_day"]
for d in fields:
if not frappe.db.has_column('Subscription', d):
return
doctypes = ('Purchase Order', 'Sales Order', 'Purchase Invoice', 'Sales Invoice')
for data in frappe.get_all('Subscription',
fields = ["name", "reference_doctype", "reference_document",
"start_date", "frequency", "repeat_on_day"],
fields = fields,
filters = {'reference_doctype': ('in', doctypes), 'docstatus': 1}):
recurring_id = frappe.db.get_value(data.reference_doctype, data.reference_document, "recurring_id")