From 7083ee61a3e11485b31ee570e1cec73d5b2f8afb Mon Sep 17 00:00:00 2001 From: "Vir (Open ERP)" Date: Tue, 16 Mar 2010 14:19:39 +0530 Subject: [PATCH] [ADD/REMOVED] mrp : Production order report added, files from report_mrp modules are removed to mrp module bzr revid: vir@tinyerp.com-20100316084939-z3iccty0n0rrj35d --- addons/mrp/__terp__.py | 2 + addons/mrp/report/__init__.py | 6 +- addons/mrp/report/mrp_production_order.py | 64 ++++++++++ .../mrp/report/mrp_production_order_view.xml | 115 ++++++++++++++++++ .../report/mrp_report.py} | 0 .../report/mrp_report_view.xml} | 2 +- addons/mrp/security/ir.model.access.csv | 1 + 7 files changed, 187 insertions(+), 3 deletions(-) create mode 100644 addons/mrp/report/mrp_production_order.py create mode 100644 addons/mrp/report/mrp_production_order_view.xml rename addons/{report_mrp/report_mrp.py => mrp/report/mrp_report.py} (100%) rename addons/{report_mrp/report_mrp_view.xml => mrp/report/mrp_report_view.xml} (98%) diff --git a/addons/mrp/__terp__.py b/addons/mrp/__terp__.py index a147266ce1d..feabb8cc123 100644 --- a/addons/mrp/__terp__.py +++ b/addons/mrp/__terp__.py @@ -69,6 +69,8 @@ 'process/service_product_process.xml', 'process/procurement_process.xml', 'mrp_installer.xml', + 'report/mrp_report_view.xml', + 'report/mrp_production_order_view.xml', ], 'demo_xml': ['mrp_demo.xml', 'mrp_order_point.xml'], 'installable': True, diff --git a/addons/mrp/report/__init__.py b/addons/mrp/report/__init__.py index a053b3998b2..471e3440af3 100644 --- a/addons/mrp/report/__init__.py +++ b/addons/mrp/report/__init__.py @@ -1,6 +1,6 @@ # -*- coding: utf-8 -*- ############################################################################## -# +# # OpenERP, Open Source Management Solution # Copyright (C) 2004-2010 Tiny SPRL (). # @@ -15,7 +15,7 @@ # 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 . +# along with this program. If not, see . # ############################################################################## @@ -23,6 +23,8 @@ import price import workcenter_load import order import bom_structure +import mrp_report +import mrp_production_order # vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: diff --git a/addons/mrp/report/mrp_production_order.py b/addons/mrp/report/mrp_production_order.py new file mode 100644 index 00000000000..ba3e9dd7730 --- /dev/null +++ b/addons/mrp/report/mrp_production_order.py @@ -0,0 +1,64 @@ +# -*- coding: utf-8 -*- +############################################################################## +# +# OpenERP, Open Source Management Solution +# Copyright (C) 2004-2010 Tiny SPRL (). +# +# 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 . +# +############################################################################## +from osv import fields,osv +import tools + + +class mrp_production_order(osv.osv): + _name = "mrp.production.order" + _description = "Production Order 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, required=True), + 'origin': fields.char('Source Document', size=64), + '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'), + 'location_src_id': fields.many2one('stock.location', 'Raw Materials Location', required=True), + 'location_dest_id': fields.many2one('stock.location', 'Finished Products Location', required=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(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, + 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 + )""") +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 new file mode 100644 index 00000000000..d3ef3ec82b6 --- /dev/null +++ b/addons/mrp/report/mrp_production_order_view.xml @@ -0,0 +1,115 @@ + + + + + + + mrp.production.order.tree + mrp.production.order + tree + + + + + + + + + + + + + + + + mrp.production.order.form + mrp.production.order + form + +
+ + + + + + + + +
+ + + + + + + + + + + + + + + + mrp.production.order.select + mrp.production.order + search + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Production Order + mrp.production.order + form + tree + + + + + + + tree + + + + + + + + + + + + + +
+
+ diff --git a/addons/report_mrp/report_mrp.py b/addons/mrp/report/mrp_report.py similarity index 100% rename from addons/report_mrp/report_mrp.py rename to addons/mrp/report/mrp_report.py diff --git a/addons/report_mrp/report_mrp_view.xml b/addons/mrp/report/mrp_report_view.xml similarity index 98% rename from addons/report_mrp/report_mrp_view.xml rename to addons/mrp/report/mrp_report_view.xml index c14688d9cbf..5de7c7be34b 100644 --- a/addons/report_mrp/report_mrp_view.xml +++ b/addons/mrp/report/mrp_report_view.xml @@ -98,7 +98,7 @@ form graph,tree - + diff --git a/addons/mrp/security/ir.model.access.csv b/addons/mrp/security/ir.model.access.csv index cdc658ff7c0..ea845f9db51 100644 --- a/addons/mrp/security/ir.model.access.csv +++ b/addons/mrp/security/ir.model.access.csv @@ -32,3 +32,4 @@ "access_mrp_production_stock_worker","mrp.production stock_worker","model_mrp_production","stock.group_stock_user",1,0,0,0 "access_mrp_installer","mrp.installer","model_mrp_installer","mrp.group_mrp_user",1,0,0,0 "access_mrp_product_produce","mrp.product.produce","model_mrp_product_produce","mrp.group_mrp_user",1,0,0,0 +"access_mrp_production_order","mrp.production.order","model_mrp_production_order","mrp.group_mrp_user",,,,