~angelmoya/product-extra-addons/nan_product_pack

« back to all changes in this revision

Viewing changes to product_custom_attributes/product_attribute.py

  • Committer: Benoit Guillot
  • Date: 2012-08-09 10:01:01 UTC
  • Revision ID: benoit.guillot@akretion.com.br-20120809100101-47c9zq1cuxmgyyo2
[IMP] product_custom_attributes : improve multi_languages management

Show diffs side-by-side

added added

removed removed

Lines of Context:
46
46
        'serialized': fields.boolean('Field serialized', help="If serialized, the field will be stocked in the serialized field : attribute_custom_tmpl or attribute_custom_variant depending on the field based_on"),
47
47
        'based_on': fields.selection([('product_template','Product Template'),('product_product','Product Variant')],'Based on', required=True),
48
48
        'option_ids': fields.one2many('attribute.option', 'attribute_id', 'Attribute Option'),
 
49
        'create_date': fields.datetime('Created date', readonly=True),
49
50
    }
50
51
 
51
52
    def create(self, cr, uid, vals, context=None):
67
68
                raise osv.except_osv(_('Create Error'), _("The field serialized should be ticked for a multiselect field !"))
68
69
        else:
69
70
            vals['ttype'] = vals['attribute_type']
70
 
        vals['field_description'] = vals['name'][2:].capitalize()
71
71
        vals['state'] = 'manual'
72
72
        return super(product_attribute, self).create(cr, uid, vals, context)
73
73
 
 
74
    def onchange_field_description(self, cr, uid, ids, field_description, context=None):
 
75
        name = 'x_'
 
76
        if field_description:
 
77
            name = 'x_%s' % field_description.replace(' ', '_').lower()
 
78
        return  {'value' : {'name' : name}}
 
79
 
74
80
class attribute_location(osv.osv):
75
81
 
76
82
    _name = "attribute.location"