1
# -*- coding: utf-8 -*-
2
##############################################################################
4
# OpenERP, Open Source Management Solution
5
# Copyright (C) 2004-2010 Tiny SPRL (<http://tiny.be>).
7
# This program is free software: you can redistribute it and/or modify
8
# it under the terms of the GNU Affero General Public License as
9
# published by the Free Software Foundation, either version 3 of the
10
# License, or (at your option) any later version.
12
# This program is distributed in the hope that it will be useful,
13
# but WITHOUT ANY WARRANTY; without even the implied warranty of
14
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15
# GNU Affero General Public License for more details.
17
# You should have received a copy of the GNU Affero General Public License
18
# along with this program. If not, see <http://www.gnu.org/licenses/>.
20
##############################################################################
21
from osv import fields,osv
25
class mrp_production_order(osv.osv):
26
_name = "mrp.production.order"
27
_description = "Production Order Report"
30
'name': fields.char('Year',size=64,required=False, readonly=True),
31
'month':fields.selection([('01','January'), ('02','February'), ('03','March'), ('04','April'), ('05','May'), ('06','June'),
32
('07','July'), ('08','August'), ('09','September'), ('10','October'), ('11','November'), ('12','December')],'Month',readonly=True),
33
'reference': fields.char('Reference', size=64, required=True),
34
'origin': fields.char('Source Document', size=64),
35
'nbr': fields.integer('# of Orders', readonly=True),
36
'product_id': fields.many2one('product.product', 'Product', required=True, domain=[('type','<>','service')]),
37
'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),
38
'scheduled_date':fields.date('Scheduled Date'),
39
'location_src_id': fields.many2one('stock.location', 'Raw Materials Location', required=True),
40
'location_dest_id': fields.many2one('stock.location', 'Finished Products Location', required=True),
45
tools.drop_view_if_exists(cr, 'mrp_production_order')
47
create or replace view mrp_production_order as (
50
to_char(c.create_date, 'YYYY') as name,
51
to_char(c.create_date, 'MM') as month,
55
to_date(to_char(c.date_planned, 'dd-MM-YYYY'),'dd-MM-YYYY') as scheduled_date,
62
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
64
mrp_production_order()
65
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: