feat(configurator): Sub 3 — fp.part.catalog gains default_process_id + action_open_part_composer (Task 2)
This commit is contained in:
@@ -151,6 +151,18 @@ class FpPartCatalog(models.Model):
|
||||
'"Inherit" reads the customer\'s default on the partner form.',
|
||||
)
|
||||
|
||||
# Sub 3 — part's cloned process tree. NULL until the user first
|
||||
# composes a process. The Composer client action sets this to the
|
||||
# root node of the cloned tree.
|
||||
default_process_id = fields.Many2one(
|
||||
'fusion.plating.process.node',
|
||||
string='Default Process',
|
||||
domain="[('part_catalog_id', '=', id), ('node_type', '=', 'recipe')]",
|
||||
help='Root of this part\'s composed process tree. Use the '
|
||||
'Compose button to edit. When a job runs for this part, '
|
||||
'work orders are generated from this tree.',
|
||||
)
|
||||
|
||||
# ---- Direct-order defaults (Phase C — C4) ----
|
||||
x_fc_default_coating_config_id = fields.Many2one(
|
||||
'fp.coating.config',
|
||||
@@ -378,6 +390,20 @@ class FpPartCatalog(models.Model):
|
||||
else:
|
||||
rec.display_name = rec.name or _('[unnamed part]')
|
||||
|
||||
def action_open_part_composer(self):
|
||||
"""Launch the Process Composer client action for this part."""
|
||||
self.ensure_one()
|
||||
return {
|
||||
'type': 'ir.actions.client',
|
||||
'tag': 'fp_part_process_composer',
|
||||
'name': 'Process Composer — %s' % (self.display_name or self.part_number),
|
||||
'params': {
|
||||
'part_id': self.id,
|
||||
'part_display': self.display_name or self.part_number,
|
||||
},
|
||||
'target': 'current',
|
||||
}
|
||||
|
||||
def action_view_customer(self):
|
||||
self.ensure_one()
|
||||
return {
|
||||
|
||||
Reference in New Issue
Block a user