تخطي للذهاب إلى المحتوى
القائمة
لقد تم الإبلاغ عن هذا السؤال
3 الردود
3705 أدوات العرض

Can we customize the template or it's default template already. I meant by customize is the design, the font, the logo placement. I'm using odoo V16 Enterprise Edition and i already subscript for 1 year.

الصورة الرمزية
إهمال
أفضل إجابة

Hi,

You can refer to the code for example: We share the award certificate for the employee award module python file in the report folder:

class AwardCertificate(models.AbstractModel):
    _name = 'report.module_name.report_award_certificate'
    _description = 'Award Certificate'

    @api.model
    def _get_report_values(self, docids, data=None):

        """ Returns data to the template"""
        return {
            'doc_model': 'awards.rewards',
            'data': data,
            'docs': self.env['awards.rewards'].browse(data['id']),
        }
XML file in the report folder

<template id="report_award_certificate">
        <t t-call="web.html_container">
            <t t-call="web.basic_layout">
                <div class="backgroundimage">
                    <div style="position:relative;">
<img src="/module_name/static/src/images/background.jpeg" style="width:760px;height:755px;"/>
                        <div style="position: absolute; top: 360px; left: 60px;width: 650px;">
                            <h1 style="text-align: center;"><b><i>
                                <span t-if="data['nominee']"
style="text-transform:uppercase;text-transform:uppercase;font-family:sans-serif;"
t-esc="data['nominee'].employee_number"/>
                                <span t-if="docs.nominee_id"
style="text-transform:uppercase;text-transform:uppercase;font-family:sans-serif;"
t-esc="docs.nominee_id.employee_number"/>
<span t-else="" style="text-transform:uppercase;font-family:certification-serif;padding-left: 20px;"
t-esc="docs.nominee_id.name"/>
 
                          </i></b></h1>
                        </div>
                        <div style="position:absolute; bottom:190px; right:361px;">
                            <h6>
<span style="text-transform:uppercase;" t-esc="docs.award_for_month"/>
                            </h6>
                        </div>
                        <div style="position:absolute; bottom:190px; right:200px;">
<h6><span t-esc="docs.award_for_year_id.year"/></h6>
                        </div>
                        <div style="position:absolute; bottom:232px; right:80px;width:600px;">
                            <h4 style="text-align: center;">
<span style="font-family: certification-serif;" t-esc="docs.category_id.name"/>
                            </h4>
                        </div>
                        <div style="position:absolute; bottom:130px; left:40px; width:300px;">
                            <h5 style="text-align: center;">
                                <span t-if="data['nominee']"
style="text-transform:uppercase;font-family: Arial;"
t-esc="data['nominee'].department_id.manager_id.name"/>
<span
t-else="" style="text-transform:uppercase;font-family: Arial;"
t-esc="docs.department_id.manager_id.name"/>
                            </h5>
                        </div>
                        <div style="position:absolute; bottom:130px; right:40px; width:300px;">
<h5 style="text-align: center;"><span style="text-transform:uppercase;font-family: Arial;"
t-esc="data['chairman'].name"/></h5>
                        </div>
                    </div>
<div style="position:relative;margin-top:20px;border-top: 1px dashed black">
                    </div>
                    </div>
            </t>
        </t>
    </template>

In this way, you can create your own template for your custom models

Hope it helps

الصورة الرمزية
إهمال
المنشورات ذات الصلة الردود أدوات العرض النشاط
2
سبتمبر 21
4318
V14 Functional Exam تم الحل
2
يوليو 21
6995
4
يونيو 25
2003
1
يونيو 25
841
Odoo certification تم الحل
2
أبريل 25
3105