[IMP] stock: picking report

bzr revid: nel@tinyerp.com-20100521081028-6l5o1xid6owan2y3
This commit is contained in:
nel@tinyerp.com 2010-05-21 10:10:28 +02:00
parent 3e7cb95253
commit 2a94c90f2e
2 changed files with 71 additions and 50 deletions

View File

@ -30,16 +30,15 @@ class report_stock_picking(osv.osv):
'month':fields.selection([('01','January'), ('02','February'), ('03','March'), ('04','April'), ('05','May'), ('06','June'),
('07','July'), ('08','August'), ('09','September'), ('10','October'), ('11','November'), ('12','December')],'Month',readonly=True),
'day': fields.char('Day', size=128, readonly=True),
'reference': fields.char('Reference', size=64, select=True),
'nbr': fields.integer('# of Lines', readonly=True),
'nbp': fields.integer('# of Picking', readonly=True),
'partner_id':fields.many2one('res.partner', 'Partner', readonly=True),
'product_qty': fields.float('# of Products', readonly=True),
'product_uos_qty': fields.float('# of Products', readonly=True),
'product_id': fields.many2one('product.product', 'Product', readonly=True),
'date': fields.date('Date', readonly=True),
'avg_days_to_deliver': fields.float('Avg Days to Deliver', digits=(16,2), readonly=True, group_operator="avg",
help="Number of Avg Days to deliver"),
'origin': fields.char('Origin', size=64),
'state': fields.selection([('draft', 'Draft'),('auto', 'Waiting'),('confirmed', 'Confirmed'),('assigned', 'Available'),('done', 'Done'),('cancel', 'Cancelled')], 'State'),
'type': fields.selection([('out', 'Sending Goods'), ('in', 'Getting Goods'), ('internal', 'Internal'), ('delivery', 'Delivery')], 'Shipping Type', required=True),
'company_id': fields.many2one('res.company', 'Company', readonly=True),
@ -50,7 +49,11 @@ class report_stock_picking(osv.osv):
'min_date': fields.date('Expected Date',help="Expected date for Picking. Default it takes current date"),
'order_date': fields.date('Order Date', help="Date of Order"),
'date_done': fields.date('Date Done', help="Date of completion"),
'location_id': fields.many2one('stock.location', 'Source Location', help="Sets a location if you produce at a fixed location. This can be a partner location if you subcontract the manufacturing operations."),
'location_dest_id': fields.many2one('stock.location', 'Dest. Location', help="Location where the system will stock the finished products."),
'max_date': fields.date('Max.Expected Date'),
'product_uos': fields.many2one('product.uom', 'Product UOS'),
'product_uom': fields.many2one('product.uom', 'Product UOM'),
}
def init(self, cr):
tools.drop_view_if_exists(cr, 'report_stock_picking')
@ -70,12 +73,15 @@ class report_stock_picking(osv.osv):
count(sm.id) as nbr,
count(distinct sp.id) as nbp,
sum(sm.product_qty) as product_qty,
sm.product_id,
sum(sm.product_uos_qty) as product_uos_qty,
sm.product_id as product_id,
sm.location_dest_id as location_dest_id,
sm.location_id as location_id,
sp.type,
sm.product_uos,
sm.product_uom,
sp.invoice_state,
sp.company_id,
sp.name as reference,
sp.origin,
sp.company_id as company_id,
avg(extract('epoch' from (sp.date_done-sp.create_date)))/(3600*24) as avg_days_to_deliver,
sp.state
from stock_move as sm
@ -83,17 +89,19 @@ class report_stock_picking(osv.osv):
group by sp.type,
sp.create_date,
sp.address_id,
sp.name,
sm.product_id,
to_char(sp.create_date, 'YYYY'),
sm.location_dest_id,
sm.location_id,
to_char(sp.create_date, 'MM'),
to_char(sp.create_date, 'YYYY-MM-DD'),
sm.product_uos,
sm.product_uom,
date_trunc('day',sp.min_date),
date_trunc('day',sp.date),
date_trunc('day',sp.date_done),
date_trunc('day',sp.max_date),
sp.invoice_state,
sp.origin,
sp.company_id,
sp.state

View File

