← Back to team overview

openerp-community-reviewer team mailing list archive

[Merge] lp:~camptocamp/openerp-product-attributes/6.1-fix-search-no-lot-attributes-lep into lp:openerp-product-attributes/6.1

 

Leonardo Pistone @ camptocamp has proposed merging lp:~camptocamp/openerp-product-attributes/6.1-fix-search-no-lot-attributes-lep into lp:openerp-product-attributes/6.1.

Requested reviews:
  Product Core Editors (product-core-editors)
Related bugs:
  Bug #1275000 in OpenERP Product Attributes: "production_lot_custom_attributes: search all attributes fails if no attributes are defined in the system"
  https://bugs.launchpad.net/openerp-product-attributes/+bug/1275000

For more details, see:
https://code.launchpad.net/~camptocamp/openerp-product-attributes/6.1-fix-search-no-lot-attributes-lep/+merge/204296
-- 
https://code.launchpad.net/~camptocamp/openerp-product-attributes/6.1-fix-search-no-lot-attributes-lep/+merge/204296
Your team Product Core Editors is requested to review the proposed merge of lp:~camptocamp/openerp-product-attributes/6.1-fix-search-no-lot-attributes-lep into lp:openerp-product-attributes/6.1.
=== modified file 'production_lot_custom_attributes/lot.py'
--- production_lot_custom_attributes/lot.py	2014-01-16 10:27:09 +0000
+++ production_lot_custom_attributes/lot.py	2014-01-31 17:40:58 +0000
@@ -115,11 +115,16 @@
         def expand(arg):
             """Expand each argument in a domain we can pass upstream"""
             if isinstance(arg, tuple) and arg[0] == name:
-                return (
-                    ['|'] +
-                    expand_serialized(arg) +
-                    expand_not_serialized(arg)
-                )
+                # this is never empty, at worst it is [('id', 'in', [])]
+                res = expand_serialized(arg)
+
+                # this can be an empty list
+                not_serialized = expand_not_serialized(arg)
+                if not_serialized:
+                    res = ['|'] + res + not_serialized
+
+                return res
+
             else:
                 return [arg]
         return list(itertools.chain.from_iterable(expand(arg) for arg in args))