feat(certificates): multiple Default CoC Contacts per customer (M2o -> M2m)
res.partner.x_fc_default_coc_contact_id (single Many2one) becomes x_fc_default_coc_contact_ids (self-referential Many2many 'Default CoC Contacts') so a customer can list several contacts who need the CoC. - res.partner: M2m field (rel fp_default_coc_contact_rel) + many2many_tags. - Cert: contact_partner_id (primary addressee printed on the cert) is set to the FIRST CoC contact at job creation + lazy-filled at issue. - Send: action_send_to_customer pre-fills the email composer with ALL the customer's CoC contacts (primary + the rest), falling back to the company. - fp.job cert-default resolution + the action_issue gate wording updated. - Migration 19.0.10.2.0: copies each partner's old single value into the new M2m, then drops the orphaned column. Deployed + verified on entech: migration copied 2 existing values, old column dropped, field is M2m, send pre-fills all contacts. entech-only part_line_ids / multi-part resolver preserved. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -2678,7 +2678,7 @@ class FpJob(models.Model):
|
||||
(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
|
||||
- contact_partner_id ← partner.x_fc_default_coc_contact_ids[:1]
|
||||
- nc_quantity ← qty_scrapped + qty_visual_insp_rejects
|
||||
|
||||
Honours part.certificate_requirement (coc / coc_thickness /
|
||||
@@ -2713,8 +2713,10 @@ class FpJob(models.Model):
|
||||
signer = spec.signer_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:
|
||||
contact = self.partner_id.x_fc_default_coc_contact_id
|
||||
if 'x_fc_default_coc_contact_ids' in self.partner_id._fields:
|
||||
# Primary = first of the customer's CoC contacts; the rest are
|
||||
# CC'd at send (fp.certificate.action_send_to_customer).
|
||||
contact = self.partner_id.x_fc_default_coc_contact_ids[:1]
|
||||
# NC qty: scrapped + visual rejects. Both NULL-safe.
|
||||
nc_qty = int(
|
||||
(self.qty_scrapped or 0)
|
||||
|
||||
Reference in New Issue
Block a user