← Back to team overview

openerp-community team mailing list archive

[Merge] lp:~camptocamp/openerp-product-attributes/7.0-fix-1245875-yvr into lp:openerp-product-attributes

 

Yannick Vaucher @ Camptocamp has proposed merging lp:~camptocamp/openerp-product-attributes/7.0-fix-1245875-yvr into lp:openerp-product-attributes.

Requested reviews:
  Quentin THEURET @TeMPO Consulting (qt-tempo-consulting)
  Guewen Baconnier @ Camptocamp (gbaconnier-c2c): code review
Related bugs:
  Bug #1245875 in OpenERP Product Attributes: "[7.0] base_custom_attributes - openerp-server revno 5107 breaks product attribute selection field"
  https://bugs.launchpad.net/openerp-product-attributes/+bug/1245875

For more details, see:
https://code.launchpad.net/~camptocamp/openerp-product-attributes/7.0-fix-1245875-yvr/+merge/193066

Fix issue due to more strict control on selection attribute of reference field
-- 
https://code.launchpad.net/~camptocamp/openerp-product-attributes/7.0-fix-1245875-yvr/+merge/193066
Your team OpenERP Community is subscribed to branch lp:openerp-product-attributes.
=== modified file 'base_custom_attributes/custom_attributes.py'
--- base_custom_attributes/custom_attributes.py	2013-10-16 09:50:02 +0000
+++ base_custom_attributes/custom_attributes.py	2013-10-29 14:20:07 +0000
@@ -32,9 +32,15 @@
     _description = "Attribute Option"
     _order="sequence"
 
+    def _get_model_list(self, cr, uid, context=None):
+        model_pool = self.pool.get('ir.model')
+        ids = model_pool.search(cr, uid, [], context=context)
+        res = model_pool.read(cr, uid, ids, ['model', 'name'], context=context)
+        return [(r['model'], r['name']) for r in res]
+
     _columns = {
         'name': fields.char('Name', size=128, translate=True, required=True),
-        'value_ref': fields.reference('Reference', selection=[], size=128),
+        'value_ref': fields.reference('Reference', selection=_get_model_list, size=128),
         'attribute_id': fields.many2one('attribute.attribute', 'Product Attribute', required=True),
         'sequence': fields.integer('Sequence'),
     }


References