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
1=== modified file 'base_custom_attributes/custom_attributes.py'
2--- base_custom_attributes/custom_attributes.py 2013-11-11 15:50:07 +0000
3+++ base_custom_attributes/custom_attributes.py 2013-11-12 08:03:12 +0000
4@@ -132,6 +132,7 @@
5 kwargs['domain'] = "[('id', 'in', %s)]" % ids
6 else:
7 kwargs['domain'] = "[('attribute_id', '=', %s)]" % attribute.attribute_id.id
8+ kwargs['context'] = "{'default_attribute_id': %s}" % attribute.attribute_id.id
9 kwargs['required'] = str(attribute.required or
10 attribute.required_on_views)
11 field = etree.SubElement(parent, 'field', **kwargs)
12
13=== modified file 'base_custom_attributes/custom_attributes_view.xml'
14--- base_custom_attributes/custom_attributes_view.xml 2013-10-16 09:50:02 +0000
15+++ base_custom_attributes/custom_attributes_view.xml 2013-11-12 08:03:12 +0000
16@@ -200,6 +200,19 @@
17 parent="menu_attribute_in_admin" sequence="30"/>
18
19 <!-- ATTRIBUTE OPTION VIEW -->
20+ <record id="attribute_option_form_popup_view" model="ir.ui.view">
21+ <field name="name">attribute.option.form.popup</field>
22+ <field name="model">attribute.option</field>
23+ <field name="priority" eval="6"/>
24+ <field name="arch" type="xml">
25+ <form string="Attribute Option" col="6">
26+ <field name="name" colspan="2"/>
27+ <field name="value_ref" colspan="2" groups="base.group_advanced_attribute"/>
28+ <field name="sequence" colspan="2"/>
29+ </form>
30+ </field>
31+ </record>
32+
33 <record id="attribute_option_form_view" model="ir.ui.view">
34 <field name="name">attribute.option.form</field>
35 <field name="model">attribute.option</field>
36@@ -250,6 +263,20 @@
37 <field name="help"></field>
38 </record>
39
40+ <record id="attribute_option_form_action_tree" model="ir.actions.act_window.view">
41+ <field name="sequence" eval="1"/>
42+ <field name="act_window_id" ref="attribute_option_form_action"/>
43+ <field name="view_id" ref="attribute_option_tree_view"/>
44+ <field name="view_mode">tree</field>
45+ </record>
46+
47+ <record id="attribute_option_form_action_form" model="ir.actions.act_window.view">
48+ <field name="sequence" eval="2"/>
49+ <field name="act_window_id" ref="attribute_option_form_action"/>
50+ <field name="view_id" ref="attribute_option_form_view"/>
51+ <field name="view_mode">form</field>
52+ </record>
53+
54 <menuitem
55 action="attribute_option_form_action" id="menu_attribute_option_action"
56 parent="menu_attribute_in_admin" sequence="40"/>

Subscribers

People subscribed via source and target branches