code: def is_field_visible(self, field):
          
          context = self.context
          fieldname = field.getName()
  
          # hide the Client field on client and batch contexts
          if fieldname == "Client" and context.portal_type in ("Client", ):
              return False
  
          # hide the Batch field on batch contexts
          if fieldname == "Batch" and context.portal_type in ("Batch", ):
              return False
  
          return True
docs: Check if the field is visible