mirror of
https://github.com/OCA/manufacture.git
synced 2025-01-28 16:37:15 +02:00
[12.0][ADD] mrp_workorder_sequence
This commit is contained in:
committed by
Christopher Ormaza
parent
f6c695b76f
commit
f1d54dc698
2
mrp_workorder_sequence/models/__init__.py
Normal file
2
mrp_workorder_sequence/models/__init__.py
Normal file
@@ -0,0 +1,2 @@
|
||||
from . import mrp_production
|
||||
from . import mrp_workorder
|
||||
22
mrp_workorder_sequence/models/mrp_production.py
Normal file
22
mrp_workorder_sequence/models/mrp_production.py
Normal 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
|
||||
10
mrp_workorder_sequence/models/mrp_workorder.py
Normal file
10
mrp_workorder_sequence/models/mrp_workorder.py
Normal 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()
|
||||
Reference in New Issue
Block a user