Esempio n. 1
0
 def search_read_basic(self, conditions, fields=None, order='id', offset=0, limit=""):
     all_fields = self._field_dict.keys()
     if not fields:
         fields = all_fields
     else:
         fields = [f for f in fields if f in all_fields]
     where_clause = self.generate_where_clause(conditions)
     return db._get_vals_dict(self._table_name, where_clause, fields, order, offset, limit)
Esempio n. 2
0
 def read(self, ids, fields=None, order='id', offset=0, limit=""):
     all_fields = self._field_dict.keys()
     if not fields:
         fields = all_fields
     else:
         fields = [f for f in fields if f in all_fields]
     if len(ids) > 1:
         domain = [['id', 'in', tuple(ids)]]
     elif ids:
         domain = [['id', '=', ids[0]]]
     else:
         domain = []
     where_clause = self.generate_where_clause(domain)
     return db._get_vals_dict(self._table_name, where_clause, fields, order, offset, limit)
Esempio n. 3
0
    def search_read(self, conditions, fields=None, order='id', offset=0, limit=""):
        all_fields = self._field_dict.keys()
        if not fields:
            fields = all_fields
        else:
            fields = [f for f in fields if f in all_fields]
        where_clause = self.generate_where_clause(conditions)
        result = db._get_vals_dict(self._table_name, where_clause, fields, order, offset, limit)

        if result:
            relational_fields = [f for f in self.M2Os if f in result[0].keys()]
            if relational_fields:
                self.get_relational_result(result, relational_fields)

        return result