Bỏ qua để đến Nội dung
Menu
Câu hỏi này đã bị gắn cờ
1 Trả lời
1070 Lượt xem

How can i set an if condition for a specific user in my invoice and quotation reports? I'd like to use this code to change the footer section based on the current user. Thanks

Odoo 14.0-20210927 (Community Edition)

Ảnh đại diện
Huỷ bỏ
Câu trả lời hay nhất

Hi 

You can try by inheriting the invoice and quotation report and adding the condition of user name 

Try like this 


<template id="report_invoice_inherited" inherit_id="account.report_invoice">
<t t-foreach="docs" t-as="o">
<t t-if="user.partner_id == 'User name'">
add the change that you needed 
</t>
</t>
</template>

Regards

Ảnh đại diện
Huỷ bỏ
Tác giả

Thank you for the answer. I've tried it with the following code but unfortunately it doesn't work.

<li t-if="company.name"><span t-field="company.name"/></li>
<li t-if="company.street"><span t-field="company.street"/></li>
<li t-if="company.street2"><span t-field="company.street2"/></li>
<li><span t-if="company.zip" t-field="company.zip"/> <span t-if="company.city" t-field="company.city"/></li>
<li t-if="company.country_id"><span t-field="company.country_id.name"/></li>
<li t-if="company.phone"><span t-field="company.phone"/></li>
<li t-if="company.email"><span t-field="company.email"/></li>
<li t-if="company.website"><span t-field="company.website"/></li>
<li t-if="user.partner_id == 'Admin'">Test</li>