diff --git a/addons/mrp/report/mrp_production_order.py b/addons/mrp/report/mrp_production_order.py
index d2299a19731..6a6c97f1409 100644
--- a/addons/mrp/report/mrp_production_order.py
+++ b/addons/mrp/report/mrp_production_order.py
@@ -30,14 +30,32 @@ class mrp_production_order(osv.osv):
'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, required=True),
'origin': fields.char('Source Document', size=64),
'nbr': fields.integer('# of Orders', readonly=True),
- 'product_id': fields.many2one('product.product', 'Product', required=True, domain=[('type','<>','service')]),
- '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),
- 'scheduled_date':fields.date('Scheduled Date'),
+ 'product_id': fields.many2one('product.product', 'Product', readonly=True, domain=[('type','<>','service')]),
+ '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', required=True),
+ 'date_start': fields.datetime('Start Date',readonly=True),
+ 'date_finnished': fields.datetime('End Date',readonly=True),
'location_dest_id': fields.many2one('stock.location', 'Finished Products Location', required=True),
+ 'company_id': fields.many2one('res.company','Company',readonly=True),
+ 'bom_id': fields.many2one('mrp.bom', 'Bill of Material', domain=[('bom_id','=',False)],readonly=True),
+ 'routing_id': fields.many2one('mrp.routing', string='Routing', on_delete='set null',readonly=True),
+ 'picking_id': fields.many2one('stock.picking', 'Picking list', readonly=True),
+ 'priority': fields.selection([('0','Not urgent'),
+ ('1','Normal'),
+ ('2','Urgent'),
+ ('3','Very Urgent')],
+ 'Priority',readonly=True),
}
@@ -46,20 +64,46 @@ class mrp_production_order(osv.osv):
cr.execute("""
create or replace view mrp_production_order as (
select
- min(c.id) as id,
- to_char(c.create_date, 'YYYY') as name,
- to_char(c.create_date, 'MM') as month,
- c.state,
- c.product_id,
- count(*) as nbr,
- to_date(to_char(c.date_planned, 'dd-MM-YYYY'),'dd-MM-YYYY') as scheduled_date,
- c.name as reference,
- c.origin,
- c.location_src_id,
- c.location_dest_id
- from
- mrp_production c
- group by to_char(c.create_date, 'YYYY'), to_char(c.create_date, 'MM'), c.state,c.product_id,to_date(to_char(c.date_planned, 'dd-MM-YYYY'),'dd-MM-YYYY'),c.name,c.location_src_id,c.location_dest_id,c.origin
+ min(l.id) as id,
+ to_char(s.create_date, 'YYYY') as name,
+ to_char(s.create_date, 'MM') as month,
+ l.product_id as product_id,
+ sum(l.product_qty * u.factor) as product_qty,
+ s.company_id as company_id,
+ count(*) as nbr,
+ s.location_src_id,
+ s.location_dest_id,
+ s.bom_id,
+ s.routing_id,
+ s.picking_id,
+ s.date_start,
+ s.date_finnished,
+ s.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'),
+ l.product_id,
+ l.product_uom,
+ s.bom_id,
+ s.routing_id,
+ s.picking_id,
+ s.priority,
+ s.location_src_id,
+ s.location_dest_id,
+ s.state,
+ s.date_planned,
+ s.origin,
+ s.date_start,
+ s.date_finnished,
+ s.company_id
)""")
mrp_production_order()
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
diff --git a/addons/mrp/report/mrp_production_order_view.xml b/addons/mrp/report/mrp_production_order_view.xml
index abb046bd685..6198cf0e109 100644
--- a/addons/mrp/report/mrp_production_order_view.xml
+++ b/addons/mrp/report/mrp_production_order_view.xml
@@ -11,20 +11,24 @@
tree
-
-
-
-
-
+
+
+
+
-
-
-
+
+
+
+
+
+
+
+
-
+
mrp.production.order.graph
@@ -59,28 +63,48 @@
-
-
+
+
-
-
+
-
+
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
-
-
-
-
-
+
+
+
-
-
-
-
+
+
+
+
+
+
+