[FIX] Fix inheritance in point_of_sale views + ean visible on creation + landed costs...
authorJosse Colpaert <jco@odoo.com>
Tue, 30 Sep 2014 11:34:44 +0000 (13:34 +0200)
committerJosse Colpaert <jco@odoo.com>
Mon, 6 Oct 2014 07:14:20 +0000 (09:14 +0200)
[IMP] Set custom EAN not visible when multiple variants

[IMP] Change landed costs views + make ean visible upon creation

addons/point_of_sale/point_of_sale_view.xml
addons/product/product_view.xml
addons/stock_landed_costs/stock_landed_costs_view.xml

index 1230baf..82cb35a 100644 (file)
                         <field name="expense_pdt"/>
                     </group>
                 </group>
+            </field>
+        </record>
+        <record id="product_template_form_view_inherit_ean" model="ir.ui.view">
+            <field name="name">product.template.only.form.inherit.ean</field>
+            <field name="model">product.template</field>
+            <field name="inherit_id" ref="product.product_template_only_form_view"/>
+            <field name="arch" type="xml">
+                <field name="ean13" position="after">
+                    <button colspan="2" name="%(action_edit_ean)d" type="action" string="Set a Custom EAN"
+                            attrs="{'invisible': [('product_variant_count', '>', 1)]}" class="oe_link oe_edit_only"/>
+                </field>
+            </field>
+        </record>
+        <record id="product_normal_form_view_inherit_ean" model="ir.ui.view">
+            <field name="name">product.form.inherit.ean</field>
+            <field name="model">product.product</field>
+            <field name="inherit_id" ref="product.product_normal_form_view"/>
+            <field name="arch" type="xml">
                 <field name="ean13" position="after">
                     <button colspan="2" name="%(action_edit_ean)d" type="action" string="Set a Custom EAN" class="oe_link oe_edit_only"/>
                 </field>
index cd481fe..88aa0d9 100644 (file)
                     <attribute name="name">Product Template</attribute>
                 </xpath>
                 <field name="active" position="after">
-                    <field name="ean13" attrs="{'invisible': [('product_variant_count', '!=', 1)]}"/>
-                    <field name="default_code" attrs="{'invisible': [('product_variant_count', '!=', 1)]}"/>
+                    <field name="ean13" attrs="{'invisible': [('product_variant_count', '>', 1)]}"/>
+                    <field name="default_code" attrs="{'invisible': [('product_variant_count', '>', 1)]}"/>
                 </field>
                 <xpath expr="//page[@string='Sales']" position="after">
                     <page name="variants" string="Variants">
index 74de718..4bbeadd 100644 (file)
@@ -18,7 +18,7 @@
                             <label for="name" class="oe_edit_only"/>
                             <h1>
                                 <field name="name" class="oe_inline"/>
-                               </h1>
+                            </h1>
                         </div>
                         <group>
                             <group>
@@ -38,7 +38,7 @@
                                         <group>
                                             <group>
                                                 <field name="product_id"
-                                                    on_change="onchange_product_id(product_id)" domain="[('landed_cost_ok', '=', True)]" context="{'default_landed_cost_ok': True}"/>
+                                                    on_change="onchange_product_id(product_id)" domain="[('landed_cost_ok', '=', True)]" context="{'default_landed_cost_ok': True, 'form_view_ref':'stock_landed_costs.view_stock_landed_cost_type_form'}"/>
                                                 <field name="price_unit"/>
                                             </group>
                                             <group>
@@ -50,7 +50,7 @@
                                         <field name="name"/>
                                     </form>
                                     <tree string="Cost Lines" editable="bottom">
-                                        <field name="product_id" on_change="onchange_product_id(product_id)" domain="[('landed_cost_ok', '=', True)]" context="{'default_landed_cost_ok': True}"/>
+                                        <field name="product_id" on_change="onchange_product_id(product_id)" domain="[('landed_cost_ok', '=', True)]" context="{'default_landed_cost_ok': True, 'form_view_ref':'stock_landed_costs.view_stock_landed_cost_type_form'}"/>
                                         <field name="name"/>
                                         <field name="account_id"/>
                                         <field name="split_method"/>
         <menuitem action="action_stock_landed_cost" name="Landed Costs" parent="menu_stock_landed_cost_main" id="menu_stock_landed_cost" sequence="1"/>
 
         <!-- Stock Landed Cost Type View -->
-       <record id="view_stock_landed_cost_type_form" model="ir.ui.view">
+        <record id="view_stock_landed_cost_type_form" model="ir.ui.view">
             <field name="name">stock.landed.cost.type.form</field>
             <field name="model">product.product</field>
-           <field name="arch" type="xml">
+            <field name="priority">25</field>
+            <field name="arch" type="xml">
                 <form string="Landed Costs">
-                   <sheet>
+                    <sheet>
                         <field name="image_medium" widget="image" class="oe_avatar oe_left"/>
                         <div class="oe_title">
                             <div class="oe_edit_only">
                                 <field name="name" class="oe_inline"/>
                             </h1>
                             <label for="categ_id" class="oe_edit_only"/>
-                            <h2><field name="categ_id"/></h2>
+                            <h2>
+                                <field name="categ_id"/>
+                            </h2>
                             <div name="options" groups="base.group_user">
-                               <field name="landed_cost_ok" readonly="1"/>
-                               <label for="landed_cost_ok"/>
-                                <field name="active" />
-                               <label for="active"/>
+                                <field name="landed_cost_ok" readonly="1"/>
+                                <label for="landed_cost_ok"/>
+                                <field name="active"/>
+                                <label for="active"/>
                             </div>
                         </div>
                         <notebook>
                             <page string="Information">
                                 <group>
                                     <group>
-                                       <field name="split_method"/>
+                                        <field name="split_method"/>
                                         <field name="standard_price"/>
                                         <field name="property_account_expense"/>
                                     </group>
                         <field name="message_ids" widget="mail_thread"/>
                     </div>
                 </form>
-           </field>
-       </record>
+            </field>
+        </record>
 
         <!-- Stock Landed Cost Type Tree View -->
         <record id="stock_landed_cost_tree_view" model="ir.ui.view">
             <field name="domain">[('landed_cost_ok','=',True)]</field>
             <field name="view_type">form</field>
             <field name="view_mode">tree,form</field>
-           <field name="context">{'default_landed_cost_ok': True}</field>
+            <field name="context">{'default_landed_cost_ok': True}</field>
             <field name="search_view_id" ref="product.product_search_form_view"/>
             <field name="help" type="html">
               <p class="oe_view_nocontent_create">
               </p>
             </field>
         </record>
-       
+
         <record id="stock_landed_cost_type_action1" model="ir.actions.act_window.view">
            <field eval="1" name="sequence"/>
            <field name="view_mode">tree</field>
            <field name="act_window_id" ref="stock_landed_cost_type_action"/>
         </record>
 
-       <menuitem action="stock_landed_cost_type_action" name="Landed Cost Type" parent="stock.menu_stock_configuration" id="menu_stock_landed_cost_type" sequence="1"/>
+    <menuitem action="stock_landed_cost_type_action" name="Landed Cost Type" parent="stock.menu_stock_configuration" id="menu_stock_landed_cost_type" sequence="1"/>
 
     </data>
 </openerp>