This question has been flagged

hello dudes!

im sitting here on Odoo 12 and try to implement own custom moduls with the help of Odoo12 Development Book.

Todo means that every user can see a list of task he (or his group) have (has) to do.

On the book example only the user can see his created tasks. Record Rule: [('create_uid', '=', user.id)]

I would prefer that a user can see his own-created tasks and the tasks that affect him

What must my record_rules look like?

My todo-model  (x_todo_item) has following custom-attributes:

x_is_done    Is Done?    boolean   
x_name    Name    char   
x_work_team_ids    Work Team many2many

Unfortunately, I'm not so good with the models and record rules

Can you help me pls?

Avatar
Discard
Best Answer

I had similar experience with what you are trying to achieve.

There's a built-in function called "Planned Activity" in Odoo.  I recommend you to look into that before implementing your own module.

In your model, you can call any records from any table based on your desired criteria.

For reference, 
# -*- coding: utf-8 -*-
from odoo import models, fields, api, _
import logging
class Todo(models.Model):
    _name = 'task.management'
    _description = 'Task Management'
    _inherit = ['mail.thread', 'mail.activity.mixin', 'portal.mixin'] 
# display this one2many in a form view in .xml files
# One2many must have another many2one in the related model, 
# In this case it's 'task_summary_id' I made in 'mail.activity'
my_tasks = fields.One2many('mail.activity', 'task_summary_id', string='To Do', domain=[('activity_type_id', '=', 4)]) 

The above is an example.  

Avatar
Discard