'Fetch operations from BOM and set in \'Production Order\''

def set_production_order_operations(self):

    self.set(u'operations', [])
    if ((not self.bom_no) or cint(frappe.db.get_single_value(u'Manufacturing    Settings', u'disable_capacity_planning'))):
        return
    if self.use_multi_level_bom:
        bom_list = frappe.get_doc(u'BOM', self.bom_no).traverse_tree()
    else:
        bom_list = [self.bom_no]
    operations = frappe.db.sql((u'\n DCTB  DCTB  DCTB select    \n DCTB  DCTB  DCTB  DCTB operation,    description,    workstation,    idx,\n DCTB  DCTB  DCTB  DCTB base_hour_rate    as    hour_rate,    time_in_mins,    \n DCTB  DCTB  DCTB  DCTB "Pending"    as    status,    parent    as    bom\n DCTB  DCTB  DCTB from\n DCTB  DCTB  DCTB  DCTB `tabBOM    Operation`\n DCTB  DCTB  DCTB where\n DCTB  DCTB  DCTB  DCTB     parent    in    (%s)    order    by    idx\n DCTB  DCTB ' % u',    '.join(([u'%s'] * len(bom_list)))), tuple(bom_list), as_dict=1)
    self.set(u'operations', operations)
    self.calculate_time()
