Odoo Help
Odoo is the world's easiest all-in-one management software. It includes hundreds of business apps:
CRM
|
e-Commerce
|
Accounting
|
Inventory
|
PoS
|
Project management
|
MRP
|
etc.
How Can I make a function that doesn't shows me my task that are finished?
I have this code. I need a function that filters all Tasks out that are in stage == "finished" . How Can I make that?
When the task is in stage finished it should't show up in the selector of all tasks.
This function shows me all tasks from a project and again all tasks that are in stage_id == finished
How Can I make that so, that all "finished" tasks are not showing in this selector include_in_task_work_view???
class ProjectWork(models.Model):
_inherit = 'project.task.work'
project = fields.Many2one(
string='Project', related='task_id.project_id', store=True,
domain="[('state', 'not in', ('template', 'cancelled', 'close'))]")
include_in_task_work_view = fields.Boolean(
related='task_id.stage_id.include_in_task_work_view', readonly=True,
store=True)
@api.onchange('project')
def onchange_project(self):
if not self.project:
return {'domain': {'task_id': []}}
return {
'domain': {
'task_id': [('project_id', '=', self.project.id),
('include_in_task_work_view', '=', True)]},
}
@api.onchange('task_id')
def onchange_task_id(self):
if not self.task_id:
return {}
return {'value': {'project': self.task_id.project_id.id}}
Hi,
I didn't get the question very well, But you get the ids of the records not in finished state by using the search method:
not_finished_ids = self.search([('state', '!=', 'finished')]) ...
Hope this could help
I want a function that search all tasks that are not finished and that they display on this : @api.onchange('task_id') def onchange_task_id(self): if not self.task_id: return {} return {'value': {'project': self.task_id.project_id.id}}
Hi,
I honestly don't really get the question as well.
If what you want is to hide tasks from task selectors (many2one fields on other objects that link to a task), you could use the "active" field on tasks. The active field is used by the ORM/web client to hide things from list views, selectors, etc. automatically.
I want to hide all tasks that are in stage "finished" . I have this modul. https://www.odoo.com/apps/modules/8.0/project_work_time_control/ The Problem is , that the selector (field that shows all tasks) is not filtering the task. So all finished tasks are showed up. I want to hide all finished-tasks.
About This Community
This platform is for beginners and experts willing to share their Odoo knowledge. It's not a forum to discuss ideas, but a knowledge base of questions and their answers.
RegisterOdoo Training Center
Access to our E-learning platform and experience all Odoo Apps through learning videos, exercises and Quizz.
Test it nowQuestion tools
Stats
Asked: 3/16/16, 5:13 AM |
Seen: 921 times |
Last updated: 3/23/16, 5:22 AM |