Odoo 阅读域

Odoo Reading domain

我正在做一个模块,其中一个功能是发送电子邮件,但需要读取域并将其放在正确的位置。例如下面的代码,应该写在 HERE where is link.

                <record id="employee_leave_request" model="mail.template">
                    <field name="name">Employee Leave Request</field>
                    <field name="subject">${object.name}</field>
                    <field name="model_id" ref="model_hr_holidays"/>
                    <field name="auto_delete" eval="False"/>
                    <field name="body_html" ><![CDATA[

                            <div style="font-family: 'Lucica Grande', Ubuntu, Arial, Verdana, sans-serif; font-size: 12px; color: rgb(34, 34, 34); background-color: rgb(255, 255, 255); ">
                                    % if not ctx.get('manager') :
                    <h4>Dear ${object.employee_id.name},</h4>
                % endif
                % if ctx.get('manager') :
                    <h4>Dear ${ctx['manager']},</h4>
                    ${object.employee_id.name} has requested for leave(s).<br/>
                % endif
                                                Leave Type : ${object.holiday_status_id.name}<br/>
                                                Reason : ${object.name}<br/>
                                                Number Of Days : From ${object.date_from} To ${object.date_to}, i.e for ${object.number_of_days_temp} day(s)<br/>
                                                Link : http://**HERE**/web?debug=#id=${object.id}&view_type=form&model=hr.holidays&menu_id=125&action=123
                            </div>
                            ]]>
                    </field>
            </record>

模块 portal 正在 res.partner 添加一个方法 _get_signup_url_for_action,可用于构建您想要的 url。

调用如下:

Link : <a href="${object.user_id.partner_id._get_signup_url_for_action(action=123, menu_id=125, res_id=object.id, model=object._name)}">click me</a>