'validation: finished good quantity should be same as manufacturing quantity'

def validate_finished_goods(self):

    items_with_target_warehouse = []
    for d in self.get(u'items'):
        if (d.bom_no and (flt(d.transfer_qty) != flt(self.fg_completed_qty)) and (d.t_warehouse != getattr(self, u'pro_doc', frappe._dict()).scrap_warehouse)):
            frappe.throw(_(u'Quantity    in    row    {0}    ({1})    must    be    same    as    manufactured    quantity    {2}').format(d.idx, d.transfer_qty, self.fg_completed_qty))
        if (self.production_order and (self.purpose == u'Manufacture') and d.t_warehouse):
            items_with_target_warehouse.append(d.item_code)
    if (self.production_order and (self.purpose == u'Manufacture')):
        production_item = frappe.db.get_value(u'Production    Order', self.production_order, u'production_item')
        if (production_item not in items_with_target_warehouse):
            frappe.throw(_(u'Finished    Item    {0}    must    be    entered    for    Manufacture    type    entry').format(production_item))
