← Back to team overview

openerp-community team mailing list archive

lp:~camptocamp/openerp-product-attributes/7.0-required-on-attributes-gbr into lp:openerp-product-attributes

 

Guewen Baconnier @ Camptocamp has proposed merging lp:~camptocamp/openerp-product-attributes/7.0-required-on-attributes-gbr into lp:openerp-product-attributes.

Commit message:
[ADD] base_custom_attributes: required attribute is not honored when defined on the ir.model.fields and is not accessible on the attributes

Requested reviews:
  Product Core Editors (product-core-editors)

For more details, see:
https://code.launchpad.net/~camptocamp/openerp-product-attributes/7.0-required-on-attributes-gbr/+merge/188617

base_custom_attributes: required attribute is not honored when defined on the ir.model.fields and is not accessible on the attributes

This MP adds the field on the attribute and change the dynamic view to honor this field.
-- 
https://code.launchpad.net/~camptocamp/openerp-product-attributes/7.0-required-on-attributes-gbr/+merge/188617
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-09-27 19:24:53 +0000
+++ base_custom_attributes/custom_attributes.py	2013-10-01 14:41:12 +0000
@@ -126,6 +126,7 @@
                     kwargs['domain'] = "[('id', 'in', %s)]" % ids
             else:
                 kwargs['domain'] = "[('attribute_id', '=', %s)]" % attribute.attribute_id.id
+        kwargs['required'] = str(attribute.required)
         field = etree.SubElement(parent, 'field', **kwargs)
         orm.setup_modifiers(field, self.fields_get(cr, uid, attribute.name, context))
         return parent

=== modified file 'base_custom_attributes/custom_attributes_view.xml'
--- base_custom_attributes/custom_attributes_view.xml	2013-06-18 16:16:56 +0000
+++ base_custom_attributes/custom_attributes_view.xml	2013-10-01 14:41:12 +0000
@@ -144,6 +144,7 @@
                     <field name="model_id" />
                     <field name="serialized" attrs="{'invisible':[('attribute_type', '=', 'multiselect')]}"/>
                     <field name="size" attrs="{'invisible':[('attribute_type', '!=', 'char')]}"/>
+                    <field name="required" attrs="{'invisible': [('attribute_type', 'in', ('boolean', 'float', 'integer'))]}"/>
                     <field name="translate" attrs="{'invisible':[('attribute_type', 'not in', ('char', 'text'))]}"/>
                     <newline />
                     <group colspan="4" attrs="{'invisible':[('attribute_type', 'not in', ['select', 'multiselect'])]}">


Follow ups