Merge lp:~camptocamp/openerp-product-attributes/7.0-no-attribute_id-on-option-creation-gbr into lp:~product-core-editors/openerp-product-attributes/7.0

Proposed by Guewen Baconnier @ Camptocamp
Status: Merged
Merged at revision: 222
Proposed branch: lp:~camptocamp/openerp-product-attributes/7.0-no-attribute_id-on-option-creation-gbr
Merge into: lp:~product-core-editors/openerp-product-attributes/7.0
Diff against target: 56 lines (+28/-0)
2 files modified
base_custom_attributes/custom_attributes.py (+1/-0)
base_custom_attributes/custom_attributes_view.xml (+27/-0)
To merge this branch: bzr merge lp:~camptocamp/openerp-product-attributes/7.0-no-attribute_id-on-option-creation-gbr
Reviewer Review Type Date Requested Status
Raphaël Valyi - http://www.akretion.com Approve
Quentin THEURET @Amaris (community) code review Approve
Review via email: mp+188628@code.launchpad.net

Commit message

[IMP] when creating a new option on a 'selection' attribute, the attribute_id should be pre-filled with the current attribute id and should not be editable

Description of the change

When we are editing a product and want to add a new option to an attribute,
actually, the form view for the option asks for the attribute despite the fact
that we come from an attribute.

This change does 2 things:

 * fills the attribute_id of the option with the attribute we come from
 * hide the attribute_id from the form view (but keep it displayed when accessed from the menu 'Attribute Options')

To post a comment you must log in.
Revision history for this message
Quentin THEURET @Amaris (qtheuret) :
review: Approve (code review)
Revision history for this message
Raphaël Valyi - http://www.akretion.com (rvalyi) wrote :

LGTM

review: Approve
215. By Guewen Baconnier @ Camptocamp

[MRG] from master

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'base_custom_attributes/custom_attributes.py'
--- base_custom_attributes/custom_attributes.py 2013-11-11 15:50:07 +0000
+++ base_custom_attributes/custom_attributes.py 2013-11-12 08:03:12 +0000
@@ -132,6 +132,7 @@
132 kwargs['domain'] = "[('id', 'in', %s)]" % ids132 kwargs['domain'] = "[('id', 'in', %s)]" % ids
133 else:133 else:
134 kwargs['domain'] = "[('attribute_id', '=', %s)]" % attribute.attribute_id.id134 kwargs['domain'] = "[('attribute_id', '=', %s)]" % attribute.attribute_id.id
135 kwargs['context'] = "{'default_attribute_id': %s}" % attribute.attribute_id.id
135 kwargs['required'] = str(attribute.required or136 kwargs['required'] = str(attribute.required or
136 attribute.required_on_views)137 attribute.required_on_views)
137 field = etree.SubElement(parent, 'field', **kwargs)138 field = etree.SubElement(parent, 'field', **kwargs)
138139
=== modified file 'base_custom_attributes/custom_attributes_view.xml'
--- base_custom_attributes/custom_attributes_view.xml 2013-10-16 09:50:02 +0000
+++ base_custom_attributes/custom_attributes_view.xml 2013-11-12 08:03:12 +0000
@@ -200,6 +200,19 @@
200 parent="menu_attribute_in_admin" sequence="30"/>200 parent="menu_attribute_in_admin" sequence="30"/>
201201
202 <!-- ATTRIBUTE OPTION VIEW -->202 <!-- ATTRIBUTE OPTION VIEW -->
203 <record id="attribute_option_form_popup_view" model="ir.ui.view">
204 <field name="name">attribute.option.form.popup</field>
205 <field name="model">attribute.option</field>
206 <field name="priority" eval="6"/>
207 <field name="arch" type="xml">
208 <form string="Attribute Option" col="6">
209 <field name="name" colspan="2"/>
210 <field name="value_ref" colspan="2" groups="base.group_advanced_attribute"/>
211 <field name="sequence" colspan="2"/>
212 </form>
213 </field>
214 </record>
215
203 <record id="attribute_option_form_view" model="ir.ui.view">216 <record id="attribute_option_form_view" model="ir.ui.view">
204 <field name="name">attribute.option.form</field>217 <field name="name">attribute.option.form</field>
205 <field name="model">attribute.option</field>218 <field name="model">attribute.option</field>
@@ -250,6 +263,20 @@
250 <field name="help"></field>263 <field name="help"></field>
251 </record>264 </record>
252265
266 <record id="attribute_option_form_action_tree" model="ir.actions.act_window.view">
267 <field name="sequence" eval="1"/>
268 <field name="act_window_id" ref="attribute_option_form_action"/>
269 <field name="view_id" ref="attribute_option_tree_view"/>
270 <field name="view_mode">tree</field>
271 </record>
272
273 <record id="attribute_option_form_action_form" model="ir.actions.act_window.view">
274 <field name="sequence" eval="2"/>
275 <field name="act_window_id" ref="attribute_option_form_action"/>
276 <field name="view_id" ref="attribute_option_form_view"/>
277 <field name="view_mode">form</field>
278 </record>
279
253 <menuitem280 <menuitem
254 action="attribute_option_form_action" id="menu_attribute_option_action"281 action="attribute_option_form_action" id="menu_attribute_option_action"
255 parent="menu_attribute_in_admin" sequence="40"/>282 parent="menu_attribute_in_admin" sequence="40"/>

Subscribers

People subscribed via source and target branches