Hello guys, help me please!
I want to inherit module mail.model for custom _computeDateFromNow, I want to display format ("DD MMM YYYY HH:mm:ss") in log note, (now it's showing "a day ago")
here is root code
it my try:
Odoo is the world's easiest all-in-one management software.
It includes hundreds of business apps:
Hello guys, help me please!
I want to inherit module mail.model for custom _computeDateFromNow, I want to display format ("DD MMM YYYY HH:mm:ss") in log note, (now it's showing "a day ago")
here is root code
it my try:
Hi, You can change "a day ago" or "hours ago" format in log note without changing the js function. For that you need to inherit and change the mail.Message template.
You can replace the small tag in the template with o_Message_headerDate class. Try replacing the messageView.dateFromNow with messageView.message.date
Regards.
I tried it but I cannot upgrade because error this is my code, check for me please
<?xml version="1.0" encoding="UTF-8"?>
<odoo>
<data>
<template id="my_module_mail_message" inherit_id="mail.Message" name="My Module Mail Message">
<xpath expr="//div[@class='o_Message_date o_Message_headerDate']" position="attributes">
<div class="o_Message_date o_Message_headerDate" t-att-class="{'o-message-selected': isSelected}" t-att-title="datetime">
- <t t-esc="messageView.message.date"/>
</div>
</xpath>
</template>
</data>
</odoo>
I also was add to manifest views/mail_message.xml
Hi, The xml file should not e written in the views, First of all you need to add the xml file in the path your_module_name/static/src/xml/your_filename.xml, Then you need to import this file in manifest like :
'assets': {
'web.assets_backend': [
'your_module_name/static/src/xml/your_filename.xml',
],
},
---------------------------------------------------------------------------------
And in the xml file try adding like:
<templates id="template" xml:space="preserve">
<t t-name="mail.Message" t-inherit="mail.Message" t-inherit-mode="primary" owl="1">
<xpath expr="//small[hasclass('o_Message_headerDate')]" position="replace">
<small class="o_Message_date o_Message_headerDate text-muted opacity-50"
t-att-class="{ 'o-message-selected': messageView.isSelected, 'me-2': !(messageView.isInChatWindowAndIsAlignedRight) }"
t-att-title="messageView.message.datetime">
<t t-esc="messageView.message.date"/>
</small>
</xpath>
</t>
</templates>
Regards.
The error that i get
Traceback (most recent call last):
File "C:\Program Files\Odoo 15\server\odoo\http.py", line 654, in _handle_exception
return super(JsonRequest, self)._handle_exception(exception)
File "C:\Program Files\Odoo 15\server\odoo\http.py", line 301, in _handle_exception
raise exception.with_traceback(None) from new_cause
AssertionError: Element odoo has extra content: data, line 3
To check the issue correctly, can you share the xml screenshot please.
when I follow you, nothing happened, then I tried add to the existing "view" file have error https://drive.google.com/drive/folders/1KcWoHzp3ldM2Z500pnZuRpEDCvbHv2aR?usp=sharing
The mail_message.png and manifest.png files are ok, but you just need to remove the <odoo> and <data> tag from the xml file. Try by removing both.
still nothing happened ToT
Ok I can do that by other way, thanks
Create an account today to enjoy exclusive features and engage with our awesome community!
Sign upRelated Posts | Replies | Views | Activity | |
---|---|---|---|---|
|
0
Sep 23
|
1643 | ||
|
0
Apr 19
|
3142 | ||
|
2
Mar 15
|
6724 | ||
|
1
Aug 24
|
2544 | ||
|
0
Apr 23
|
442 |