fix(sub12a): rename _seed_default_inputs → action_seed_default_inputs
Odoo 19 rejects view buttons that call private (underscore-prefixed) methods. Renamed the public entry point. The post_init_hook callers follow. Caught by entech upgrade (ParseError on the form view). Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -155,7 +155,7 @@ def _create_template_from_node(env, node, seen):
|
||||
|
||||
tpl = env['fp.step.template'].create(vals)
|
||||
if kind:
|
||||
tpl._seed_default_inputs()
|
||||
tpl.action_seed_default_inputs()
|
||||
|
||||
|
||||
def _seed_minimal_library(env):
|
||||
@@ -180,7 +180,7 @@ def _seed_minimal_library(env):
|
||||
]
|
||||
for name, kind in minimal:
|
||||
tpl = Tpl.create({'name': name, 'default_kind': kind})
|
||||
tpl._seed_default_inputs()
|
||||
tpl.action_seed_default_inputs()
|
||||
_logger.info(
|
||||
'Fusion Plating: seeded minimal step library (%s entries)',
|
||||
len(minimal),
|
||||
|
||||
@@ -198,9 +198,13 @@ class FpStepTemplate(models.Model):
|
||||
'gating': [],
|
||||
}
|
||||
|
||||
def _seed_default_inputs(self):
|
||||
def action_seed_default_inputs(self):
|
||||
"""Seed input_template_ids based on default_kind. Idempotent —
|
||||
only adds inputs whose names don't already exist on this template."""
|
||||
only adds inputs whose names don't already exist on this template.
|
||||
|
||||
Public method (Odoo 19 requires non-underscore-prefixed names
|
||||
for methods called from a view button).
|
||||
"""
|
||||
Input = self.env['fp.step.template.input']
|
||||
for tpl in self:
|
||||
if not tpl.default_kind:
|
||||
|
||||
@@ -30,7 +30,7 @@
|
||||
<field name="arch" type="xml">
|
||||
<form string="Step Library Template">
|
||||
<header>
|
||||
<button name="_seed_default_inputs" type="object"
|
||||
<button name="action_seed_default_inputs" type="object"
|
||||
string="Seed Default Inputs" class="btn-secondary"
|
||||
invisible="not default_kind"/>
|
||||
</header>
|
||||
|
||||
Reference in New Issue
Block a user