From ff4bab8693d020aa733f758a660aff6863e2c95c Mon Sep 17 00:00:00 2001 From: Fabien Pinckaers Date: Sun, 31 May 2009 11:22:26 +0200 Subject: [PATCH] modifs bzr revid: fp@tinyerp.com-20090531092226-4ne7idukti4j669o --- addons/mrp/mrp.py | 1 + addons/mrp/mrp_view.xml | 2 +- addons/mrp_operations/mrp_operations.py | 73 +++++++++++-------- addons/mrp_operations/mrp_operations_view.xml | 13 ++++ 4 files changed, 56 insertions(+), 33 deletions(-) diff --git a/addons/mrp/mrp.py b/addons/mrp/mrp.py index b22d264f40c..e1f02ec39a6 100644 --- a/addons/mrp/mrp.py +++ b/addons/mrp/mrp.py @@ -731,6 +731,7 @@ stock_move() class mrp_production_workcenter_line(osv.osv): _name = 'mrp.production.workcenter.line' _description = 'Work Orders' + _order = 'sequence' _columns = { 'name': fields.char('Work Order', size=64, required=True), 'workcenter_id': fields.many2one('mrp.workcenter', 'Workcenter', required=True), diff --git a/addons/mrp/mrp_view.xml b/addons/mrp/mrp_view.xml index 8a2509e9450..38adabb19b5 100644 --- a/addons/mrp/mrp_view.xml +++ b/addons/mrp/mrp_view.xml @@ -411,8 +411,8 @@ - + diff --git a/addons/mrp_operations/mrp_operations.py b/addons/mrp_operations/mrp_operations.py index 6a3ac22cbcd..324a093f1b8 100644 --- a/addons/mrp_operations/mrp_operations.py +++ b/addons/mrp_operations/mrp_operations.py @@ -108,13 +108,11 @@ class mrp_production_workcenter_line(osv.osv): result = super(mrp_production_workcenter_line, self).write(cr, uid, ids, vals, context=context) if vals.get('date_planned', False) and update: pids = {} + pids2 = {} for prod in self.browse(cr, uid, ids, context=context): - if prod.production_id.date_start>vals['date_planned']: - pids[prod.production_id.id] = True - continue - if prod.production_id.date_finnishedold): dt = dt_end - self.pool.get('mrp.production.workcenter.line').write(cr, uid, [wc.id], { - 'date_planned':dt.strftime('%Y-%m-%d %H:%M:%S') - }, context=context, update=False) - i = self.pool.get('hr.timesheet.group').interval_get( - cr, - uid, - wc.workcenter_id.timesheet_id and wc.workcenter_id.timesheet_id.id or False, - dt, - wc.hour or 0.0 - ) - old = wc.sequence - if i: - dt_end = max(dt_end, i[-1][1]) + if context.get('__last_update'): + del context['__last_update'] + if wc.date_planneddt): - for wc in l.production_id.workcenter_lines: - i = self.pool.get('hr.timesheet.group').interval_min_get( - cr, - uid, - wc.workcenter_id.timesheet_id.id or False, - dt, wc.hour or 0.0 - ) + if l.production_id.state not in ('done','cancel'): + for wc in l.production_id.workcenter_lines: + i = self.pool.get('hr.timesheet.group').interval_min_get( + cr, + uid, + wc.workcenter_id.timesheet_id.id or False, + dt, wc.hour or 0.0 + ) dt = i[0][0] - self.write(cr, uid, [l.production_id.id], {'date_start':dt.strftime('%Y-%m-%d %H:%M:%S')}) - continue + if l.production_id.date_start>dt.strftime('%Y-%m-%d %H:%M:%S'): + self.write(cr, uid, [l.production_id.id], {'date_start':dt.strftime('%Y-%m-%d %H:%M:%S')}) return True def _move_futur(self, cr, uid, ids, context={}): for po in self.browse(cr, uid, ids, context): + if po.allow_reorder: + continue for line in po.move_created_ids: l = line while l.move_dest_id: l = l.move_dest_id if l.state in ('done','cancel','draft'): break + if l.production_id.state in ('done','cancel'): + break if l.production_id and (l.production_id.date_startir.actions.act_window mrp.production.workcenter.line form + [('production_state','in',('ready','confirmed','in_production'))] gantt,tree,form,graph,calendar @@ -276,6 +277,18 @@ id="menu_mrp_production_operation_action" action="mrp_production_operation_action"/> + + mrp.production.allow_reorder.form + + mrp.production + form + + + + + + + mrp.perations.calendar mrp_operations.operation