odoo res.currency
-
@1234567
context 里面传: active_test: False
context 里面的 active_test 是判断要不要过滤掉inactive 字段的一个条件
def _where_calc(self, cr, user, domain, active_test=True, context=None): """Computes the WHERE clause needed to implement an OpenERP domain. :param domain: the domain to compute :type domain: list :param active_test: whether the default filtering of records with ``active`` field set to ``False`` should be applied. :return: the query expressing the given domain as provided in domain :rtype: osv.query.Query """ if not context: context = {} domain = domain[:] # if the object has a field named 'active', filter out all inactive # records unless they were explicitely asked for if 'active' in self._fields and active_test and context.get('active_test', True): if domain: # the item[0] trick below works for domain items and '&'/'|'/'!' # operators too if not any(item[0] == 'active' for item in domain): domain.insert(0, ('active', '=', 1)) else: domain = [('active', '=', 1)]