How can i restrict a user to just see his own journal entries in Odoo online

Viewed 23

I really need to restrict a user in Odoo online so he can just see his own journal entries, and also make edits to just his own entries. I have seen tons of solutions but those solutions are just for the Odoo open source where they can modify the source code. I want a solution where I can apply it in Odoo online

1 Answers

yes you can do this with company restriction, this will solve your problem. I mean this :

for each record that create by any user from company 'a' can't see or edit by other users from other companies

try like this :

1 - add these lines to all your models

class Help(models.Model):
    _name = 'your_model'
    _check_company_auto = True

    company_id = fields.Many2one('res.company', required=True, default=lambda self: self.env.company)

2 - add these lines in security rules file :

<record model="ir.rule" id="record_restricted_company_rule">
    <field name="name">Restricted Record: multi-company</field>
    <field name="model_id" ref="model_your_model"/>
    <field name="global" eval="True"/>
    <field name="domain_force">
        [('company_id', 'in', company_ids)]
    </field>
</record>
Related