'Check if Time Sheets are completed against before manufacturing to capture operating costs.'

def check_if_operations_completed(self):

    prod_order = frappe.get_doc(u'Production    Order', self.production_order)
    for d in prod_order.get(u'operations'):
        total_completed_qty = (flt(self.fg_completed_qty) + flt(prod_order.produced_qty))
        if (total_completed_qty > flt(d.completed_qty)):
            frappe.throw(_(u'Row    #{0}:    Operation    {1}    is    not    completed    for    {2}    qty    of    finished    goods    in    Production    Order    #    {3}.    Please    update    operation    status    via    Time    Logs').format(d.idx, d.operation, total_completed_qty, self.production_order), OperationsNotCompleteError)
