Apart from just showing the name and time I want it to show more information
The odoo is hosted on a vps and is v17 Enterprise, if anyone knows about the customization or maybe some documentation they have found.
Odoo is the world's easiest all-in-one management software.
It includes hundreds of business apps:
Apart from just showing the name and time I want it to show more information
The odoo is hosted on a vps and is v17 Enterprise, if anyone knows about the customization or maybe some documentation they have found.
Hi,
Add a Computed Display Field + Inherit the Calendar View
Create a new field in a custom module to compute the display label.
from odoo import models, fields
class ProjectTask(models.Model):
_inherit = 'project.task'
calendar_label = fields.Char(
string="Calendar Label",
compute="_compute_calendar_label",
store=False
)
def _compute_calendar_label(self):
for task in self:
priority = dict(self._fields['priority'].selection).get(task.priority, '')
user = task.user_id.name or ''
task.calendar_label = f"{task.name} [{priority}] - {user}"
Now replace the default label ( name ) with your new computed field ( calendar_label ).
<odoo>
<record id="project_task_calendar_custom" model="ir.ui.view">
<field name="name">project.task.calendar.inherit</field>
<field name="model">project.task</field>
<field name="inherit_id" ref="project.view_task_calendar"/>
<field name="arch" type="xml">
<!-- Replace name field used as label -->
<xpath expr="//field[@name='name']" position="replace">
<field name="calendar_label"/>
</xpath>
</field>
</record>
</odoo>
I hope it is of full use.
Hi,
Please refer to the code below:
Python:
class ProjectTask(models.Model):
_inherit = 'project.task'
custom_title = fields.Char(string="Custom Calendar Title",
compute="_compute_custom_title")
def _compute_custom_title(self):
"""
Compute the custom title for calendar view display.
This method sets the `custom_title` field by combining the task's
stage name and task name in the format: [Stage] Task Name.
Example:
If a task is in stage "In Progress" and named "Fix Bug",
the computed custom_title will be "[In Progress] Fix Bug".
"""
for task in self:
task.custom_title = f"[{task.stage_id.name}] {task.name}"
XML:
<record id="view_task_calendar" model="ir.ui.view">
<field name="name">project.task.view.calendar</field>
<field name="model">project.task</field>
<field name="inherit_id" ref="view_task_calendar"/>
<field name="mode">primary</field>
<field name="arch" type="xml">
<xpath expr="//calendar" position="attributes">
<attribute name="name">custom_title</attribute>
</xpath>
</field>
</record>
Hope it helps.
Tạo tài khoản ngay hôm nay để tận hưởng các tính năng độc đáo và tham gia cộng đồng tuyệt vời của chúng tôi!
Đăng kýBài viết liên quan | Trả lời | Lượt xem | Hoạt động | |
---|---|---|---|---|
Payment method in invoice
Đã xử lý
|
|
2
thg 4 25
|
3563 | |
|
1
thg 2 23
|
3280 | ||
|
0
thg 9 20
|
3746 | ||
|
0
thg 10 24
|
771 | ||
|
3
thg 9 24
|
2199 |