[IMP] mrp: remove batch from operations
This doesn't make sense anymore: when we record production on a WO, in any cases everything is processed as we make backorders. Part of: https://github.com/odoo/odoo/pull/54283 task-2278147
This commit is contained in:
@@ -1158,12 +1158,7 @@ class MrpProduction(models.Model):
|
||||
|
||||
# Instantiate start_date for the next workorder planning
|
||||
if workorder.next_work_order_id:
|
||||
if not workorder.operation_id or workorder.operation_id.batch == 'no' or workorder.operation_id.batch_size >= qty_to_produce:
|
||||
start_date = best_finished_date
|
||||
else:
|
||||
cycle_number = float_round(workorder.operation_id.batch_size / best_workcenter.capacity, precision_digits=0, rounding_method='UP')
|
||||
duration = best_workcenter.time_start + cycle_number * workorder.operation_id.time_cycle * 100.0 / best_workcenter.time_efficiency
|
||||
start_date = best_workcenter.resource_calendar_id.plan_hours(duration / 60.0, best_start_date, compute_leaves=True, resource=best_workcenter.resource_id, domain=[('time_type', 'in', ['leave', 'other'])])
|
||||
start_date = best_finished_date
|
||||
|
||||
# Create leave on chosen workcenter calendar
|
||||
leave = self.env['resource.calendar.leaves'].create({
|
||||
|
||||
@@ -41,11 +41,6 @@ class MrpRoutingWorkcenter(models.Model):
|
||||
help="Time in minutes. Is the time used in manual mode, or the first time supposed in real time when there are not any work orders yet.")
|
||||
time_cycle = fields.Float('Duration', compute="_compute_time_cycle")
|
||||
workorder_count = fields.Integer("# Work Orders", compute="_compute_workorder_count")
|
||||
batch = fields.Selection([
|
||||
('no', 'Once all products are processed'),
|
||||
('yes', 'Once some products are processed')], string='Start Next Operation',
|
||||
default='no', required=True)
|
||||
batch_size = fields.Float('Quantity to Process', default=1.0)
|
||||
workorder_ids = fields.One2many('mrp.workorder', 'operation_id', string="Work Orders")
|
||||
|
||||
@api.depends('time_cycle_manual', 'time_mode', 'workorder_ids')
|
||||
|
||||
@@ -462,13 +462,6 @@ class MrpWorkorder(models.Model):
|
||||
return self.production_id.move_finished_ids.filtered(lambda x: (x.product_id.id != self.production_id.product_id.id) and (x.state not in ('done', 'cancel')))
|
||||
|
||||
def _start_nextworkorder(self):
|
||||
rounding = self.product_id.uom_id.rounding
|
||||
if self.next_work_order_id.state == 'pending' and (
|
||||
(self.operation_id.batch == 'no' and
|
||||
float_compare(self.qty_production, self.qty_produced, precision_rounding=rounding) <= 0) or
|
||||
(self.operation_id.batch == 'yes' and
|
||||
float_compare(self.operation_id.batch_size, self.qty_produced, precision_rounding=rounding) <= 0)):
|
||||
self.next_work_order_id.state = 'ready'
|
||||
if self.state == 'done' and self.next_work_order_id.state == 'pending':
|
||||
self.next_work_order_id.state = 'ready'
|
||||
|
||||
|
||||
@@ -43,10 +43,6 @@
|
||||
<field name="time_cycle" invisible="1"/>
|
||||
<field name="company_id" groups="base.group_multi_company" />
|
||||
</group>
|
||||
<group>
|
||||
<field name="batch" widget="radio"/>
|
||||
<field name="batch_size" attrs="{'invisible': [('batch', '=', 'no')]}"/>
|
||||
</group>
|
||||
</group>
|
||||
<notebook>
|
||||
<page string="Work Sheet" name="worksheet">
|
||||
|
||||
@@ -124,7 +124,6 @@ class TestBom(common.TransactionCase):
|
||||
'workcenter_id': workcenter_1.id,
|
||||
'time_mode': 'manual',
|
||||
'time_cycle_manual': 20,
|
||||
'batch': 'no',
|
||||
'sequence': 1,
|
||||
}),
|
||||
(0, 0, {
|
||||
@@ -132,7 +131,6 @@ class TestBom(common.TransactionCase):
|
||||
'workcenter_id': workcenter_1.id,
|
||||
'time_mode': 'manual',
|
||||
'time_cycle_manual': 25,
|
||||
'batch': 'no',
|
||||
'sequence': 2,
|
||||
}),
|
||||
(0, 0, {
|
||||
@@ -140,7 +138,6 @@ class TestBom(common.TransactionCase):
|
||||
'workcenter_id': workcenter_1.id,
|
||||
'time_mode': 'manual',
|
||||
'time_cycle_manual': 30,
|
||||
'batch': 'no',
|
||||
'sequence': 3,
|
||||
}),
|
||||
],
|
||||
@@ -152,7 +149,6 @@ class TestBom(common.TransactionCase):
|
||||
'workcenter_id': workcenter_1.id,
|
||||
'time_mode': 'manual',
|
||||
'time_cycle_manual': 20,
|
||||
'batch': 'no',
|
||||
'sequence': 1,
|
||||
}),
|
||||
(0, 0, {
|
||||
@@ -160,7 +156,6 @@ class TestBom(common.TransactionCase):
|
||||
'workcenter_id': workcenter_1.id,
|
||||
'time_mode': 'manual',
|
||||
'time_cycle_manual': 25,
|
||||
'batch': 'no',
|
||||
'sequence': 2,
|
||||
}),
|
||||
(0, 0, {
|
||||
@@ -168,7 +163,6 @@ class TestBom(common.TransactionCase):
|
||||
'workcenter_id': workcenter_1.id,
|
||||
'time_mode': 'manual',
|
||||
'time_cycle_manual': 30,
|
||||
'batch': 'no',
|
||||
'sequence': 3,
|
||||
}),
|
||||
],
|
||||
|
||||
Reference in New Issue
Block a user