openerp-community team mailing list archive
-
openerp-community team
-
Mailing list archive
-
Message #03370
lp:~camptocamp/openerp-product-attributes/7.0-no-attribute_id-on-option-creation-gbr into lp:openerp-product-attributes
Guewen Baconnier @ Camptocamp has proposed merging lp:~camptocamp/openerp-product-attributes/7.0-no-attribute_id-on-option-creation-gbr into lp:openerp-product-attributes.
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
Requested reviews:
Product Core Editors (product-core-editors)
For more details, see:
https://code.launchpad.net/~camptocamp/openerp-product-attributes/7.0-no-attribute_id-on-option-creation-gbr/+merge/188628
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')
--
https://code.launchpad.net/~camptocamp/openerp-product-attributes/7.0-no-attribute_id-on-option-creation-gbr/+merge/188628
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 15:20:34 +0000
@@ -126,6 +126,7 @@
kwargs['domain'] = "[('id', 'in', %s)]" % ids
else:
kwargs['domain'] = "[('attribute_id', '=', %s)]" % attribute.attribute_id.id
+ kwargs['context'] = "{'default_attribute_id': %s}" % attribute.attribute_id.id
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 15:20:34 +0000
@@ -199,6 +199,19 @@
parent="menu_attribute_in_admin" sequence="30"/>
<!-- ATTRIBUTE OPTION VIEW -->
+ <record id="attribute_option_form_popup_view" model="ir.ui.view">
+ <field name="name">attribute.option.form.popup</field>
+ <field name="model">attribute.option</field>
+ <field name="priority" eval="6"/>
+ <field name="arch" type="xml">
+ <form string="Attribute Option" col="6">
+ <field name="name" colspan="2"/>
+ <field name="value_ref" colspan="2" groups="base.group_advanced_attribute"/>
+ <field name="sequence" colspan="2"/>
+ </form>
+ </field>
+ </record>
+
<record id="attribute_option_form_view" model="ir.ui.view">
<field name="name">attribute.option.form</field>
<field name="model">attribute.option</field>
@@ -249,6 +262,20 @@
<field name="help"></field>
</record>
+ <record id="attribute_option_form_action_tree" model="ir.actions.act_window.view">
+ <field name="sequence" eval="1"/>
+ <field name="act_window_id" ref="attribute_option_form_action"/>
+ <field name="view_id" ref="attribute_option_tree_view"/>
+ <field name="view_mode">tree</field>
+ </record>
+
+ <record id="attribute_option_form_action_form" model="ir.actions.act_window.view">
+ <field name="sequence" eval="2"/>
+ <field name="act_window_id" ref="attribute_option_form_action"/>
+ <field name="view_id" ref="attribute_option_form_view"/>
+ <field name="view_mode">form</field>
+ </record>
+
<menuitem
action="attribute_option_form_action" id="menu_attribute_option_action"
parent="menu_attribute_in_admin" sequence="40"/>
Follow ups