[IMP] stock: Inventory Analysis report add the product_uom,improve the search view
authorsbh (Open ERP) <sbh@tinyerp.com>
Thu, 23 Sep 2010 08:55:35 +0000 (14:25 +0530)
committersbh (Open ERP) <sbh@tinyerp.com>
Thu, 23 Sep 2010 08:55:35 +0000 (14:25 +0530)
bzr revid: sbh@tinyerp.com-20100923085535-zl6lffmrnd8g0coy

addons/stock/report/report_stock_move.py
addons/stock/report/report_stock_move_view.xml

index 1651607..b623c9c 100644 (file)
@@ -133,6 +133,7 @@ class report_stock_inventory(osv.osv):
         'date': fields.datetime('Date', readonly=True),
         'partner_id':fields.many2one('res.partner.address', 'Partner', readonly=True),
         'product_id':fields.many2one('product.product', 'Product', readonly=True),
+        'product_uom':fields.many2one('product.uom', 'Product UOM', readonly=True),
         'location_id': fields.many2one('stock.location', 'Location', readonly=True),
         'prodlot_id': fields.many2one('stock.production.lot', 'Lot', readonly=True),
         'company_id': fields.many2one('res.company', 'Company', readonly=True),
@@ -150,7 +151,7 @@ create or replace view report_stock_inventory as (
     (select
         min(m.id) as id, m.date as date,
         m.address_id as partner_id, m.location_id as location_id,
-        m.product_id as product_id, l.usage as location_type,
+        m.product_id as product_id,  m.product_uom as product_uom,l.usage as location_type,
         m.company_id,
         m.state as state, m.prodlot_id as prodlot_id,
         sum(-m.product_qty*u.factor)::decimal as product_qty,
@@ -164,12 +165,12 @@ create or replace view report_stock_inventory as (
                 left join stock_location l on (m.location_id=l.id)
     group by
         m.id, m.product_id, m.address_id, m.location_id, m.prodlot_id,
-        m.date, m.state, l.usage, m.company_id
+        m.date, m.state, l.usage, m.company_id,m.product_uom
 ) union all (
     select
         -m.id as id, m.date as date,
         m.address_id as partner_id, m.location_dest_id as location_id,
-        m.product_id as product_id, l.usage as location_type,
+        m.product_id as product_id, m.product_uom as product_uom, l.usage as location_type,
         m.company_id,
         m.state as state, m.prodlot_id as prodlot_id,
         sum(m.product_qty*u.factor)::decimal as product_qty,
@@ -182,7 +183,7 @@ create or replace view report_stock_inventory as (
             left join product_uom u on (m.product_uom=u.id)
                 left join stock_location l on (m.location_dest_id=l.id)
     group by
-        m.id, m.product_id, m.address_id, m.location_id, m.location_dest_id,
+        m.id, m.product_id, m.product_uom , m.address_id, m.location_id, m.location_dest_id,
         m.prodlot_id, m.date, m.state, l.usage, m.company_id
     )
 );
index 57eb5ed..0ee0850 100644 (file)
                 <field name="location_type" invisible="1"/>
                 <field name="location_id" invisible="1"/>
                 <field name="partner_id" invisible="1" context="{'contact_display':'partner'}"/>
+                <field name="product_uom" invisible="1"/>
                 <field name="product_id" invisible="1"/>
                 <field name="prodlot_id" invisible="1"/>
                 <field name="state" invisible="1"/>
                 <group col="16">
                     <filter string="Real"
                         name="real"
-                        icon="terp-dialog-close"
+                        icon="terp-check"
                         domain="[('state','=','done')]"
                         help="Analysis of current inventory (only moves that have already been processed)"/>
 
                     <filter string="Future"
-                        icon="terp-camera_test"
+                        icon="terp-stock"
                         domain="[('state','in',('assigned','done','waiting','confirmed'))]"
                         help = "Analysis including future moves (similar to virtual stock)"/>
 
                     <filter icon="terp-go-home" name="location_type_internal" string="Internal" domain="[('location_type','=','internal')]"/>
                     <filter icon="terp-go-home" name="location_type_scrap" string="Scrap" domain="[('location_type','=','scrap')]"/>
                     <separator orientation="vertical"/>
-                    <field name="date"/>
                     <field name="product_id"/>
                     <field name="location_id"/>
                     <field name="company_id" groups="base.group_multi_company"/>
                 </group>
 
                 <newline/>
-                <group expand="1" string="Group By..." >
+                <group expand="0" string="Group By..." >
                     <filter string="Partner" name="group_partner" icon="terp-personal" domain="[]" context="{'group_by':'partner_id'}"/>
+                    <separator orientation="vertical"/>
+                    <filter name="group_product_uom" string="Product UOM" icon="terp-accessories-archiver" context="{'group_by':'product_uom'}"/>
                     <filter name="group_product" string="Product" icon="terp-accessories-archiver" context="{'group_by':'product_id'}"/>
+                     <filter name="group_lot" string="Lot" context="{'group_by':'prodlot_id'}"/>
                     <separator orientation="vertical"/>
                     <filter name="group_company" string="Company" context="{'group_by':'company_id'}"/>
                     <filter name="group_location" string="Location" context="{'group_by':'location_id'}"/>
-                    <filter name="group_lot" string="Lot" context="{'group_by':'prodlot_id'}"/>
                     <separator orientation="vertical"/>
                     <filter string="Date" icon="terp-go-month" context="{'group_by':'date'}"/>
                     <filter string="State" icon="terp-stock_effects-object-colorize" context="{'group_by':'state'}"/>
                 <newline/>
                 <group expand="0" string="Extended Filters..."  groups="base.group_extended">
                     <field name="partner_id" context="{'contact_display':'partner'}"/>
+                    <field name="product_uom" />
                     <field name="prodlot_id"/>
                     <field name="state"/>
                     <field name="location_type"/>
+                    <field name="date"/>
                 </group>
             </search>
         </field>