[MERGE] from trunk
[odoo/odoo.git] / addons / product / product_view.xml
index d285374..0256b9f 100644 (file)
@@ -15,7 +15,7 @@
                    <filter string="Can be Sold" name="filter_to_sell" icon="terp-accessories-archiver-minus" domain="[('sale_ok','=',1)]"/>
                    <field name="categ_id"/>
                    <group expand="0" string="Context...">
-                       <field name="pricelist_id" context="{'pricelist': self}" groups="product.group_sale_pricelist"/>
+                       <field name="pricelist_id" context="{'pricelist': self}" filter_domain="[]" groups="product.group_sale_pricelist"/>
                        <field name="company_id" groups="base.group_multi_company"/>
                    </group>
                    <group  expand='0' string='Group by...'>
@@ -38,7 +38,6 @@
                     <field name="name"/>
                     <field name="categ_id" invisible="1"/>
                     <field name="type" invisible="1"/>
-                    <field name="variants" groups="product.group_product_variant"/>
                     <field name="uom_id" string="Unit of Measure" groups="product.group_uom"/>
                     <field name="qty_available"/>
                     <field name="virtual_available"/>
                                         <div name="ean">
                                             <field name="ean13" placeholder="e.g. 5901234123457"/>
                                         </div>
-                                    </group>
-                                    <group>
-                                        <field groups="product.group_product_variant" name="variants"/>
-                                        <field name="price_margin" groups="product.group_product_variant"/>
-                                        <field name="price_extra" groups="product.group_product_variant"/>
+                                        <field name="company_id" groups="base.group_multi_company" widget="selection"/>
                                     </group>
                                 </group>
-                                <field name="description" placeholder="describe the product's characteristics for internal use..."/>
+                                <field name="description" placeholder="describe the product characteristics..."/>
                             </page>
                             <page string="Procurements" groups="base.group_user">
                                 <group name="procurement">
                                 <group name="inventory">
                                     <group name="status" string="Status">
                                         <field name="state"/>
-                                        <field name="product_manager"/>
+                                        <field name="product_manager"
+                                        context="{'default_groups_ref': ['base.group_user', 'base.group_partner_manager', 'base.group_sale_manager']}"/>
                                     </group>
                                     <group name="Weights" groups="product.group_stock_packaging" string="Weights">
                                         <field digits="(14, 3)" name="volume" attrs="{'readonly':[('type','=','service')]}"/>
                                     </group>
                                 </group>
                             </page>
-                            <page string="Sales" attrs="{'readonly':[('sale_ok','=',0)]}">
+                            <page string="Sales" attrs="{'invisible':[('sale_ok','=',False)]}">
                                 <group name="sale">
                                     <group string="Sale Conditions">
                                         <label for="warranty"/>
                         </notebook>
                     </sheet>
                     <div class="oe_chatter">
-                        <field name="message_ids" widget="mail_thread"/>
                         <field name="message_follower_ids" widget="mail_followers"/>
+                        <field name="message_ids" widget="mail_thread"/>
                     </div>
                 </form>
             </field>
                         <field name="delay"/>
                         <field name="company_id" groups="base.group_multi_company" widget="selection"/>
                     </group>
-                    <field groups="product.group_sale_pricelist" name="pricelist_ids">
+                    <p groups="product.group_purchase_pricelist" class="oe_grey">The prices below will only be taken into account when your pricelist is set as based on supplier prices.</p>
+                    <field groups="product.group_purchase_pricelist" name="pricelist_ids">
                         <tree editable="bottom" string="Pricelist">
                             <field name="min_quantity"/>
                             <field name="price"/>
             </field>
         </record>
 
+        <!-- Variants -->
         <record id="product_variant_form_view" model="ir.ui.view">
             <field name="name">product.variant.form</field>
             <field name="model">product.product</field>
                     <group col="4">
                         <field name="product_tmpl_id"/>
                         <field name="active"/>
-                        <field name="variants"/>
+                        <field name="variants" required="1"/>
                         <field name="default_code"/>
                         <field name="price_margin"/>
                         <field name="price_extra"/>
                 </form>
             </field>
         </record>
-
         <record id="product_variant_tree_view" model="ir.ui.view">
             <field name="name">product.variant.tree</field>
             <field name="model">product.product</field>
             <field name="arch" type="xml">
                 <tree string="Product Variant">
                     <field name="product_tmpl_id"/>
-                    <field name="active"/>
                     <field name="variants"/>
                     <field name="default_code"/>
                     <field name="price_margin"/>
                     <field name="price_extra"/>
+                    <field name="company_id" invisible="1"/>
+                    <field name="type" invisible="1"/>
+                    <field name="uom_id" invisible="1"/>
+                    <field name="categ_id" invisible="1"/>
                 </tree>
             </field>
         </record>
+        <record id="product_variant_action" model="ir.actions.act_window">
+            <field name="name">Product Variants</field>
+            <field name="type">ir.actions.act_window</field>
+            <!--<field name="domain">[('variants','&lt;&gt;', False)]</field>-->
+            <field name="res_model">product.product</field>
+            <field name="view_type">form</field>
+            <field name="view_mode">tree,form,kanban</field>
+            <field name="view_id" ref="product_variant_tree_view"/>
+            <field name="search_view_id" ref="product_search_form_view"/>
+            <field name="help" type="html">
+              <p class="oe_view_nocontent_create">
+                Click to define a new variant of product.
+              </p>
+            </field>
+        </record>
+        <record id="tree_view_product_variant" model="ir.actions.act_window.view">
+            <field name="sequence" eval="10"/>
+            <field name="view_mode">tree</field>
+            <field name="view_id" ref="product_variant_tree_view"/>
+            <field name="act_window_id" ref="product_variant_action"/>
+        </record>
+        <record id="form_view_product_variant" model="ir.actions.act_window.view">
+            <field name="sequence" eval="20"/>
+            <field name="view_mode">form</field>
+            <field name="view_id" ref="product_variant_form_view"/>
+            <field name="act_window_id" ref="product_variant_action"/>
+        </record>
+        <menuitem action="product.product_variant_action" id="product.menu_variant_product" parent="base.menu_product" sequence="100" groups="product.group_product_variant"/>
 
+        <!-- templates -->
         <record id="product_template_tree_view" model="ir.ui.view">
             <field name="name">product.template.product.tree</field>
             <field name="model">product.template</field>
                             <group name="status" string="Status">
                                 <field name="categ_id"/>
                                 <field name="state"/>
-                                <field name="product_manager"/>
+                                <field name="product_manager" context="{'default_groups_ref': ['base.group_user', 'base.group_partner_manager', 'base.group_sale_manager']}"/>
                             </group>
 
                             <group name="uom" string="Unit of Measure">