Hi,
In Odoo, when multiple modules are
modifying the same field, the order of inheritance and execution
matters. In your case, you want to customize the domain of the sale_line_id field in the helpdesk.ticket model, which has already been modified by the helpdesk_sale_timesheet module.
To
achieve your goal, you can use a technique called field re-declaration.
This technique allows you to redefine a field in a way that
incorporates changes from other modules while adding your own
modifications. Here's how you can do it:
- Create a new module or use an existing one.
- In your module, inherit the helpdesk.ticket model.
- Redefine the sale_line_id field, including the changes you want to make to the domain.
Here's an example of how your Python code might look:
from odoo import models, fields
class HelpdeskTicketInherit(models.Model):
_inherit = 'helpdesk.ticket'
# Redefine the sale_line_id field with your custom domain
sale_line_id = fields.Many2one(domain="[('your_custom_domain_here')]")
By doing this, your module's changes to the sale_line_id field will take precedence over those made by the helpdesk_sale_timesheet module, and your custom domain will be applied.
Remember to replace 'your_custom_domain_here' with the actual domain expression you want to use.
This approach ensures that your changes are applied without directly modifying the field defined in the helpdesk_sale_timesheet module, thus avoiding conflicts and maintaining compatibility with other modules.
Hope it helps