fix(plating): CoC signer follows Settings "Certificate Owner" (no stale freeze)
Changing Settings -> Certificate Owner didn't move existing certs: the signer was snapshotted from the company owner at cert-creation time, and the CoC prefers that snapshot over the live owner. - _fp_create_certificates no longer freezes the company owner into certified_by_id; it snapshots ONLY a deliberate per-spec signer. Empty certified_by_id then resolves the LIVE company owner in the CoC report. - action_issue lazy-fill made robust: resolves the company via the SO / env.company (fp.certificate has no company_id) so it fills the CURRENT owner at issue and the "Certified By" gate still passes. - Settings help text corrected: signature comes from the user's Plating Signature (Preferences -> My Profile), not "HR Employee". - Data fix on entech: cleared certified_by_id on 5 stale draft CoCs with no per-spec signer so they follow the current owner. Bump certificates 19.0.9.3.0, jobs 19.0.11.4.0. Verified: CoC-30058 resolves signer = Garry Singh (has Plating Signature), renders clean. Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
This commit is contained in:
@@ -2572,8 +2572,10 @@ class FpJob(models.Model):
|
||||
|
||||
Resolution sources for the new prefill fields:
|
||||
- process_description ← recipe.name (the job's process root)
|
||||
- certified_by_id ← customer_spec.signer_user_id, falling
|
||||
back to company.x_fc_owner_user_id
|
||||
- certified_by_id ← customer_spec.signer_user_id ONLY
|
||||
(a per-spec override). Left empty
|
||||
otherwise so the LIVE company owner
|
||||
resolves at render / issue time.
|
||||
- contact_partner_id ← partner.x_fc_default_coc_contact_id
|
||||
- nc_quantity ← qty_scrapped + qty_visual_insp_rejects
|
||||
|
||||
@@ -2596,12 +2598,17 @@ class FpJob(models.Model):
|
||||
# sourced from sale_order.x_fc_coating_config_id (since retired);
|
||||
# recipe.name is the human-readable replacement.
|
||||
recipe = self.recipe_id
|
||||
# Signer resolution: per-spec override wins, company default fills.
|
||||
# Signer resolution (2026-05-28): snapshot ONLY a deliberate
|
||||
# per-spec signer here. Do NOT freeze the company owner into
|
||||
# certified_by_id — leaving it empty lets the CoC report and
|
||||
# action_issue resolve the LIVE company owner (res.company
|
||||
# .x_fc_owner_user_id / Settings "Certificate Owner") at render /
|
||||
# issue time. That way changing the Settings signer flows through
|
||||
# to existing draft certs instead of being frozen to whoever was
|
||||
# the owner when the cert was created.
|
||||
signer = False
|
||||
if spec and 'signer_user_id' in spec._fields:
|
||||
signer = spec.signer_user_id
|
||||
if not signer and 'x_fc_owner_user_id' in self.company_id._fields:
|
||||
signer = self.company_id.x_fc_owner_user_id
|
||||
# Contact: per-customer default; blank means manager picks at issue.
|
||||
contact = False
|
||||
if 'x_fc_default_coc_contact_id' in self.partner_id._fields:
|
||||
|
||||
Reference in New Issue
Block a user