changes
This commit is contained in:
@@ -71,6 +71,8 @@ class SimpleRecipeController(http.Controller):
|
||||
'requires_signoff': step.requires_signoff,
|
||||
'requires_rack_assignment': step.requires_rack_assignment,
|
||||
'requires_transition_form': step.requires_transition_form,
|
||||
'description': step.description or '',
|
||||
'notes': step.notes or '',
|
||||
'tank_ids': [
|
||||
{'id': t.id, 'name': t.name, 'code': t.code}
|
||||
for t in step.tank_ids
|
||||
@@ -160,13 +162,24 @@ class SimpleRecipeController(http.Controller):
|
||||
|
||||
def _sequence_for_position(self, recipe, position):
|
||||
siblings = recipe.child_ids.sorted('sequence')
|
||||
if not siblings or position >= len(siblings):
|
||||
return (siblings[-1].sequence + 10) if siblings else 10
|
||||
if not siblings:
|
||||
return 10
|
||||
if position >= len(siblings):
|
||||
return siblings[-1].sequence + 10
|
||||
if position <= 0:
|
||||
return max(1, siblings[0].sequence - 10)
|
||||
before = siblings[position - 1].sequence
|
||||
after = siblings[position].sequence
|
||||
return (before + after) // 2 if (after - before) > 1 else before + 1
|
||||
if after - before > 1:
|
||||
return (before + after) // 2
|
||||
# Sequences are tightly packed (gap == 1 → midpoint == after,
|
||||
# which collides). Renumber siblings to 10/20/30… first, then
|
||||
# the new step lands cleanly between renumbered neighbours.
|
||||
for idx, sib in enumerate(siblings):
|
||||
new_seq = (idx + 1) * 10
|
||||
if sib.sequence != new_seq:
|
||||
sib.sequence = new_seq
|
||||
return position * 10 + 5
|
||||
|
||||
def _copy_inputs_from_template(self, tpl, new_node):
|
||||
NodeInput = request.env['fusion.plating.process.node.input']
|
||||
|
||||
Reference in New Issue
Block a user