@ -15,23 +15,26 @@
<field name="month" invisible="1"/>
<field name="day" invisible="1"/>
<field name="date" invisible="1"/>
<field name="reference" invisible="1"/>
<field name="company_id" invisible="1"/>
<field name="partner_id" invisible="1"/>
<field name="product_id" invisible="1"/>
<field name="origin" invisible="1"/>
<field name="min_date" invisible="1"/>
<field name="order_date" invisible="1"/>
<field name="date_done" invisible="1"/>
<field name="max_date" invisible="1"/>
<field name="type" invisible="1"/>
<field name="invoice_state" invisible="1"/>
<field name="state" invisible="1"/>
<field name="product_qty" sum="# of Products" />
<field name="nbp" sum="# of Pickings" />
<field name="nbr" sum="# of Lines" />
<field name="avg_days_to_deliver" avg='Avg Days to Deliver'/>
</tree>
<field name="location_id" invisible="1"/>
<field name="location_dest_id" invisible="1"/>
<field name="date" invisible="1"/>
<field name="company_id" invisible="1"/>
<field name="partner_id" invisible="1"/>
<field name="product_id" invisible="1"/>
<field name="min_date" invisible="1"/>
<field name="order_date" invisible="1"/>
<field name="date_done" invisible="1"/>
<field name="max_date" invisible="1"/>
<field name="type" invisible="1"/>
<field name="state" invisible="1"/>
<field name="product_uos" invisible="1"/>
<field name="product_uom" invisible="1"/>
<field name="product_qty" sum="# of Products"/>
<field name="product_uos_qty" sum="# of Products UOS"/>
<field name="nbp" sum="# of Pickings"/>
<field name="nbr" sum="# of Lines"/>
<field name="avg_days_to_deliver" avg='Avg Days to Deliver'/>
</tree>
</field>
</record>
@ -55,49 +58,59 @@
<field name="type">search</field>
<field name="arch" type="xml">
<search string="Search">
<group col="16" colspan="6">
<filter icon="terp-stock" string="This Year"
<group col="4" colspan="5">
<filter string="365 Days"
icon="gtk-media-rewind"
domain="[('date','&lt;=', time.strftime('%%Y-%%m-%%d')),('date','&gt;',(datetime.date.today()-datetime.timedelta(days=365)).strftime('%%Y-%%m-%%d'))]"
help="Picking in this year"/>
<filter icon="terp-stock" string="This Month"
help="Picking of last 365 Days"/>
<filter
icon="gtk-media-rewind"
string="30 Days"
name="month"
domain="[('date','&lt;=', time.strftime('%%Y-%%m-%%d')), ('date','&gt;',(datetime.date.today()-datetime.timedelta(days=30)).strftime('%%Y-%%m-%%d'))]"
help="Picking in this month"/>
help="Picking of last 30 days"/>
<filter icon="gtk-media-rewind"
string=" 7 Days "
separator="1"
domain="[('date','&lt;=', time.strftime('%%Y-%%m-%%d')), ('date','&gt;',(datetime.date.today()-datetime.timedelta(days=7)).strftime('%%Y-%%m-%%d'))]"
help="Pickings of last 7 days"/>
<separator orientation="vertical"/>
<filter string="Todo" icon="terp-stock" domain="[('state','in',('draft','auto','confirmed','assigned'))]"/>
<filter string="Todo" icon="terp-stock" domain="[('state','in',('draft','auto'))]"/>
<filter string="Confirmed" icon="terp-stock" domain="[('state','in',('confirmed'))]"/>
<filter string="Assigned" icon="terp-stock" domain="[('state','in',('assigned'))]"/>
<filter string="Done" icon="terp-stock" domain="[('state','=','done')]"/>
<separator orientation="vertical"/>
<field name="partner_id"/>
<field name="reference" />
<field name="origin" />
<field name="type" groups="base.group_extended"/>
</group>
<newline/>
<group expand="0" string="Extended options..." colspan="10" col="12">
<field name="type"/>
<separator orientation="vertical"/>
<field name="min_date"/>
<field name="max_date"/>
<newline/>
<field name="invoice_state"/>
<separator orientation="vertical"/>
<field name="company_id" groups="base.group_multi_company"/>
<field name="location_id"/>
<field name="location_dest_id"/>
<field name="product_uos"/>
<field name="product_uom"/>
<newline/>
<field name="order_date"/>
<field name="date_done"/>
<field name="min_date"/>
<field name="max_date"/>
</group>
<newline/>
<group expand="1" string="Group By..." colspan="4" col="5">
<filter string="Partner" name="Partner" icon="terp-stock" domain="[]" context="{'group_by':'partner_id'}"/>
<filter string="Company" icon="terp-stock" domain="[]" context="{'group_by':'company_id'}" groups="base.group_multi_company"/>
<filter string="Product" name="product" icon="terp-stock" domain="[]" context="{'group_by':'product_id'}"/>
<filter string="Shipping Type" icon="terp-stock" domain="[]" context="{'group_by':'type'}"/>
<filter string="State" icon="terp-stock" domain="[]" context="{'group_by':'state'}"/>
<filter string="Invoice Status" icon="terp-stock" domain="[]" context="{'group_by':'invoice_state'}"/>
<separator orientation="vertical"/>
<filter string="Product" icon="terp-stock" domain="[]" context="{'group_by':'product_id'}"/>
<filter string="Shipping Type" icon="terp-stock" domain="[]" context="{'group_by':'type'}"/>
<filter string="Origin" icon="terp-stock" domain="[]" context="{'group_by':'origin'}"/>
<separator orientation="vertical"/>
<separator orientation="vertical"/>
<filter string="Source Location" icon="terp-stock" domain="[]" context="{'group_by':'location_id'}"/>
<filter string="Dest. Location" icon="terp-stock" domain="[]" context="{'group_by':'location_dest_id'}"/>
<filter string="Company" icon="terp-stock" domain="[]" context="{'group_by':'company_id'}" groups="base.group_multi_company"/>
<separator orientation="vertical"/>
<filter string="Day" icon="terp-stock" domain="[]" context="{'group_by':'day'}"/>
<filter string="Month" icon="terp-stock" domain="[]" context="{'group_by':'month'}"/>
<filter string="Year" icon="terp-stock" domain="[]" context="{'group_by':'year'}"/>
<filter string="Month" icon="terp-stock" domain="[]" context="{'group_by':'month'}"/>
<filter string="Year" icon="terp-stock" domain="[]" context="{'group_by':'year'}"/>
</group>
</search>
</field>
@ -109,7 +122,7 @@
<field name="view_mode">tree,graph</field>
<field name="view_id" ref="view_report_report_stock_picking_tree"/>
<field name="search_view_id" ref="view_report_report_stock_picking_filter"/>
<field name="context">{'search_default_Partner':1,'search_default_month':1,'group_by_no_leaf':1,'group_by':[]}</field>
<field name="context">{'search_default_Partner':1,'search_default_product':1,'search_default_month':1,'group_by_no_leaf':1,'group_by':[]}</field>
</record>
<record model="ir.actions.act_window.view" id="action_report_report_stock_picking_tree">