[FIX] mrp: start date

The start date of a manufacturing order is never set. One consequence is
that the Gantt view, which relies on this field, is never populated.

opw-693743
This commit is contained in:
Nicolas Martinelli
2016-12-07 15:50:31 +01:00
parent 89994fbb88
commit e3ee78c7ef
2 changed files with 11 additions and 3 deletions
+5 -2
View File
@@ -356,7 +356,10 @@ class MrpWorkorder(models.Model):
raise UserError(_("You need to define at least one productivity loss in the category 'Performance'. Create one from the Manufacturing app, menu: Configuration / Productivity Losses."))
for workorder in self:
if workorder.production_id.state != 'progress':
workorder.production_id.state = 'progress'
workorder.production_id.write({
'state': 'progress',
'date_start': datetime.now(),
})
timeline.create({
'workorder_id': workorder.id,
'workcenter_id': workorder.workcenter_id.id,
@@ -449,4 +452,4 @@ class MrpWorkorder(models.Model):
self.ensure_one()
action = self.env.ref('stock.action_stock_scrap').read()[0]
action['domain'] = [('workorder_id', '=', self.id)]
return action
return action
+6 -1
View File
@@ -1,6 +1,8 @@
# -*- coding: utf-8 -*-
# Part of Odoo. See LICENSE file for full copyright and licensing details.
from datetime import datetime
from odoo import api, fields, models, _
from odoo.addons import decimal_precision as dp
from odoo.exceptions import UserError
@@ -87,7 +89,10 @@ class MrpProductProduce(models.TransientModel):
move.quantity_done_store += quantity * move.unit_factor
self.check_finished_move_lots()
if self.production_id.state == 'confirmed':
self.production_id.state = 'progress'
self.production_id.write({
'state': 'progress',
'date_start': datetime.now(),
})
return {'type': 'ir.actions.act_window_close'}
@api.multi