[FIX] stock: improve speed of product's stock quantity/value calculation
[odoo/odoo.git] / addons / stock / product_view.xml
index 4f6ede6..24da97c 100644 (file)
@@ -8,8 +8,8 @@
             <field name="type">search</field>
             <field name="inherit_id" ref="product.product_search_form_view"/>
             <field name="arch" type="xml">
-                   <field name="pricelist_id" widget="selection" position="before">
-                       <field name="location_id" widget="selection" context="{'location': self}" />
+                   <field name="pricelist_id" position="before">
+                       <field name="location_id" context="{'location': self}"/>
                        <separator orientation="vertical"/>
                    </field>
             </field>
                         <separator string="Accounting Stock Properties" colspan="2"/>
                         <field name="property_stock_account_input_categ" domain="[('type','&lt;&gt;','view'),('type','&lt;&gt;','consolidation')]"/>
                         <field name="property_stock_account_output_categ" domain="[('type','&lt;&gt;','view'),('type','&lt;&gt;','consolidation')]"/>
+                        <field name="property_stock_variation"/>
                         <field name="property_stock_journal"/>
                     </group>
                 </form>
             </field>
         </record>
 
-
-
         <record id="view_template_property_form" model="ir.ui.view">
             <field name="name">product.template.stock.property.form.inherit</field>
             <field name="model">product.template</field>
@@ -43,9 +42,9 @@
                  <page position="after" string="Information">
                     <page string="Properties">
                         <separator string="Counter-Part Locations Properties" colspan="4"/>
-                        <field name="property_stock_procurement"  widget="selection"/>
-                        <field name="property_stock_production"  widget="selection"/>
-                        <field name="property_stock_inventory"  widget="selection"/>
+                        <field name="property_stock_procurement" domain="[('usage','=','procurement')]"/>
+                        <field name="property_stock_production" domain="[('usage','=','production')]"/>
+                        <field name="property_stock_inventory" domain="[('usage','=','inventory')]"/>
                         <separator string="Accounting Entries" colspan="4"/>
                         <field name="property_stock_account_input" domain="[('type','&lt;&gt;','view'),('type','&lt;&gt;','consolidation')]"/>
                         <field name="property_stock_account_output" domain="[('type','&lt;&gt;','view'),('type','&lt;&gt;','consolidation')]"/>
             <field name="inherit_id" ref="product.product_normal_form_view"/>
             <field name="arch" type="xml">
                 <field name="standard_price" position="replace">
-                    <label string="Cost Price" align="1.0"/>
+                    <label string="Cost Price:" align="1.0"/>
                     <group col="2" colspan="1">
-                        <field name="standard_price" readonly="True" nolabel="1"/>
-                        <button name="%(action_view_change_standard_price)d" string="Change Price" type="action" icon="gtk-execute"/>
+                        <field name="standard_price" attrs="{'readonly':[('cost_method','=','average')]}" nolabel="1"/>
+                        <button name="%(action_view_change_standard_price)d" string="Update"
+                            type="action" icon="gtk-execute" attrs="{'invisible':[('cost_method','&lt;&gt;','average')]}"/>
                     </group>
                 </field>
             </field>
             <field name="inherit_id" ref="product.product_normal_form_view"/>
             <field name="priority">26</field>
             <field name="arch" type="xml">
-                <field name="property_account_expense" position="after">
-                    <field name="property_stock_account_output" domain="[('type','&lt;&gt;','view'),('type','&lt;&gt;','consolidation')]" groups="base.group_extended"/>
-                    <field name="property_stock_account_input" domain="[('type','&lt;&gt;','view'),('type','&lt;&gt;','consolidation')]" groups="base.group_extended"/>
-                </field>
+                <xpath expr="/form/notebook/page/group[@name='properties']" position="before">
+                    <group groups="base.group_extended">
+                        <separator string="Inventory Valuation" colspan="4"/>
+                        <group colspan="2" col="2">
+                            <field name="valuation"/>
+                        </group>
+                        <group colspan="2" col="2">
+                            <field name="property_stock_account_input" attrs="{'readonly':[('valuation', '!=', 'real_time')]}"
+                                domain="[('type','&lt;&gt;','view'),('type','&lt;&gt;','consolidation')]" groups="base.group_extended"/>
+                            <field name="property_stock_account_output" attrs="{'readonly':[('valuation', '!=', 'real_time')]}"
+                                domain="[('type','&lt;&gt;','view'),('type','&lt;&gt;','consolidation')]" groups="base.group_extended"/>
+                        </group>
+                    </group>
+                    <newline/>
+                </xpath>
             </field>
         </record>
 
             <field name="inherit_id" ref="product.product_normal_form_view"/>
             <field name="arch" type="xml">
                 <group name="status" position="after">
-                    <group colspan="2" col="2">
+                    <group colspan="2" col="3">
                         <separator string="Stocks" colspan="4"/>
                         <field name="qty_available"/>
+                        <button name="%(action_view_change_product_quantity)d" string="Update" attrs="{'invisible': [('type', '=', 'service')]}"
+                            type="action" icon="gtk-execute" groups = "stock.group_stock_manager,stock.group_stock_user"/>
+                        <newline/>
                         <field name="virtual_available"/>
                     </group>
                     <group colspan="2" col="2" name="lot" groups="base.group_extended">
                 <group name="store" position="after">
                     <group col="2" colspan="2" name="store" groups="base.group_extended">
                         <separator string="Counter-Part Locations Properties" colspan="2"/>
-                        <field name="property_stock_procurement" widget="selection" domain="[('usage','=','procurement')]"/>
-                        <field name="property_stock_production" widget="selection"/>
-                        <field name="property_stock_inventory" widget="selection"/>
+                        <field name="property_stock_procurement" attrs="{'readonly':[('type','=','service')]}" domain="[('usage','=','procurement')]"/>
+                        <field name="property_stock_production" attrs="{'readonly':[('type','=','service')]}" domain="[('usage','=','production')]"/>
+                        <field name="property_stock_inventory"  attrs="{'readonly':[('type','=','service')]}" domain="[('usage','=','inventory')]"/>
                     </group>
                 </group>
             </field>
         </record>
 
-        <record id="view_product_valuation_form" model="ir.ui.view">
+<!--        <record id="view_product_valuation_form" model="ir.ui.view">
             <field name="name">product.valuation.stock.form.inherit</field>
             <field name="model">product.product</field>
             <field name="type">form</field>
                     <field name="valuation"/>
                 </field>
             </field>
-        </record>
-
+        </record>-->
 
     </data>
 </openerp>