Skip to Content
Menu
This question has been flagged
1 Reply
10431 Views

This is an error message I got after extending record rules following the 'Odoo Development Essentials,

You initially create a new module called 'todo_app' and then extend it 'todo_user', when creating the todo_app module you define record level rules so that users can only view their own records. because the rules were created using 'data noupdate="1" when extending the rules for the todo_user module which is an mutl-user extension of the todo_app module the new xml rules record first deletes the original rule record and then defines the new rules:


<?xml version="1.0" encoding="utf-8"?>

<openerp>

  <data noupdate="0">


    <delete model="ir.rule" search="[('id','=',

     ref('todo_app.todo_task_user_rule'))]" />


    <record id="todo_task_per_user_rule" model="ir.rule">

        <field name="name">ToDo Tasks only for owner</field>

        <field name="model_id" ref="model_todo_task"/>

        <field name="groups" eval="[(4,ref('base.group_user'))]"/>

        <field name="domain_force">

          ['|',('user_id','in',[user.id,False]),

            ('message_follower_ids','in',[user.partner_id.id])]

        </field>

    </record>


  </data>

</openerp>

Now this record rules extension works fine using the admin ID but when using any other user ID this fails with the error:

ValueError: Invalid field 'message_follower_ids' in leaf "&lt;osv.ExtendedLeaf: ('message_follower_ids', 'in', [5]) on todo_task (ctx: )>"



as I've just followed this book, I can't see why the system thinks that the field 'message_follower_ids' does not exist.
The new record rules are supposed to allow users who have been assigned to a task access to that record as well as the owner and also allow any records where no one has been assigned to be viewed by all users. 


Avatar
Discard
Author Best Answer

OK my fault here sorry for the post, I hadn't included the inheritance on mail.thread! This meant that the 'message_follower_ids' that was being referred to did not exist as that is where it is inherited from!

Avatar
Discard