diff --git a/fusion_plating/fusion_plating_notifications/data/mail_template_data.xml b/fusion_plating/fusion_plating_notifications/data/mail_template_data.xml index 06d62615..0d01b5ea 100644 --- a/fusion_plating/fusion_plating_notifications/data/mail_template_data.xml +++ b/fusion_plating/fusion_plating_notifications/data/mail_template_data.xml @@ -122,8 +122,8 @@ - Acknowledgement_{{ (object.name or '').replace('/','_') }} + eval="[(6, 0, [ref('fusion_plating_reports.action_report_fp_sale_portrait')])]"/> + SalesOrder_{{ (object.name or '').replace('/','_') }} diff --git a/fusion_plating/fusion_plating_notifications/hooks.py b/fusion_plating/fusion_plating_notifications/hooks.py index 54e4c105..663eff85 100644 --- a/fusion_plating/fusion_plating_notifications/hooks.py +++ b/fusion_plating/fusion_plating_notifications/hooks.py @@ -26,7 +26,7 @@ def post_init_hook(env): _apply_report_template( env, 'fusion_plating_notifications.fp_mail_template_so_confirmed', - 'fusion_plating_reports.action_report_fp_so_acknowledgement', + 'fusion_plating_reports.action_report_fp_sale_portrait', ) _apply_report_template( env, @@ -36,6 +36,13 @@ def post_init_hook(env): def _apply_report_template(env, mail_template_xmlid, report_xmlid): + """Replace the template's report_template_ids with exactly [report]. + + We use `set` semantics (replace all) rather than `add` so that old + attachments from previous refactors get cleaned up — e.g. when the + Acknowledgement report was consolidated into the Sales Order report, + the now-stale Acknowledgement reference gets removed here. + """ mail_template = env.ref(mail_template_xmlid, raise_if_not_found=False) report = env.ref(report_xmlid, raise_if_not_found=False) if not mail_template or not report: @@ -44,11 +51,12 @@ def _apply_report_template(env, mail_template_xmlid, report_xmlid): mail_template_xmlid, report_xmlid, ) return - if report.id not in mail_template.report_template_ids.ids: + current_ids = set(mail_template.report_template_ids.ids) + if current_ids != {report.id}: mail_template.write({ - 'report_template_ids': [(4, report.id)], + 'report_template_ids': [(6, 0, [report.id])], }) _logger.info( - 'fusion_plating_notifications: attached report %s to template %s', + 'fusion_plating_notifications: set report %s on template %s', report_xmlid, mail_template_xmlid, ) diff --git a/fusion_plating/fusion_plating_reports/__manifest__.py b/fusion_plating/fusion_plating_reports/__manifest__.py index ab642147..b6522b47 100644 --- a/fusion_plating/fusion_plating_reports/__manifest__.py +++ b/fusion_plating/fusion_plating_reports/__manifest__.py @@ -40,7 +40,6 @@ 'report/report_wo_margin.xml', # Quote-to-cash reports (portrait + landscape) 'report/report_fp_sale.xml', - 'report/report_fp_so_acknowledgement.xml', 'report/report_fp_work_order.xml', 'report/report_fp_job_traveller.xml', 'report/report_fp_packing_slip.xml', diff --git a/fusion_plating/fusion_plating_reports/report/report_fp_sale.xml b/fusion_plating/fusion_plating_reports/report/report_fp_sale.xml index e1bb8231..a1619867 100644 --- a/fusion_plating/fusion_plating_reports/report/report_fp_sale.xml +++ b/fusion_plating/fusion_plating_reports/report/report_fp_sale.xml @@ -97,6 +97,42 @@ + + + + + + + + + + + + + + + + + + + +
CUSTOMER JOB #PLANNED STARTCUSTOMER DEADLINESHIP VIA
+
+ + + +
+ + Blanket Order. + Parts will be released in quantities over time. + + + Partial shipments blocked. + The order ships as one complete batch. + +
+
+ @@ -189,6 +225,14 @@ + + +
+ Notes: +
+
+ +
@@ -327,6 +371,42 @@
+ + + + + + + + + + + + + + + + + + + +
CUSTOMER JOB #PLANNED STARTCUSTOMER DEADLINESHIP VIA
+
+ + + +
+ + Blanket Order. + Parts will be released in quantities over time. + + + Partial shipments blocked. + The order ships as one complete batch. + +
+
+ @@ -426,6 +506,14 @@ + + +
+ Notes: +
+
+ +
diff --git a/fusion_plating/fusion_plating_reports/report/report_fp_so_acknowledgement.xml b/fusion_plating/fusion_plating_reports/report/report_fp_so_acknowledgement.xml deleted file mode 100644 index 1fe57750..00000000 --- a/fusion_plating/fusion_plating_reports/report/report_fp_so_acknowledgement.xml +++ /dev/null @@ -1,273 +0,0 @@ - - - - - - Sales Order Acknowledgement - sale.order - qweb-pdf - fusion_plating_reports.report_fp_so_acknowledgement_doc - fusion_plating_reports.report_fp_so_acknowledgement_doc - - report - 'Acknowledgement - %s' % object.name - - - - -