[ADD/MOD] picking sql report, changes in comment in production report

bzr revid: vir@tinyerp.com-20100317070245-nwj2iigi1ryl1qwf
This commit is contained in:
Vir (Open ERP)
2010-03-17 12:32:45 +05:30
parent ce1563420f
commit 9917c46524
5 changed files with 189 additions and 1 deletions
@@ -2,7 +2,7 @@
<openerp>
<data>
<!--
Helpdesk report after Sales Services
Production Order Report
-->
<record id="view_report_mrp_production_order_tree" model="ir.ui.view">
+1
View File
@@ -53,6 +53,7 @@ Thanks to the double entry management, the inventory controlling is powerful and
"product_view.xml",
"partner_view.xml",
"report/report_stock_view.xml",
"report/report_stock_picking_view.xml",
"security/stock_security.xml",
"security/ir.model.access.csv",
],
+1
View File
@@ -27,6 +27,7 @@ import picking
import lot_overview
import lot_overview_all
import report_stock
import report_stock_picking
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
@@ -0,0 +1,63 @@
# -*- coding: utf-8 -*-
##############################################################################
#
# OpenERP, Open Source Management Solution
# Copyright (C) 2004-2010 Tiny SPRL (<http://tiny.be>).
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as
# published by the Free Software Foundation, either version 3 of the
# License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU Affero General Public License for more details.
#
# You should have received a copy of the GNU Affero General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#
##############################################################################
from osv import fields,osv
import tools
class report_stock_picking(osv.osv):
_name = "report.stock.picking"
_description = "Stock Picking Report"
_auto = False
_columns = {
'name': fields.char('Year',size=64,required=False, readonly=True),
'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),
'reference': fields.char('Reference', size=64, select=True),
'nbr': fields.integer('# of Orders', readonly=True),
'origin': fields.char('Origin', size=64),
'order_date':fields.date('Order Date'),
'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),
'address_id': fields.many2one('res.partner.address', 'Partner'),
'expected_date': fields.date('Expected Date'),
}
def init(self, cr):
tools.drop_view_if_exists(cr, 'report_stock_picking')
cr.execute("""
create or replace view report_stock_picking as (
select
min(c.id) as id,
to_char(c.create_date, 'YYYY') as name,
to_char(c.create_date, 'MM') as month,
c.name as reference,
c.origin,
c.state,
c.type,
c.address_id,
to_date(to_char(c.date, 'MM-dd-YYYY'),'MM-dd-YYYY') as order_date,
to_date(to_char(c.min_date, 'MM-dd-YYYY'),'MM-dd-YYYY') as expected_date,
count(*) as nbr
from
stock_picking c
group by to_char(c.create_date, 'YYYY'), to_char(c.create_date, 'MM'),c.name,c.origin,c.date,c.state,c.type,c.address_id,c.min_date
)""")
report_stock_picking()
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
@@ -0,0 +1,123 @@
<?xml version="1.0" encoding="utf-8"?>
<openerp>
<data>
<!--
Stock Picking Report
-->
<record id="view_report_report_stock_picking_tree" model="ir.ui.view">
<field name="name">report.stock.picking.tree</field>
<field name="model">report.stock.picking</field>
<field name="type">tree</field>
<field name="arch" type="xml">
<tree string="Picking">
<field name="name" />
<field name="month"/>
<field name="address_id" />
<field name="reference" />
<field name="origin" />
<field name="order_date" />
<field name="type" />
<field name="nbr" string="#Picking" />
<field name="state" invisible="1"/>
<field name="order_date" invisible="1"/>
<field name="expected_date" invisible="1"/>
</tree>
</field>
</record>
<record id="view_report_report_stock_picking_form" model="ir.ui.view">
<field name="name">report.stock.picking.form</field>
<field name="model">report.stock.picking</field>
<field name="type">form</field>
<field name="arch" type="xml">
<form string="Picking">
<field name="name" />
<field name="month"/>
<field name="reference" />
</form>
</field>
</record>
<record id="view_report_report_stock_picking_graph" model="ir.ui.view">
<field name="name">report.stock.picking.graph</field>
<field name="model">report.stock.picking</field>
<field name="type">graph</field>
<field name="arch" type="xml">
<graph orientation="horizontal" string="Picking" type="bar">
<field name="state"/>
<field name="nbr" operator="+"/>
</graph>
</field>
</record>
<record id="view_report_report_stock_picking_filter" model="ir.ui.view">
<field name="name">report.stock.picking.select</field>
<field name="model">report.stock.picking</field>
<field name="type">search</field>
<field name="arch" type="xml">
<search string="Search">
<group col="16" colspan="6">
<filter string="This Year" icon="terp-hr" domain="[('name','=',time.localtime()[0])]" default="1" />
<filter string="This Month" icon="terp-hr" domain="[('month','=',time.strftime('%%m'))]" default="1"/>
<separator orientation="vertical"/>
<filter string="Current" icon="terp-hr" domain="[('state','in',('open','draft'))]"/>
<filter string="Expected Date" icon="terp-hr" domain="[('expected_date',=,time.strftime('%%m/%%d/%%Y'))]"/>
<separator orientation="vertical"/>
<field name="reference" />
<field name="origin" />
</group>
<newline/>
<group expand="1" string="Extended options..." colspan="4" col="5">
<filter icon="terp-sale"
string="Sending Goods"
domain="[('type','=','out')]"/>
<filter icon="terp-sale"
string="Getting Goods"
domain="[('type','=','in')]"/>
<filter icon="terp-sale"
string="Internal"
domain="[('type','=','internal')]"/>
<filter icon="terp-sale"
string="Delivery"
domain="[('type','=','delivery')]"/>
</group>
<newline/>
<group expand="1" string="Group By..." colspan="4" col="5">
<filter string="Partner" icon="terp-stock" domain="[]" context="{'group_by':'address_id'}"/>
<filter string="State" icon="terp-stock" domain="[]" context="{'group_by':'state'}"/>
<filter string="Date" icon="terp-stock" domain="[]" context="{'group_by':'order_date'}"/>
<separator orientation="vertical"/>
<filter string="Month" icon="terp-sale" domain="[]" context="{'group_by':'month'}"/>
<filter string="Year" icon="terp-sale" domain="[]" context="{'group_by':'name'}"/>
</group>
</search>
</field>
</record>
<record id="action_report_report_stock_picking" model="ir.actions.act_window">
<field name="name">Picking</field>
<field name="res_model">report.stock.picking</field>
<field name="view_type">form</field>
<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"/>
</record>
<record model="ir.actions.act_window.view" id="action_report_report_stock_picking_tree">
<field name="sequence" eval="1"/>
<field name="view_mode">tree</field>
<field name="view_id" ref="view_report_report_stock_picking_tree"/>
<field name="act_window_id" ref="action_report_report_stock_picking"/>
</record>
<record model="ir.actions.act_window.view" id="action_report_report_stock_picking_graph">
<field name="sequence" eval="2"/>
<field name="view_mode">graph</field>
<field name="view_id" ref="view_report_report_stock_picking_graph"/>
<field name="act_window_id" ref="action_report_report_stock_picking"/>
</record>
<menuitem name="Picking" action="action_report_report_stock_picking" id="menu_report_report_stock_pickings_tree" parent="next_id_61"/>
</data>
</openerp>