The setup:
I have a customer with multiple brands that each need a unique invoice. These are not separate companies, just identity dbas. We are using the SAAS service.
The problem:
It should be as easy as adding a brand database and selector to the sales order page and editing the report to use the brand data for the logo and address. Unfortunately, the templates live in "web\views\report_templates" and are out of reach of a SAAS user.
Attempted:
Before I created all the branding stuff, I thought I'd confirm that I could move the template into a report view. I've tried to copy the external_layout and external_layout_standard from report_templates.xml into a qweb view as report_salesorder_custom with a few appropriate edits. (I've copied that code below) and changed the t-call in report_saleorder_document from "web.external_layout" to "sale.report_saleorder_custom"
The system throws an error:
Odoo Server Error
Traceback (most recent call last):
File "/home/odoo/src/odoo/13.0/addons/web/controllers/main.py", line 2023, in report_download
response = self.report_routes(reportname, docids=docids, converter=converter, context=context)
File "/home/odoo/src/odoo/13.0/odoo/http.py", line 515, in response_wrap
response = f(*args, **kw)
File "/home/odoo/src/odoo/13.0/addons/web/controllers/main.py", line 1961, in report_routes
pdf = report.with_context(context).render_qweb_pdf(docids, data=data)[0]
File "/home/odoo/src/odoo/13.0/odoo/addons/base/models/ir_actions_report.py", line 733, in render_qweb_pdf
bodies, html_ids, header, footer, specific_paperformat_args = self.with_context(context)._prepare_html(html)
File "/home/odoo/src/odoo/13.0/odoo/addons/base/models/ir_actions_report.py", line 355, in _prepare_html
body_parent = root.xpath('//main')[0]
IndexError: list index out of range
I'm reading this to mean the template isn't being read. It could also be I have a template error. Before I spend a lot more time trying to track down an error, I'm wondering if anyone has successfully added custom template types to SAAS? Is this even possible?
Thanks in advance for any information.
<template id="report_saleorder_custom">
____<t t-if="not o" t-set="o" t-value="doc"/>
________<t t-if="company_id">
____________ <t t-set="company" t-value="company_id"/>____
________</t>
________<t t-elif="o and 'company_id' in o">
________________<t t-set="company" t-value="o.company_id.sudo()"/>
________</t>
________<t t-else="else">
________________<t t-set="company" t-value="res_company"/>
________</t>
________
________<div t-attf-class="header o_company_#{company.id}_layout">
____________<div class="row">
________________<div class="col-3 mb4">
____________________<img t-if="company.logo" t-att-src="image_data_uri(company.logo)" style="max-height: 45px;" alt="Logo"/>
________________</div>
________________<div class="col-9 text-right" style="margin-top:22px;" t-field="company.report_header" name="moto"/>
____________</div>
____________<div t-if="company.logo or company.report_header" class="row zero_min_height">
________________<div class="col-12">
____________________<div style="border-bottom: 1px solid black;"/>
________________</div>
____________</div>
____________<div class="row">
________________<div class="col-6" name="company_address">
____________________<div t-field="company.partner_id"
________________________t-options='{"widget": "contact", "fields": ["address", "name"], "no_marker": true}'/>
________________</div>
____________</div>
________</div>
________<div t-attf-class="article o_report_layout_standard o_company_#{company.id}_layout" t-att-data-oe-model="o and o._name" t-att-data-oe-id="o and o.id" t-att-data-oe-lang="o and o.env.context.get('lang')">
____________<t t-call="web.address_layout"/>
____________<t t-raw="0"/>
________</div>
________<div t-attf-class="footer o_standard_footer o_company_#{company.id}_layout">
____________<div class="text-center" style="border-top: 1px solid black;">
________________<ul class="list-inline mb4">
____________________<!-- using the list-inline-item class from bootstrap causes weird behaviours in pdf report
________________________ adding d-inline class fixes the problem-->
____________________<li t-if="company.phone" class="list-inline-item d-inline">Phone: <span t-field="company.phone"/></li>
____________________<li t-if="company.email" class="list-inline-item d-inline">Email: <span t-field="company.email"/></li>
____________________<li t-if="company.website" class="list-inline-item d-inline">Web: <span t-field="company.website"/></li>
____________________<li t-if="company.vat" class="list-inline-item d-inline"><t t-esc="company.country_id.vat_label or 'Tax ID'"/>: <span t-field="company.vat"/></li>
________________</ul>
________________<div name="financial_infos">
____________________<span t-field="company.report_footer"/>
________________</div>
________________<div t-if="report_type == 'pdf'" class="text-muted">
____________________Page: <span class="page"/> / <span class="topage"/>
________________</div>
____________</div>
________</div>
____
____</template>