[12.0][ADD] mrp_workorder_sequence

This commit is contained in:
Lois Rilo
2019-10-17 12:52:35 +02:00
committed by Christopher Ormaza
parent f6c695b76f
commit f1d54dc698
12 changed files with 592 additions and 0 deletions

View File

@@ -0,0 +1,2 @@
from . import mrp_production
from . import mrp_workorder

View File

@@ -0,0 +1,22 @@
# Copyright 2019 Eficent Business and IT Consulting Services S.L.
# License LGPL-3.0 or later (https://www.gnu.org/licenses/lgpl.html).
from odoo import api, fields, models
class MrpProduction(models.Model):
_inherit = "mrp.production"
@api.multi
def _reset_work_order_sequence(self):
for rec in self:
current_sequence = 1
for work in rec.workorder_ids:
work.sequence = current_sequence
current_sequence += 1
@api.multi
def _generate_workorders(self, exploded_boms):
res = super()._generate_workorders(exploded_boms)
self._reset_work_order_sequence()
return res

View File

@@ -0,0 +1,10 @@
# Copyright 2019 Eficent Business and IT Consulting Services S.L.
# License LGPL-3.0 or later (https://www.gnu.org/licenses/lgpl.html).
from odoo import api, fields, models
class MrpWorkOrder(models.Model):
_inherit = "mrp.workorder"
sequence = fields.Integer()