Merge pull request #5976 from nabinhait/patch_fix_109

[patch] Set default material request type in Item based on default bom
This commit is contained in:
Nabin Hait 2016-08-02 18:05:03 +05:30 committed by GitHub
commit e8ab7b8898
2 changed files with 17 additions and 1 deletions

View File

@ -307,4 +307,4 @@ erpnext.patches.v7_0.fix_nonwarehouse_ledger_gl_entries_for_transactions
erpnext.patches.v7_0.remove_old_earning_deduction_doctypes
erpnext.patches.v7_0.make_guardian
erpnext.patches.v7_0.update_refdoc_in_landed_cost_voucher
execute:frappe.db.sql("update `tabItem` set default_material_request_type= case when default_bom is not null then 'Manufacture' else 'Purchase' end")
erpnext.patches.v7_0.set_material_request_type_in_item

View File

@ -0,0 +1,16 @@
from __future__ import unicode_literals
import frappe
def execute():
frappe.reload_doctype("Item")
if "default_bom" in frappe.db.get_table_columns("Item"):
frappe.db.sql("""update `tabItem`
set default_material_request_type = (
case
when (default_bom is not null and default_bom != '')
then 'Manufacture'
else 'Purchase'
end )""")
else:
frappe.db.sql("update tabItem set default_material_request_type='Purchase'")