I created a report and mail template for my custom module. Both are working fine independently. If i try to attach report with email template getting an error:
`ParseError: "insert or update on table "mail_template" violates foreign key constraint "mail_template_report_template_fkey"
DETAIL: Key (report_template)=(317) is not present in table "ir_act_report_xml".`
Here is my code:
**email_template.xml**
<record id="email_template_edi_project" model="mail.template">
<field name="name">Project Quotation - Send by Email</field>
<field name="email_from">${(object.user_id.email and '%s <%s>' % (object.user_id.name, object.user_id.email) or '')|safe}</field>
<!-- <field name="subject">${object.company_id.name} ${object.state in ('draft', 'sent') and 'Quotation' or 'Order'} (Ref ${object.name or 'n/a' })</field> -->
<field name="subject">Request for Project: ${object.name or 'n/a' }</field>
<field name="partner_to">${object.partner_id.id}</field>
<field name="model_id" ref="project_quotation.model_project_quotation"/>
<field name="auto_delete" eval="True"/>
<field name="report_template" ref="project_quotation.report_rfp"/>
<field name="report_name">${(object.name or '').replace('/','_')}${object.state == 'draft' and '_draft' or ''}</field>
<field name="lang">${object.partner_id.lang}</field>
<field name="body_html"><![CDATA[]></field>
</record>
**report_template.xml**
<report
id="project_quotation"
model="project.quotation"
string="Project Quotation"
report_type="qweb-pdf"
name="mymodule.report_rfp"
file="mymodule.report_rfp"
menu="True"/>
<template id="report_rfp">
<t t-call="report.html_container">
<t t-foreach="docs" t-as="o">
<t t-call="report.external_layout">
<div class="page">
<h2>Report title</h2>
<p>This object's name is <span t-field="o.name"/></p>
</div>
</t>
</t>
</t>
How can i solve this?