~savoirfairelinux-openerp/openerp-product-attributes/product_dependencies

« back to all changes in this revision

Viewing changes to product_custom_attributes/product_attribute.py

  • Committer: Benoit Guillot
  • Date: 2013-06-13 16:55:06 UTC
  • mto: This revision was merged to the branch mainline in revision 205.
  • Revision ID: benoit.guillot@akretion.com.br-20130613165506-a132s75gi4g2vxee
[FIX] fix wrong imports and fix fields_view_get override

Show diffs side-by-side

added added

removed removed

Lines of Context:
19
19
#                                                                             #
20
20
###############################################################################
21
21
 
22
 
from openerp.osv.orm import Model
23
 
from openerp.osv import osv
 
22
from openerp.osv import orm
24
23
from openerp.osv import fields
25
24
from openerp.osv.osv import except_osv
26
25
from lxml import etree
27
26
from openerp.tools.translate import _
28
27
from unidecode import unidecode # Debian package python-unidecode
29
28
 
30
 
class attribute_option(Model):
 
29
class attribute_option(orm.Model):
31
30
    _name = "attribute.option"
32
31
    _description = "Attribute Option"
33
32
    _order="sequence"
80
79
 
81
80
    def fields_view_get(self, cr, uid, view_id=None, view_type='form', context=None, toolbar=False, submenu=False):
82
81
        res = super(attribute_option_wizard, self).fields_view_get(cr, uid, view_id, view_type, context, toolbar, submenu)
83
 
        if context and context.get("attribute_id"):
 
82
        if view_type == 'form' and context and context.get("attribute_id"):
84
83
            attr_obj = self.pool.get("product.attribute")
85
84
            model_id = attr_obj.read(cr, uid, [context.get("attribute_id")], ['relation_model_id'])[0]['relation_model_id'][0]
86
85
            relation = self.pool.get("ir.model").read(cr, uid, [model_id], ["model"])[0]["model"]
100
99
        return res
101
100
 
102
101
 
103
 
class product_attribute(Model):
 
102
class product_attribute(orm.Model):
104
103
    _name = "product.attribute"
105
104
    _description = "Product Attribute"
106
105
    _inherits = {'ir.model.fields': 'field_id'}
187
186
            name = 'x_%s' % name
188
187
        return  {'value' : {'name' : unidecode(name)}}
189
188
 
190
 
class attribute_location(Model):
 
189
 
 
190
class attribute_location(orm.Model):
191
191
    _name = "attribute.location"
192
192
    _description = "Attribute Location"
193
193
    _order="sequence"
208
208
        }
209
209
 
210
210
 
211
 
 
212
 
class attribute_group(Model):
 
211
class attribute_group(orm.Model):
213
212
    _name= "attribute.group"
214
213
    _description = "Attribute Group"
215
214
    _order="sequence"
227
226
                attribute[2]['attribute_set_id'] = vals['attribute_set_id']
228
227
        return super(attribute_group, self).create(cr, uid, vals, context)
229
228
 
230
 
class attribute_set(Model):
 
229
 
 
230
class attribute_set(orm.Model):
231
231
    _name = "attribute.set"
232
232
    _description = "Attribute Set"
233
233
    _columns = {