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

Hello I'm modifying the payslip report for my company (via custom module), I have two tables coded in my xml

Allowances / Deductions

At the allowances I want only the allowances (positive numbers), in the deduction table I want only the negative numbers

In the payslip code we have this

<td><span t-esc="line.amount"
          t-esc-options='{"widget": "monetary", "display_currency": o.company_id.currency_id}'/></td>
<td><span t-esc="line.total"
         t-esc-options='{"widget": "monetary", "display_currency": o.company_id.currency_id}'/></td>

which shows the amount and the total quantities in the PDF for each salary rule.

how do I apply a condition for each table to show the required numbers mentioned above?


Cheers

Ảnh đại diện
Huỷ bỏ

In my opinion this does not make any sence. What if you have to make any corrections in an following payslip?

Câu trả lời hay nhất

Hi,

If you are looking how to check the negative numbers using the if in templates, you can do it like this,

<t t-if="obj.variable &gt; 0">   
    <t t-esc="obj.variable"/>
</t>

Thanks

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

Thanks! this worked pretty well!