From 09f5953295fb05aeea957d26735c9c2dcc79b8f0 Mon Sep 17 00:00:00 2001 From: "uco (Open ERP)" Date: Thu, 5 Aug 2010 15:50:52 +0530 Subject: [PATCH] [REF] mrp: Cleaning the module. bzr revid: uco@tinyerp.com-20100805102052-waegbh1uyfrhid76 --- addons/mrp/mrp.py | 15 +++------------ addons/mrp/procurement.py | 2 +- addons/mrp/report/bom_structure.py | 19 +++++++++---------- addons/mrp/report/mrp_production_order.py | 1 + addons/mrp/report/order.py | 5 ----- .../mrp/wizard/mrp_change_standard_price.py | 2 ++ addons/mrp/wizard/mrp_product_produce.py | 1 + 7 files changed, 17 insertions(+), 28 deletions(-) diff --git a/addons/mrp/mrp.py b/addons/mrp/mrp.py index 4f33b0c1558..d2079df4503 100644 --- a/addons/mrp/mrp.py +++ b/addons/mrp/mrp.py @@ -34,15 +34,12 @@ import time # capacity_hour : capacity per hour. default: 1.0. # Eg: If 5 concurrent operations at one time: capacity = 5 (because 5 employees) # unit_per_cycle : how many units are produced for one cycle -# -# TODO: Work Center may be recursive ? -# + class mrp_workcenter(osv.osv): _name = 'mrp.workcenter' _description = 'Work Center' _inherits = {'resource.resource':"resource_id"} _columns = { -# 'name': fields.char('Work Center Name', size=64, required=True), 'note': fields.text('Description', help="Description of the workcenter. Explain here what's a cycle according to this workcenter."), 'capacity_per_cycle': fields.float('Capacity per Cycle', help="Number of operations this workcenter can do in parallel. If this workcenter represents a team of 5 workers, the capacity per cycle is 5."), 'time_cycle': fields.float('Time for 1 cycle (hour)', help="Time in hours for doing one cycle."), @@ -56,7 +53,6 @@ class mrp_workcenter(osv.osv): help="Complete this only if you want automatic analytic accounting entries on production orders."), 'costs_journal_id': fields.many2one('account.analytic.journal', 'Analytic Journal'), 'costs_general_account_id': fields.many2one('account.account', 'General Account', domain=[('type','<>','view')]), -# 'company_id': fields.many2one('res.company','Company',required=True), 'resource_id': fields.many2one('resource.resource','Resource',ondelete='cascade'), } _defaults = { @@ -255,7 +251,6 @@ class mrp_bom(osv.osv): @return: False or BoM id. """ bom_result = False - # Why searching on BoM without parent ? cr.execute('select id from mrp_bom where product_id=%s and bom_id is null order by sequence', (product_id,)) ids = map(lambda x: x[0], cr.fetchall()) max_prop = 0 @@ -607,9 +602,6 @@ class mrp_production(osv.osv): if not bom_id: raise osv.except_osv(_('Error'), _("Couldn't find bill of material for product")) - #if bom_point.routing_id and bom_point.routing_id.location_id: - # self.write(cr, uid, [production.id], {'location_src_id': bom_point.routing_id.location_id.id}) - factor = production.product_qty * production.product_uom.factor / bom_point.product_uom.factor res = bom_obj._bom_explode(cr, uid, bom_point, factor / bom_point.product_qty, properties) results = res[0] @@ -631,11 +623,9 @@ class mrp_production(osv.osv): if production.move_created_ids: move_obj.action_cancel(cr, uid, [x.id for x in production.move_created_ids]) move_obj.action_cancel(cr, uid, [x.id for x in production.move_lines]) - self.write(cr, uid, ids, {'state': 'cancel'}) #,'move_lines':[(6,0,[])]}) + self.write(cr, uid, ids, {'state': 'cancel'}) return True - #XXX: may be a bug here; lot_lines are unreserved for a few seconds; - # between the end of the picking list and the call to this function def action_ready(self, cr, uid, ids): """ Changes the production state to Ready and location id of stock move. @return: True @@ -981,3 +971,4 @@ class mrp_production_product_line(osv.osv): } mrp_production_product_line() +# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: diff --git a/addons/mrp/procurement.py b/addons/mrp/procurement.py index 50a976c741a..6425f6e84ac 100644 --- a/addons/mrp/procurement.py +++ b/addons/mrp/procurement.py @@ -55,7 +55,7 @@ class procurement_order(osv.osv): procurement_obj = self.pool.get('procurement.order') res = procurement_obj.make_mo(cr, uid, ids, context=context) res = res.values() - return len(res) and res[0] or 0 #TO CHECK: why workflow is generated error if return not integer value + return len(res) and res[0] or 0 def make_mo(self, cr, uid, ids, context={}): """ Make Manufacturing(production) order from procurement diff --git a/addons/mrp/report/bom_structure.py b/addons/mrp/report/bom_structure.py index 25d179b6901..fa2f5835ae4 100644 --- a/addons/mrp/report/bom_structure.py +++ b/addons/mrp/report/bom_structure.py @@ -1,22 +1,21 @@ -# -*- encoding: utf-8 -*- +## -*- coding: utf-8 -*- ############################################################################## -# +# # OpenERP, Open Source Management Solution -# Copyright (C) 2004-2009 Tiny SPRL (). All Rights Reserved -# $Id$ +# 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 General Public License as published by -# the Free Software Foundation, either version 3 of the License, or -# (at your option) any later version. +# 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 General Public License for more details. +# GNU Affero General Public License for more details. # -# You should have received a copy of the GNU General Public License -# along with this program. If not, see . +# You should have received a copy of the GNU Affero General Public License +# along with this program. If not, see . # ############################################################################## diff --git a/addons/mrp/report/mrp_production_order.py b/addons/mrp/report/mrp_production_order.py index 4fffbdf1689..9aeae1781cd 100644 --- a/addons/mrp/report/mrp_production_order.py +++ b/addons/mrp/report/mrp_production_order.py @@ -18,6 +18,7 @@ # along with this program. If not, see . # ############################################################################## + from osv import fields,osv import tools diff --git a/addons/mrp/report/order.py b/addons/mrp/report/order.py index 7acf6029392..4481c2c121b 100644 --- a/addons/mrp/report/order.py +++ b/addons/mrp/report/order.py @@ -21,8 +21,6 @@ import time from report import report_sxw -from osv import osv -import pooler class order(report_sxw.rml_parse): def __init__(self, cr, uid, name, context): @@ -31,9 +29,6 @@ class order(report_sxw.rml_parse): 'time': time, }) - - report_sxw.report_sxw('report.mrp.production.order','mrp.production','addons/mrp/report/order.rml',parser=order,header=1) - # vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: diff --git a/addons/mrp/wizard/mrp_change_standard_price.py b/addons/mrp/wizard/mrp_change_standard_price.py index 21492bda4f8..3fc63bcc421 100644 --- a/addons/mrp/wizard/mrp_change_standard_price.py +++ b/addons/mrp/wizard/mrp_change_standard_price.py @@ -47,3 +47,5 @@ class change_standard_price(osv.osv_memory): return super(change_standard_price, self).change_price(cr, uid, ids, context=context) change_standard_price() + +# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: diff --git a/addons/mrp/wizard/mrp_product_produce.py b/addons/mrp/wizard/mrp_product_produce.py index 180c0831577..a554a829428 100644 --- a/addons/mrp/wizard/mrp_product_produce.py +++ b/addons/mrp/wizard/mrp_product_produce.py @@ -74,3 +74,4 @@ class mrp_product_produce(osv.osv_memory): mrp_product_produce() +# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: