Skip to Content
Menu
Musisz się zarejestrować, aby móc wchodzić w interakcje z tą społecznością.
To pytanie dostało ostrzeżenie
2 Odpowiedzi
2269 Widoki

I'm trying to inherit Many2one fields ("project and task") in sale.order form view. I can see the fields but I can choose all task in my task field. I want to related it to project field because when I choose a project, I must see only that project's task. Also I want to see  task field just when I choose a project. I tried to do it like this;


class SaleOder(models.Model):

_inherit = "sale.order"

project_id = fields.Many2one(comodel_name="project.project", string="Project")

task_id =fields.Many2one(comodel_name="project.task", related="project.task.name",  string="Task")

Awatar
Odrzuć
Najlepsza odpowiedź

Hi,
Here you have to set domain for the task_id field to filter and show only task related to selected project.

project_id = fields.Many2one(comodel_name="project.project", string="Project")
task_id = fields.Many2one(comodel_name="project.task", string="Task", domain="[('project_id', '=', project_id)]")


Thanks

Awatar
Odrzuć
Autor

Thanks for your answer

Najlepsza odpowiedź

Hi,

to be able to see only " that project's task ", you have to add a domain:

 


for your " Also I want to see  task field just when I choose a project ":


thanks.

Awatar
Odrzuć
Autor

Thanks, your answer is helpful

Powiązane posty Odpowiedzi Widoki Czynność
1
cze 25
1579
3
lip 25
3230
1
maj 25
1380
1
maj 25
1628
4
maj 25
2782