How to use the expression.expression function in Expression

To help you get started, we’ve selected a few Expression examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github odoo / odoo / bin / osv / orm.py View on Github external
# if the object has a field named 'active', filter out all inactive
        # records unless they were explicitely asked for
        if 'active' in self._columns and (active_test and context.get('active_test', True)):
            if args:
                active_in_args = False
                for a in args:
                    if a[0] == 'active':
                        active_in_args = True
                if not active_in_args:
                    args.insert(0, ('active', '=', 1))
            else:
                args = [('active', '=', 1)]

        if args:
            import expression
            e = expression.expression(args)
            e.parse(cr, user, self, context)
            tables = e.get_tables()
            qu1, qu2 = e.to_sql()
            qu1 = qu1 and [qu1] or []
        else:
            qu1, qu2, tables = [], [], ['"%s"' % self._table]

        return (qu1, qu2, tables)
github ComputationalRadiationPhysics / pyDive / pyDive / distribution / optimization / lazy_evaluation / lazy_context.py View on Github external
def __enter__(self):
        self.expressions = []

        for arrays_dict in self.arrays_dicts:
            for key, value in arrays_dict.items():
                if hasattr(value, "dist_like"):
                    if type(value) is VirtualArrayOfStructs:
                        arrays_dict[key] = structured(value.map(lambda a: expression(self, a)))
                    else:
                        arrays_dict[key] = expression(self, value)