'Raise exception if Table field is empty.'

def validate_table_has_rows(self, parentfield, raise_exception=None):

    if (not (isinstance(self.get(parentfield), list) and (len(self.get(parentfield)) > 0))):
        label = self.meta.get_label(parentfield)
        frappe.throw(_(u'Table    {0}    cannot    be    empty').format(label), (raise_exception or frappe.EmptyTableError))
