[IMP] removing unuseaful and wrong report
bzr revid: fp@tinyerp.com-20110924114806-0mhlmckigrfnf88c
This commit is contained in:
parent
d06ae0b38e
commit
b1e8ce4648
|
@ -19,118 +19,4 @@
|
|||
#
|
||||
##############################################################################
|
||||
|
||||
from osv import fields,osv
|
||||
import tools
|
||||
|
||||
|
||||
class mrp_production_order(osv.osv):
|
||||
_name = "mrp.production.order"
|
||||
_description = "Production Order Report"
|
||||
_auto = False
|
||||
_columns = {
|
||||
'year': fields.char('Year',size=64,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),
|
||||
'day': fields.char('Day',size=64,readonly=True),
|
||||
'origin': fields.char('Source Document', size=64),
|
||||
'nbr': fields.integer('# of Lines', readonly=True),
|
||||
'products_to_consume': fields.integer('Products to Consume', readonly=True),
|
||||
'consumed_products': fields.integer('Consumed Products', readonly=True),
|
||||
'date': fields.date('Date', readonly=True),
|
||||
'product_id': fields.many2one('product.product', 'Product', readonly=True),
|
||||
'product_id2': fields.many2one('product.product', 'Product Consumed', readonly=True),
|
||||
'product_qty': fields.float('Product Qty', readonly=True),
|
||||
'state': fields.selection([('draft','Draft'),
|
||||
('picking_except', 'Picking Exception'),
|
||||
('confirmed','Waiting Goods'),
|
||||
('ready','Ready to Produce'),
|
||||
('in_production','In Production'),
|
||||
('cancel','Cancelled'),
|
||||
('done','Done')],
|
||||
'State', readonly=True),
|
||||
'date_planned':fields.date('Scheduled Date'),
|
||||
'location_src_id': fields.many2one('stock.location', 'Raw Materials Location', readonly=True),
|
||||
'date_start': fields.datetime('Start Date',readonly=True),
|
||||
'date_finished': fields.datetime('End Date',readonly=True),
|
||||
'location_dest_id': fields.many2one('stock.location', 'Finished Products Location', readonly=True),
|
||||
'company_id': fields.many2one('res.company','Company',readonly=True),
|
||||
'bom_id': fields.many2one('mrp.bom', 'Bill of Material',readonly=True),
|
||||
'routing_id': fields.many2one('mrp.routing', string='Routing',readonly=True),
|
||||
'picking_id': fields.many2one('stock.picking', 'Picking list', readonly=True),
|
||||
'product_uom': fields.many2one('product.uom', 'Product UOM', readonly=True),
|
||||
'priority': fields.selection([('0','Not urgent'),
|
||||
('1','Normal'),
|
||||
('2','Urgent'),
|
||||
('3','Very Urgent')],
|
||||
'Priority',readonly=True),
|
||||
|
||||
|
||||
}
|
||||
def init(self, cr):
|
||||
tools.drop_view_if_exists(cr, 'mrp_production_order')
|
||||
cr.execute("""
|
||||
create or replace view mrp_production_order as (
|
||||
select
|
||||
min(l.id) as id,
|
||||
to_date(to_char(s.create_date, 'MM-dd-YYYY'),'MM-dd-YYYY') as date,
|
||||
to_char(s.create_date, 'YYYY') as year,
|
||||
to_char(s.create_date, 'MM') as month,
|
||||
to_char(s.create_date, 'YYYY-MM-DD') as day,
|
||||
s.product_id as product_id,
|
||||
l.product_id as product_id2,
|
||||
l.product_uom,
|
||||
sum(l.product_qty * u.factor) as product_qty,
|
||||
s.company_id as company_id,
|
||||
(select 1) as nbr,
|
||||
(select sum(sm.product_qty) from stock_move as sm
|
||||
left join mrp_production_move_ids as mv on (sm.id=mv.move_id)
|
||||
left join mrp_production_product_line as ll on (ll.production_id=mv.production_id)
|
||||
where sm.product_id=ll.product_id and ll.id=l.id
|
||||
and sm.state not in ('done','cancel')
|
||||
group by sm.product_id) as products_to_consume,
|
||||
(select sum(sm.product_qty)/2 from stock_move as sm
|
||||
left join mrp_production_move_ids as mv on (sm.id=mv.move_id)
|
||||
left join mrp_production_product_line as ll on (ll.production_id=mv.production_id)
|
||||
where sm.product_id=ll.product_id and ll.id=l.id
|
||||
and sm.state in ('done','cancel')
|
||||
group by sm.product_id) as consumed_products,
|
||||
s.location_src_id,
|
||||
s.location_dest_id,
|
||||
s.bom_id,
|
||||
s.routing_id,
|
||||
s.picking_id,
|
||||
s.date_start,
|
||||
s.date_finished,
|
||||
to_date(to_char(s.date_planned, 'dd-MM-YYYY'),'dd-MM-YYYY') as date_planned,
|
||||
s.origin,
|
||||
s.priority,
|
||||
s.state
|
||||
from mrp_production_product_line l
|
||||
left join mrp_production s on (s.id=l.production_id)
|
||||
left join product_uom u on (u.id=l.product_uom)
|
||||
group by
|
||||
to_char(s.create_date, 'YYYY'),
|
||||
to_char(s.create_date, 'MM'),
|
||||
to_char(s.create_date, 'YYYY-MM-DD'),
|
||||
to_date(to_char(s.create_date, 'MM-dd-YYYY'),'MM-dd-YYYY'),
|
||||
l.product_id,
|
||||
s.product_id,
|
||||
l.product_uom,
|
||||
s.id,
|
||||
l.id,
|
||||
s.bom_id,
|
||||
s.routing_id,
|
||||
s.picking_id,
|
||||
s.priority,
|
||||
s.location_src_id,
|
||||
s.location_dest_id,
|
||||
s.state,
|
||||
to_date(to_char(s.date_planned, 'dd-MM-YYYY'),'dd-MM-YYYY'),
|
||||
s.origin,
|
||||
s.date_start,
|
||||
s.date_finished,
|
||||
s.company_id
|
||||
)""")
|
||||
mrp_production_order()
|
||||
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
|
||||
|
||||
|
|
|
@ -1,133 +1,6 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<openerp>
|
||||
<data>
|
||||
<!--
|
||||
Production Order Report
|
||||
-->
|
||||
|
||||
<record id="view_report_mrp_production_order_tree" model="ir.ui.view">
|
||||
<field name="name">mrp.production.order.tree</field>
|
||||
<field name="model">mrp.production.order</field>
|
||||
<field name="type">tree</field>
|
||||
<field name="arch" type="xml">
|
||||
<tree colors="blue:state == 'draft';black:state in ('picking_except','confirmed','ready','in_production');gray:state in ('done','cancel') " string="Production">
|
||||
<field name="date_planned"/>
|
||||
<field name="bom_id" invisible="1"/>
|
||||
<field name="product_id" invisible="1"/>
|
||||
<field name="product_qty" sum='Product Qty'/>
|
||||
<field name="nbr" string="#Line Orders" sum='#Line Orders'/>
|
||||
<field name="state" invisible="1"/>
|
||||
<field name="picking_id" invisible="1"/>
|
||||
<field name="priority" invisible="1"/>
|
||||
<field name="day" invisible="1" />
|
||||
<field name="month" invisible="1" />
|
||||
<field name="year" invisible="1" />
|
||||
<field name="location_src_id" invisible="1"/>
|
||||
<field name="location_dest_id" invisible="1"/>
|
||||
<field name="company_id" groups="base.group_multi_company" invisible="1"/>
|
||||
</tree>
|
||||
</field>
|
||||
</record>
|
||||
|
||||
<record id="view_report_mrp_production_order_graph" model="ir.ui.view">
|
||||
<field name="name">mrp.production.order.graph</field>
|
||||
<field name="model">mrp.production.order</field>
|
||||
<field name="type">graph</field>
|
||||
<field name="arch" type="xml">
|
||||
<graph orientation="horizontal" string="Production" type="bar">
|
||||
<field name="state"/>
|
||||
<field name="nbr" operator="+"/>
|
||||
</graph>
|
||||
</field>
|
||||
</record>
|
||||
|
||||
<record id="view_report_mrp_production_order_filter" model="ir.ui.view">
|
||||
<field name="name">mrp.production.order.select</field>
|
||||
<field name="model">mrp.production.order</field>
|
||||
<field name="type">search</field>
|
||||
<field name="arch" type="xml">
|
||||
<search string="Search">
|
||||
<group>
|
||||
<filter icon="terp-go-year" string="Year"
|
||||
domain="[('year','=',time.strftime('%%Y'))]"
|
||||
help="Production performed during current year"/>
|
||||
<filter icon="terp-go-month" string="Month"
|
||||
name="month"
|
||||
domain="[('date','<=',(datetime.date.today()+relativedelta(day=31)).strftime('%%Y-%%m-%%d')),('date','>=',(datetime.date.today()-relativedelta(day=1)).strftime('%%Y-%%m-%%d'))]"
|
||||
help="Production performed during current month"/>
|
||||
<filter icon="terp-go-week"
|
||||
string="Month -1"
|
||||
domain="[('date','<=', (datetime.date.today() - relativedelta(day=31, months=1)).strftime('%%Y-%%m-%%d')),('date','>=',(datetime.date.today() - relativedelta(day=1,months=1)).strftime('%%Y-%%m-%%d'))]"
|
||||
help="Production during last month"/>
|
||||
<separator orientation="vertical"/>
|
||||
<filter icon="terp-camera_test" string="Ready" domain="[('state','=','ready')]"/>
|
||||
<filter icon="terp-check" string="In production" domain="[('state','=','in_production')]"/>
|
||||
<filter icon="terp-dialog-close" string="Done" domain="[('state','=','done')]"/>
|
||||
<separator orientation="vertical"/>
|
||||
<field name="location_src_id" />
|
||||
<field name="location_dest_id" />
|
||||
</group>
|
||||
<newline/>
|
||||
<group expand="0" string="Extended Filters..." groups="base.group_extended">
|
||||
<filter icon="terp-emblem-important" string="Picking Exception" domain="[('state','=','picking_except')]"/>
|
||||
<filter icon="terp-gtk-media-pause" string="Waiting Goods" domain="[('state','=','confirmed')]"/>
|
||||
<filter icon="terp-camera_test" string="Ready to Produce" domain="[('state','=','ready')]"/>
|
||||
<separator orientation="vertical"/>
|
||||
<field name="priority"/>
|
||||
<separator orientation="vertical"/>
|
||||
<field name="company_id" groups="base.group_multi_company"/>
|
||||
<newline/>
|
||||
<field name="date_start"/>
|
||||
<field name="date_planned"/>
|
||||
<field name="date_finished"/>
|
||||
</group>
|
||||
<newline/>
|
||||
<group expand="1" string="Group By...">
|
||||
<filter string="Raw Material Location" icon="terp-gtk-jump-to-rtl" context="{'group_by':'location_src_id'}"/>
|
||||
<filter string="Finished Products Location" icon="terp-gtk-jump-to-ltr" context="{'group_by':'location_dest_id'}"/>
|
||||
<separator orientation="vertical"/>
|
||||
<filter string="Product" name="Product" icon="terp-accessories-archiver" context="{'group_by':'product_id'}" />
|
||||
<filter string="BOM" icon="terp-mrp" context="{'group_by':'bom_id'}"/>
|
||||
<separator orientation="vertical"/>
|
||||
<filter string="State" icon="terp-stock_effects-object-colorize" context="{'group_by':'state'}"/>
|
||||
<separator orientation="vertical"/>
|
||||
<filter string="Company" icon="terp-go-home" context="{'group_by':'company_id'}" groups="base.group_multi_company"/>
|
||||
<separator orientation="vertical" groups="base.group_multi_company"/>
|
||||
<filter string="Day" icon="terp-go-today" context="{'group_by':'day'}"/>
|
||||
<separator orientation="vertical"/>
|
||||
<filter string="Month" name="terp-go-month" icon="terp-go-month" context="{'group_by':'month'}"/>
|
||||
<separator orientation="vertical"/>
|
||||
<filter string="Year" icon="terp-go-year" context="{'group_by':'year'}"/>
|
||||
</group>
|
||||
</search>
|
||||
</field>
|
||||
</record>
|
||||
<record id="action_report_mrp_production_order" model="ir.actions.act_window">
|
||||
<field name="name">Production Analysis</field>
|
||||
<field name="res_model">mrp.production.order</field>
|
||||
<field name="view_type">form</field>
|
||||
<field name="view_mode">tree,graph</field>
|
||||
<field name="view_id" ref="view_report_mrp_production_order_tree"/>
|
||||
<field name="search_view_id" ref="view_report_mrp_production_order_filter"/>
|
||||
<field name="context">{'search_default_Product': 1,'search_default_month':1,'group_by_no_leaf':1,'group_by':[]}</field>
|
||||
<field name="help">This reporting allows you to analyse your manufacturing activities and performance.</field>
|
||||
</record>
|
||||
|
||||
<record model="ir.actions.act_window.view" id="action_report_mrp_production_order_tree">
|
||||
<field name="sequence" eval="1"/>
|
||||
<field name="view_mode">tree</field>
|
||||
<field name="view_id" ref="view_report_mrp_production_order_tree"/>
|
||||
<field name="act_window_id" ref="action_report_mrp_production_order"/>
|
||||
</record>
|
||||
|
||||
<record model="ir.actions.act_window.view" id="action_report_mrp_production_order_graph">
|
||||
<field name="sequence" eval="2"/>
|
||||
<field name="view_mode">graph</field>
|
||||
<field name="view_id" ref="view_report_mrp_production_order_graph"/>
|
||||
<field name="act_window_id" ref="action_report_mrp_production_order"/>
|
||||
</record>
|
||||
|
||||
<menuitem name="Production Analysis" action="action_report_mrp_production_order" id="menu_report_mrp_production_orders_tree" parent="next_id_77"/>
|
||||
|
||||
</data>
|
||||
</openerp>
|
||||
|
|
Loading…
Reference in New Issue