In ~addons/hr/views/*.xml,it works
<field name="resign_date" attrs="{'invisible':[('resign_date', '=', '9000-12-31')]}"/>
but in ~addons/hr/report/*.xml
No matter the date is '9000-12-31' or not,still display in the printed report.What's the mistake of the code?
<td>
<t t-if="l.resign_date != '9000-12-31'">
<span t-field="l.resign_date"/>
</t>
</td>
Odoo is the world's easiest all-in-one management software.
It includes hundreds of business apps:
- CRM
- e-Commerce
- Accounting
- Inventory
- PoS
- Project
- MRP
This question has been flagged
it looks like there is no issue with code. make sure you update module correctly and for further debugging
print <t t-esc="l.resign_date"/> so it will print date in default server date format to be sure there is no issue with date format and check the value is same as in if a condition.
I tried the below code also before,but all the "resign_date" are invisiable no matter the date is "9000-12-31" or not,so I think the issue is the date format which I didnt know the correct code.
<t t-if="l.resign_date == '9000-12-31'">
I tried the below code will display the error of "="
<t t-if="l.resign_date = '9000-12-31'">
I am pretty sure provided code will work, another reason not working may this template/template portion replace using xpath in other module
addons/hr/model/hr_employee.base.py
Code:
resign_date = fields.Date(string="Resign Date", default="9000-12-31")
addons/hr/report/hr_employee_report.xml
PS:hr_employee_report.xml(Customize Report)
Code:
<td>
<t t-if="l.resign_date != datetime.datetime.strptime('9000-12-31','%Y-%m-%d')">
<span t-field="l.resign_date"/>
</t>
</td>
But in the printed report the date of '9000-12-31' still display
Even I tried the below code,still got the same result.
<t t-if="l.resign_date != 9000-12-31">
<t t-if="l.resign_date != '9000-12-31'">
can you try with a valid date as an example like '2015-12-15' or '2019-12-08'
Same issue
Enjoying the discussion? Don't just read, join in!
Create an account today to enjoy exclusive features and engage with our awesome community!
Sign up| Related Posts | Replies | Views | Activity | |
|---|---|---|---|---|
|
|
3
Jun 25
|
2633 | ||
|
|
1
Jan 25
|
19097 | ||
|
|
1
Jan 20
|
4869 | ||
|
|
1
Dec 19
|
7398 | ||
|
|
1
Dec 19
|
18194 |