Skip to Content
Menu
This question has been flagged
2 Replies
807 Views

Hi, I'm using odoo 14 and here is my situation:

class User(Model):
_name = "user"
name = fields.Char()

class Project(Model):
_name = "project"
name = fields.Char()

class Task(Model):
_name = "task"
name = fields.Char()
user_id = fields.Many2one("user")
project_id = fields.Many2one("project")

Both User and Project have the inverse fields to Task.

Is it possible to put a Project tree view with all the records in the User form view? I would like to create a new Task from the User form view and clicking on the Project record to which the task is to be assigned I would like a Task form view to appear with the Task user_id and project_id fields already set according to the context.

Avatar
Discard
Author Best Answer

Thank you for the answer! The one2many fields referred to Task already exist inside User and Project. However, there is not relation between User and Project and I don't know if it is possible put a Project tree view inside User form view.

Avatar
Discard
Best Answer

Normally I would:
- Add task_ids to user and Project like

task_ids = fields.One2many("task","user_id")

then in the xml:
...

Avatar
Discard