[REF] mrp: Cleaning the module.
bzr revid: uco@tinyerp.com-20100805102052-waegbh1uyfrhid76
This commit is contained in:
parent
40b121e140
commit
09f5953295
|
@ -34,15 +34,12 @@ import time
|
||||||
# capacity_hour : capacity per hour. default: 1.0.
|
# capacity_hour : capacity per hour. default: 1.0.
|
||||||
# Eg: If 5 concurrent operations at one time: capacity = 5 (because 5 employees)
|
# Eg: If 5 concurrent operations at one time: capacity = 5 (because 5 employees)
|
||||||
# unit_per_cycle : how many units are produced for one cycle
|
# unit_per_cycle : how many units are produced for one cycle
|
||||||
#
|
|
||||||
# TODO: Work Center may be recursive ?
|
|
||||||
#
|
|
||||||
class mrp_workcenter(osv.osv):
|
class mrp_workcenter(osv.osv):
|
||||||
_name = 'mrp.workcenter'
|
_name = 'mrp.workcenter'
|
||||||
_description = 'Work Center'
|
_description = 'Work Center'
|
||||||
_inherits = {'resource.resource':"resource_id"}
|
_inherits = {'resource.resource':"resource_id"}
|
||||||
_columns = {
|
_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."),
|
'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."),
|
'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."),
|
'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."),
|
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_journal_id': fields.many2one('account.analytic.journal', 'Analytic Journal'),
|
||||||
'costs_general_account_id': fields.many2one('account.account', 'General Account', domain=[('type','<>','view')]),
|
'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'),
|
'resource_id': fields.many2one('resource.resource','Resource',ondelete='cascade'),
|
||||||
}
|
}
|
||||||
_defaults = {
|
_defaults = {
|
||||||
|
@ -255,7 +251,6 @@ class mrp_bom(osv.osv):
|
||||||
@return: False or BoM id.
|
@return: False or BoM id.
|
||||||
"""
|
"""
|
||||||
bom_result = False
|
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,))
|
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())
|
ids = map(lambda x: x[0], cr.fetchall())
|
||||||
max_prop = 0
|
max_prop = 0
|
||||||
|
@ -607,9 +602,6 @@ class mrp_production(osv.osv):
|
||||||
if not bom_id:
|
if not bom_id:
|
||||||
raise osv.except_osv(_('Error'), _("Couldn't find bill of material for product"))
|
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
|
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)
|
res = bom_obj._bom_explode(cr, uid, bom_point, factor / bom_point.product_qty, properties)
|
||||||
results = res[0]
|
results = res[0]
|
||||||
|
@ -631,11 +623,9 @@ class mrp_production(osv.osv):
|
||||||
if production.move_created_ids:
|
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_created_ids])
|
||||||
move_obj.action_cancel(cr, uid, [x.id for x in production.move_lines])
|
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
|
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):
|
def action_ready(self, cr, uid, ids):
|
||||||
""" Changes the production state to Ready and location id of stock move.
|
""" Changes the production state to Ready and location id of stock move.
|
||||||
@return: True
|
@return: True
|
||||||
|
@ -981,3 +971,4 @@ class mrp_production_product_line(osv.osv):
|
||||||
}
|
}
|
||||||
mrp_production_product_line()
|
mrp_production_product_line()
|
||||||
|
|
||||||
|
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
|
||||||
|
|
|
@ -55,7 +55,7 @@ class procurement_order(osv.osv):
|
||||||
procurement_obj = self.pool.get('procurement.order')
|
procurement_obj = self.pool.get('procurement.order')
|
||||||
res = procurement_obj.make_mo(cr, uid, ids, context=context)
|
res = procurement_obj.make_mo(cr, uid, ids, context=context)
|
||||||
res = res.values()
|
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={}):
|
def make_mo(self, cr, uid, ids, context={}):
|
||||||
""" Make Manufacturing(production) order from procurement
|
""" Make Manufacturing(production) order from procurement
|
||||||
|
|
|
@ -1,22 +1,21 @@
|
||||||
# -*- encoding: utf-8 -*-
|
## -*- coding: utf-8 -*-
|
||||||
##############################################################################
|
##############################################################################
|
||||||
#
|
#
|
||||||
# OpenERP, Open Source Management Solution
|
# OpenERP, Open Source Management Solution
|
||||||
# Copyright (C) 2004-2009 Tiny SPRL (<http://tiny.be>). All Rights Reserved
|
# Copyright (C) 2004-2010 Tiny SPRL (<http://tiny.be>).
|
||||||
# $Id$
|
|
||||||
#
|
#
|
||||||
# This program is free software: you can redistribute it and/or modify
|
# 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
|
# it under the terms of the GNU Affero General Public License as
|
||||||
# the Free Software Foundation, either version 3 of the License, or
|
# published by the Free Software Foundation, either version 3 of the
|
||||||
# (at your option) any later version.
|
# License, or (at your option) any later version.
|
||||||
#
|
#
|
||||||
# This program is distributed in the hope that it will be useful,
|
# This program is distributed in the hope that it will be useful,
|
||||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
# 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
|
# You should have received a copy of the GNU Affero General Public License
|
||||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
#
|
#
|
||||||
##############################################################################
|
##############################################################################
|
||||||
|
|
||||||
|
|
|
@ -18,6 +18,7 @@
|
||||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
#
|
#
|
||||||
##############################################################################
|
##############################################################################
|
||||||
|
|
||||||
from osv import fields,osv
|
from osv import fields,osv
|
||||||
import tools
|
import tools
|
||||||
|
|
||||||
|
|
|
@ -21,8 +21,6 @@
|
||||||
|
|
||||||
import time
|
import time
|
||||||
from report import report_sxw
|
from report import report_sxw
|
||||||
from osv import osv
|
|
||||||
import pooler
|
|
||||||
|
|
||||||
class order(report_sxw.rml_parse):
|
class order(report_sxw.rml_parse):
|
||||||
def __init__(self, cr, uid, name, context):
|
def __init__(self, cr, uid, name, context):
|
||||||
|
@ -31,9 +29,6 @@ class order(report_sxw.rml_parse):
|
||||||
'time': time,
|
'time': time,
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
report_sxw.report_sxw('report.mrp.production.order','mrp.production','addons/mrp/report/order.rml',parser=order,header=1)
|
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:
|
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
|
||||||
|
|
|
@ -47,3 +47,5 @@ class change_standard_price(osv.osv_memory):
|
||||||
return super(change_standard_price, self).change_price(cr, uid, ids, context=context)
|
return super(change_standard_price, self).change_price(cr, uid, ids, context=context)
|
||||||
|
|
||||||
change_standard_price()
|
change_standard_price()
|
||||||
|
|
||||||
|
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
|
||||||
|
|
|
@ -74,3 +74,4 @@ class mrp_product_produce(osv.osv_memory):
|
||||||
|
|
||||||
mrp_product_produce()
|
mrp_product_produce()
|
||||||
|
|
||||||
|
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
|
||||||
|
|
Loading…
Reference in New Issue