summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorlen-odoo <35492570+len-odoo@users.noreply.github.com>2018-05-18 13:20:29 +0200
committerGitHub <noreply@github.com>2018-05-18 13:20:29 +0200
commitcb4c2be37748b92e97b32b5c8defce7b7c1e6bd9 (patch)
tree7b21f74c5fd051d61f792f2986dd4211889c66b6
parent36d45175b0879a2dbad689964c20b2a8583e827b (diff)
11.0 fix negativewos jco (#24781)
* [FIX] mrp: negative workorder issues - In the onchange of the qty_producing in the wo, we need to add the date to the stock.move.line as it is a required field. - When starting a workorder, check first if it has not already been done.
-rw-r--r--addons/mrp/models/mrp_workorder.py8
1 files changed, 7 insertions, 1 deletions
diff --git a/addons/mrp/models/mrp_workorder.py b/addons/mrp/models/mrp_workorder.py
index c617427cd1f..f9e0bd5eadc 100644
--- a/addons/mrp/models/mrp_workorder.py
+++ b/addons/mrp/models/mrp_workorder.py
@@ -219,6 +219,7 @@ class MrpWorkorder(models.Model):
'done_wo': False,
'location_id': move.location_id.id,
'location_dest_id': move.location_dest_id.id,
+ 'date': move.date,
})
qty_todo -= 1
elif float_compare(qty_todo, 0.0, precision_rounding=rounding) < 0:
@@ -410,7 +411,12 @@ class MrpWorkorder(models.Model):
@api.multi
def button_start(self):
- # TDE CLEANME
+ self.ensure_one()
+ # As button_start is automatically called in the new view
+ if self.state in ('done', 'cancel'):
+ return True
+
+ # Need a loss in case of the real time exceeding the expected
timeline = self.env['mrp.workcenter.productivity']
if self.duration < self.duration_expected:
loss_id = self.env['mrp.workcenter.productivity.loss'].search([('loss_type','=','productive')], limit=1)