def execute(): import webnotes webnotes.conn.sql("DELETE FROM `tabDocFormat` WHERE format='POS Invoice'") from webnotes.modules.module_manager import reload_doc reload_doc("accounts", "Print Format", "POS Invoice")
def execute(): import webnotes from webnotes.modules.module_manager import reload_doc sql = webnotes.conn.sql reload_doc('hr', 'doctype', 'salary_manager') sql("delete from `tabDocField` where parent = 'Salary Manager' and fieldname = 'employment_type'")
def execute(): import webnotes from webnotes.modules.module_manager import reload_doc webnotes.conn.sql("delete from `tabField Mapper Detail` where from_field = 'transaction_date' and parent in ('Sales Order-Delivery Note', 'Purchase Order-Purchase Receipt')") reload_doc('stock', 'DocType Mapper', 'Sales Order-Delivery Note') reload_doc('stock', 'DocType Mapper', 'Purchase Order-Purchase Receipt')
def setup(): "creates the DocTrigger table from core" webnotes.conn.commit() from webnotes.modules.module_manager import reload_doc reload_doc('core','doctype','doctrigger') webnotes.conn.begin()
def execute(): import webnotes from webnotes.modules.module_manager import reload_doc reload_doc('setup', 'doctype', 'manage_account') reload_doc('stock', 'doctype', 'item') webnotes.conn.sql("delete from `tabDocField` where fieldname='minimum_inventory_level' and parent='item'") webnotes.conn.sql("update `tabItem` set re_order_level = minimum_inventory_level where ifnull(re_order_level,0) = 0 ")
def execute(): import webnotes from webnotes.modules.module_manager import reload_doc reload_doc('stock', 'doctype', 'delivery_note_detail') reload_doc('stock', 'Print Format', 'Delivery Note Packing List Wise') webnotes.conn.sql("delete from `tabDocField` where fieldname in ('packed_by', 'packing_checked_by', 'pack_size') and parent = 'Delivery Note'")
def run_patches(): # update module dt_module = { 'LC PR Detail': 'Stock', 'Landed Cost Detail': 'Stock', 'Comment Widget Record': 'Core', 'Tag': 'Core', 'Tag Detail': 'Core', 'POS Settings': 'Accounts', 'Menu Item': 'Setup', 'Menu Item Role': 'Setup' } for d in dt_module.keys(): sql("update `tabDocType` set module = '%s' where name = '%s'" % (dt_module[d], d)) delete_unwanted_mappers() delete_unwanted_doctypes() sql("start transaction") delete_unwanted_pages() delete_unwanted_search_criteria() rename_merge_modules() sync_roles() sync_mapper() delete_unwanted_modules() # landed cost wizard link in stock reload_doc('stock', 'Module Def', 'Stock') sql("commit")
def rename_merge_modules(): "Rename module as per users view and merge for removing confusion" rename_lst = [['CRM', 'Selling'], ['SRM', 'Buying'], ['Material Management', 'Stock'], ['Payroll', 'HR'], ['Maintenance', 'Support']] for d in rename_lst: # create new module manually and export to file??????? reload_doc(d[1].lower(), 'Module Def', d[1]) merge_lst = [['Tools', 'Utilities'], ['Application Internal', 'Utilities'], ['Settings', 'Setup']] # settings hardcoded in my_company # module hardcoded in home_control # material_management hardcoded in installation note # maintenance hardcoded in support_email_settings lst = rename_lst + merge_lst for d in lst: update_module(d[0], d[1]) try: delete_doc('Module Def', d[0]) except: pass reload_doc('Utilities', 'Module Def', 'Utilities')
def execute(): import webnotes from webnotes.modules.module_manager import reload_doc reload_doc('stock', 'doctype', 'stock_reconciliation') webnotes.conn.sql( "delete from `tabDocField` where (label in ('Validate Data', 'Attachment HTML', 'Attachment') or fieldname in ('next_step', 'company', 'fiscal_year', 'amendment_date')) and parent = 'Stock Reconciliation'" )
def execute(): from webnotes.model.doc import Document from webnotes.modules.module_manager import reload_doc reload_doc('hr', 'search_criteria', 'employeewise_balance_leave_report') d = Document('Search Criteria', 'employeewise_balance_leave_report') d.criteria_name = 'Employee Leave Balance Report' d.description = 'Employeewise Balance Leave Report' d.save()
def execute(): import webnotes from webnotes.modules.module_manager import reload_doc sql = webnotes.conn.sql reload_doc('hr', 'doctype', 'salary_manager') sql("delete from `tabDocField` where parent = 'Salary Manager' and fieldname = 'employment_type'" )
def execute(): import webnotes from webnotes.modules.module_manager import reload_doc from webnotes.model import delete_doc delete_doc('DocType', 'Landed Cost Wizard') delete_doc('DocType', 'LC PR Detail') reload_doc('stock', 'doctype', 'landed_cost_wizard') reload_doc('stock', 'doctype', 'lc_pr_detail')
def execute(): import webnotes from webnotes.modules.module_manager import reload_doc from webnotes.model.code import get_obj reload_doc('accounts', 'doctype', 'receivable_voucher') reload_doc('setup', 'doctype', 'features_setup') get_obj('Features setup').validate()
def execute(): import webnotes from webnotes.modules.module_manager import reload_doc reload_doc('stock', 'doctype', 'delivery_note_detail') reload_doc('stock', 'Print Format', 'Delivery Note Packing List Wise') webnotes.conn.sql( "delete from `tabDocField` where fieldname in ('packed_by', 'packing_checked_by', 'pack_size') and parent = 'Delivery Note'" )
def execute(): import webnotes from webnotes.modules.module_manager import reload_doc reload_doc('stock', 'doctype', 'landed_cost_wizard') reload_doc('stock', 'doctype', 'lc_pr_detail') webnotes.conn.sql("delete from `tabDocField` where parent ='LC PR Detail' and fieldname in ('purchase_receipt_no', 'include_in_landed_cost')")
def execute(): import webnotes from webnotes.modules.module_manager import reload_doc webnotes.conn.sql( "delete from `tabField Mapper Detail` where from_field = 'transaction_date' and parent in ('Sales Order-Delivery Note', 'Purchase Order-Purchase Receipt')" ) reload_doc('stock', 'DocType Mapper', 'Sales Order-Delivery Note') reload_doc('stock', 'DocType Mapper', 'Purchase Order-Purchase Receipt')
def execute(): import webnotes from webnotes.modules.module_manager import reload_doc reload_doc('stock', 'doctype', 'landed_cost_wizard') reload_doc('stock', 'doctype', 'lc_pr_detail') webnotes.conn.sql( "delete from `tabDocField` where parent ='LC PR Detail' and fieldname in ('purchase_receipt_no', 'include_in_landed_cost')" )
def execute(): import webnotes from webnotes.modules.module_manager import reload_doc reload_doc('setup', 'doctype', 'manage_account') reload_doc('stock', 'doctype', 'item') webnotes.conn.sql( "delete from `tabDocField` where fieldname='minimum_inventory_level' and parent='item'" ) webnotes.conn.sql( "update `tabItem` set re_order_level = minimum_inventory_level where ifnull(re_order_level,0) = 0 " )
def execute(): """ * Change option of doclayer's doc_type field * Reload doclayer """ webnotes.conn.sql(""" UPDATE `tabDocField` SET options=NULL WHERE parent='DocLayer' AND fieldname='doc_type' """) from webnotes.modules.module_manager import reload_doc reload_doc('core', 'doctype', 'doclayer')
def execute(): """ * Change type of mail_port field to int * reload email settings """ import webnotes webnotes.conn.sql(""" UPDATE `tabDocField` SET fieldtype='Int' WHERE parent = 'Email Settings' AND fieldname = 'mail_port' """) from webnotes.modules.module_manager import reload_doc reload_doc('setup', 'doctype', 'email_settings')
def execute(): import webnotes from webnotes.modules.module_manager import reload_doc reload_doc('accounts', 'doctype', 'receivable_voucher') reload_doc('stock', 'doctype', 'delivery_note') reload_doc('selling', 'doctype', 'sales_order') reload_doc('selling', 'doctype', 'quotation') reload_doc('setup', 'doctype', 'manage_account') for d in ['Receivable Voucher', 'Delivery Note', 'Sales Order', 'Quotation']: webnotes.conn.sql("update `tab%s` set price_list_currency = currency, plc_conversion_rate = conversion_rate" % d)
def execute(): """ Install print formats """ from webnotes.modules.module_manager import reload_doc reload_doc('core', 'doctype', 'print_format') #copy_doctype_to_pfs() global pf_to_install for pf in pf_to_install: # install_print_format(pf) # print "Installed PF: " + pf['name'] reload_doc(pf['module'], 'Print Format', pf['name'])
def execute(): """ Remove One Get TDS button, which is appearing twice in JV """ import webnotes webnotes.conn.sql(""" DELETE from `tabDocField` WHERE parent='Journal Voucher' AND label='Get TDS' AND fieldtype='Button' """) from webnotes.modules.module_manager import reload_doc reload_doc('accounts', 'doctype', 'journal_voucher')
def execute(): import webnotes from webnotes.modules.module_manager import reload_doc reload_doc('accounts', 'doctype', 'receivable_voucher') reload_doc('stock', 'doctype', 'delivery_note') reload_doc('selling', 'doctype', 'sales_order') reload_doc('selling', 'doctype', 'quotation') reload_doc('setup', 'doctype', 'manage_account') for d in [ 'Receivable Voucher', 'Delivery Note', 'Sales Order', 'Quotation' ]: webnotes.conn.sql( "update `tab%s` set price_list_currency = currency, plc_conversion_rate = conversion_rate" % d)
def execute(): import webnotes opts = webnotes.conn.sql("""\ SELECT options FROM `tabDocField` WHERE parent='Serial No' AND fieldname='status' AND fieldtype='Select'""") if opts and opts[0][0]: opt_list = opts[0][0].split("\n") if not "Purchase Returned" in opt_list: webnotes.conn.sql(""" UPDATE `tabDocField` SET options=%s WHERE parent='Serial No' AND fieldname='status' AND fieldtype='Select'""", "\n".join(opt_list + ["Purchase Returned"])) webnotes.conn.commit() webnotes.conn.begin() from webnotes.modules.module_manager import reload_doc reload_doc('stock', 'doctype', 'serial_no')
def execute(): import webnotes from webnotes.modules.module_manager import reload_doc reload_doc('accounts', 'doctype', 'receivable_voucher') reload_doc('accounts', 'doctype', 'c_form') reload_doc('accounts', 'doctype', 'c_form_invoice_detail') reload_doc('accounts', 'Module Def', 'Accounts') sql = webnotes.conn.sql sql("update `tabReceivable Voucher` set c_form_applicable = 'Yes' where c_form_applicable = 'Y'") sql("update `tabReceivable Voucher` set c_form_applicable = 'No' where c_form_applicable = 'N'")
def execute(): """ Changes allocated_to option to Profile in DocType Customer Issue """ import webnotes webnotes.conn.sql(""" UPDATE `tabDocField` SET options='Profile' WHERE fieldname='allocated_to' """) webnotes.conn.sql(""" DELETE from `tabDocField` WHERE parent='Customer Issue' AND label='Make Maintenance Visit' """) from webnotes.modules.module_manager import reload_doc reload_doc('support', 'doctype', 'customer_issue')
def execute(): from webnotes.modules.module_manager import reload_doc reload_doc('core', 'doctype', 'print_format') reload_doc('core', 'doctype', 'doclayer') reload_doc('core', 'doctype', 'doclayerfield') reload_doc('accounts', 'doctype', 'gl_entry') from webnotes.model.doc import Document d = Document('DocType Label') d.dt = "DocLayer" d.dt_label = "Customize Form View" d.save(1) from webnotes.session_cache import clear clear()
def execute(): import webnotes from webnotes.modules.module_manager import reload_doc reload_doc('website', 'doctype', 'website_settings') res = webnotes.conn.sql("""\ SELECT name FROM `tabDocPerm` WHERE parent='Website Settings' AND role='All' AND permlevel=1""") if not res: idx = webnotes.conn.sql("""\ SELECT MAX(idx) FROM `tabDocPerm` WHERE parent='Website Settings' """)[0][0] from webnotes.model.doc import Document d = Document('DocType', 'Website Settings') perm = d.addchild('permissions', 'DocPerm') perm.read = 1 perm.role = 'All' perm.permlevel = 1 perm.idx = idx + 1 perm.save()
def reload(self, **kwargs): """ Reloads a particular doc in the system Arguments can be: * module * doc_type * doc_name """ try: self.block_user(True, msg="Patches are being executed in the system. Please try again in a few minutes.") module = kwargs.get('module') doc_type, doc_name = kwargs.get('doc_type'), kwargs.get('doc_name') reload_string = 'Module: %s, DocType: %s, DocName: %s' % (module, doc_type, doc_name) from webnotes.modules.module_manager import reload_doc reload_doc(module, doc_type, doc_name) self.log(log_type='info', msg='Reload successful. ' + reload_string) except Exception, e: self.log(log_type='error', msg='Reload error. ' + reload_string)
def run_patches(): # update module dt_module = {'LC PR Detail':'Stock', 'Landed Cost Detail':'Stock', 'Comment Widget Record': 'Core', 'Tag':'Core', 'Tag Detail': 'Core', 'POS Settings': 'Accounts', 'Menu Item': 'Setup', 'Menu Item Role': 'Setup'} for d in dt_module.keys(): sql("update `tabDocType` set module = '%s' where name = '%s'" % (dt_module[d], d)) delete_unwanted_mappers() delete_unwanted_doctypes() sql("start transaction") delete_unwanted_pages() delete_unwanted_search_criteria() rename_merge_modules() sync_roles() sync_mapper() delete_unwanted_modules() # landed cost wizard link in stock reload_doc('stock', 'Module Def', 'Stock') sql("commit")
def execute(): import webnotes from webnotes.modules.module_manager import reload_doc reload_doc('accounts', 'doctype', 'receivable_voucher') reload_doc('accounts', 'doctype', 'c_form') reload_doc('accounts', 'doctype', 'c_form_invoice_detail') reload_doc('accounts', 'Module Def', 'Accounts') sql = webnotes.conn.sql sql("update `tabReceivable Voucher` set c_form_applicable = 'Yes' where c_form_applicable = 'Y'" ) sql("update `tabReceivable Voucher` set c_form_applicable = 'No' where c_form_applicable = 'N'" )
def execute(): import webnotes from webnotes.modules.module_manager import reload_doc sql = webnotes.conn.sql # Reload item table reload_doc("accounts", "doctype", "pv_detail") reload_doc("buying", "doctype", "po_detail") reload_doc("stock", "doctype", "purchase_receipt_detail") # copy project value from parent to child sql( "update `tabPO Detail` t1, `tabPurchase Order` t2 set t1.project_name = t2.project_name where t1.parent = t2.name and ifnull(t1.project_name, '') = ''" ) sql( "update `tabPV Detail` t1, `tabPayable Voucher` t2 set t1.project_name = t2.project_name where t1.parent = t2.name and ifnull(t1.project_name, '') = ''" ) sql( "update `tabPurchase Receipt Detail` t1, `tabPurchase Receipt` t2 set t1.project_name = t2.project_name where t1.parent = t2.name and ifnull(t1.project_name, '') = ''" ) # delete project from parent sql( "delete from `tabDocField` where fieldname = 'project_name' and parent in ('Purchase Order', 'Purchase Receipt', 'Payable Voucher')" )
def execute(): import webnotes from webnotes.modules.module_manager import reload_doc reload_doc('accounts', 'doctype', 'pv_detail') reload_doc('buying', 'doctype', 'po_detail') reload_doc('stock', 'doctype', 'purchase_receipt_detail') if webnotes.conn.sql("select name from `tabDocField` where parent = 'PO Detail' and fieldname = 'discount'"): webnotes.conn.sql("update `tabPO Detail` set discount_rate=discount") # Features setup reload_doc('setup', 'doctype', 'features_setup') from webnotes.model.code import get_obj get_obj('Features Setup').validate()
def rename_merge_modules(): "Rename module as per users view and merge for removing confusion" rename_lst = [['CRM', 'Selling'], ['SRM','Buying'], ['Material Management', 'Stock'], ['Payroll','HR'], ['Maintenance', 'Support']] for d in rename_lst: # create new module manually and export to file??????? reload_doc(d[1].lower(), 'Module Def', d[1]) merge_lst = [['Tools', 'Utilities'], ['Application Internal', 'Utilities'], ['Settings', 'Setup']] # settings hardcoded in my_company # module hardcoded in home_control # material_management hardcoded in installation note # maintenance hardcoded in support_email_settings lst = rename_lst + merge_lst for d in lst: update_module(d[0], d[1]) try: delete_doc('Module Def', d[0]) except: pass reload_doc('Utilities', 'Module Def', 'Utilities')
def execute(): import webnotes from webnotes.modules.module_manager import reload_doc reload_doc('accounts', 'doctype', 'pv_detail') reload_doc('buying', 'doctype', 'po_detail') reload_doc('stock', 'doctype', 'purchase_receipt_detail') if webnotes.conn.sql( "select name from `tabDocField` where parent = 'PO Detail' and fieldname = 'discount'" ): webnotes.conn.sql("update `tabPO Detail` set discount_rate=discount") # Features setup reload_doc('setup', 'doctype', 'features_setup') from webnotes.model.code import get_obj get_obj('Features Setup').validate()
def execute(): from webnotes.modules.module_manager import reload_doc reload_doc("core", "doctype", "print_format") reload_doc("core", "doctype", "doclayer") reload_doc("core", "doctype", "doclayerfield") reload_doc("accounts", "doctype", "gl_entry") from webnotes.model.doc import Document d = Document("DocType Label") d.dt = "DocLayer" d.dt_label = "Customize Form View" d.save(1) from webnotes.session_cache import clear clear()
def support_patch(): # relaod support and other doctypes from webnotes.modules.module_manager import reload_doc webnotes.model.delete_doc('DocType', 'Support Ticket') reload_doc('setup', 'doctype', 'support_email_settings') reload_doc('support', 'doctype', 'support_ticket') reload_doc('support', 'doctype', 'support_ticket_response')
def execute(): import webnotes from webnotes.modules.module_manager import reload_doc reload_doc('stock', 'DocType Mapper', 'Sales Order-Delivery Note') reload_doc('accounts', 'DocType Mapper', 'Sales Order-Receivable Voucher') reload_doc('accounts', 'DocType Mapper', 'Delivery Note-Receivable Voucher') webnotes.conn.sql("delete from `tabField Mapper Detail` where parent = 'Sales Order-Delivery Note' and from_field = 'basic_rate' and to_field = 'basic_rate'")
def support_patch(): # relaod support and other doctypes from webnotes.modules.module_manager import reload_doc webnotes.model.delete_doc('DocType','Support Ticket') reload_doc('setup','doctype','support_email_settings') reload_doc('maintenance','doctype','support_ticket') reload_doc('maintenance','doctype','support_ticket_response')
def support_patch(): # relaod support and other doctypes from webnotes.modules.module_manager import reload_doc webnotes.model.delete_doc("DocType", "Support Ticket") reload_doc("setup", "doctype", "support_email_settings") reload_doc("support", "doctype", "support_ticket") reload_doc("support", "doctype", "support_ticket_response")
def execute(): import webnotes from webnotes.model import delete_doc from webnotes.modules.module_manager import reload_doc dt = { 'selling': ['quotation', 'sales_order', 'quotation_detail', 'sales_order_detail'], 'stock': ['delivery_note', 'delivery_note_detail', 'purchase_receipt', 'purchase_receipt_detail'], 'accounts': ['receivable_voucher', 'payable_voucher', 'rv_detail', 'pv_detail', 'rv_tax_detail', 'purchase_tax_detail'], 'buying': ['purchase_order', 'po_detail'] } for m in dt: for d in dt[m]: reload_doc(m, 'doctype', d) webnotes.conn.sql("""delete from `tabDocField` where label in ('Note1', 'OT Notes', 'Note', 'Note HTML', 'Rates HTML') and parent in ('Quotation', 'Sales Order', 'Delivery Note', 'Receivable Voucher', 'Purchase Order')""") del_flds = { 'Sales Order Detail': "'delivery_date', 'confirmation_date'", 'Delivery Note': "'supplier', 'supplier_address', 'purchase_receipt_no', 'purchase_order_no', 'transaction_date'", 'Receivable Voucher': "'voucher_date'", 'Payable Voucher': "'voucher_date'", 'Purchase Receipt': "'transaction_date'" } del_labels = { 'Delivery Note': "'Supplier Details'", 'Purchase Receipt': "'Get Currrent Stock'" } for d in del_flds: webnotes.conn.sql("delete from `tabDocField` where fieldname in (%s) and parent = '%s'"% (del_flds[d], d)) for d in del_labels: webnotes.conn.sql("delete from `tabDocField` where label in (%s) and parent = '%s'"% (del_labels[d], d)) delete_doc('DocType', 'Update Delivery Date Detail') # Reload print formats reload_doc('accounts', 'Print Format', 'Sales Invoice Classic') reload_doc('accounts', 'Print Format', 'Sales Invoice Modern') reload_doc('accounts', 'Print Format', 'Sales Invoice Spartan')
def reload_related_doctype(): """ Reload: * indent * purchase_order * po_detail """ from webnotes.modules.module_manager import reload_doc reload_doc('buying', 'doctype', 'indent') reload_doc('buying', 'doctype', 'purchase_order') reload_doc('buying', 'doctype', 'po_detail')
def execute(): """ * Reload RV Tax Detail * Reload Support Ticket * Run Install Print Format Patch * Reload DocLayer """ reload_doc('accounts', 'doctype', 'rv_tax_detail') reload_doc('support', 'doctype', 'support_ticket') reload_print_formats() reload_doc('core', 'doctype', 'doclayer')
def set_doctype_permissions(): # remove descriptions webnotes.conn.sql("update tabDocType set description=null") from webnotes.modules.module_manager import reload_doc reload_doc('core','doctype','custom_script') reload_doc('core','doctype','custom_field') reload_doc('core','doctype','property_setter') # remove admin rights webnotes.conn.sql("delete from tabUserRole where role in ('Administrator','Customer','Supplier') and parent!='Administrator'") # create custom scripts create_custom_scripts() # remove script fields reload_doc('core','doctype','doctype') # allow sys manager to read doctype, custom script allow_sys_manager()
def execute(): import webnotes from webnotes.modules.module_manager import reload_doc sql = webnotes.conn.sql # Reload item table reload_doc('accounts', 'doctype', 'pv_detail') reload_doc('buying', 'doctype', 'po_detail') reload_doc('stock', 'doctype', 'purchase_receipt_detail') # copy project value from parent to child sql("update `tabPO Detail` t1, `tabPurchase Order` t2 set t1.project_name = t2.project_name where t1.parent = t2.name and ifnull(t1.project_name, '') = ''" ) sql("update `tabPV Detail` t1, `tabPayable Voucher` t2 set t1.project_name = t2.project_name where t1.parent = t2.name and ifnull(t1.project_name, '') = ''" ) sql("update `tabPurchase Receipt Detail` t1, `tabPurchase Receipt` t2 set t1.project_name = t2.project_name where t1.parent = t2.name and ifnull(t1.project_name, '') = ''" ) # delete project from parent sql("delete from `tabDocField` where fieldname = 'project_name' and parent in ('Purchase Order', 'Purchase Receipt', 'Payable Voucher')" )
def delete_fields_dn_detail(): """ Delete old fields related to packing slip """ from webnotes.model import delete_fields delete_fields( { 'Delivery Note': [ 'print_packing_slip', 'shipping_mark', 'packed_by', 'packing_checked_by', 'Text', 'pack_size' ], 'Delivery Note Detail': [ 'pack_no', 'pack_gross_wt', 'weight_uom', 'pack_nett_wt', 'no_of_packs', 'pack_unit', 'pack_size', 'packed_by', 'packing_checked_by' ] }, delete=1) delete_fields({'Item': ['nett_weight', 'gross_weight']}, delete=1) reload_doc('stock', 'doctype', 'delivery_note') reload_doc('stock', 'doctype', 'delivery_note_detail') reload_doc('stock', 'doctype', 'item')
def execute(): import webnotes from webnotes.modules.module_manager import reload_doc reload_doc('hr', 'search_criteria', 'employeewise_balance_leave_report')
def execute(): import webnotes from webnotes.modules.module_manager import reload_doc reload_doc('selling', 'doctype', 'quotation_detail') reload_doc('selling', 'doctype', 'sales_order_detail') reload_doc('stock', 'doctype', 'delivery_note_detail') reload_doc('stock', 'doctype', 'purchase_receipt_detail') reload_doc('buying', 'doctype', 'po_detail') reload_doc('accounts', 'doctype', 'rv_detail') reload_doc('accounts', 'doctype', 'pv_detail')