Odoo Help


New note access denied

Viktor Vorobjov
on 12/29/13, 5:57 PM 1,411 views

Module note, note.py, line~ 82.

If your create Note with stage, function _get_default_stage_id return first stage. But note not create yet and access rule say "access denied".

Why get first stage? Because before if you add new note and you have some stages but you not set stage manual when create note, system put note to "undefined" stage. And it way to can't show Note. After sometime, add new futures - it possible show new note with "undefined" stage in first stage. It works. Onetime it stop working. But you remember we have possible show note with "undefined" stage.

If some change

    def _get_default_stage_id(self,cr,uid,context=None):
        ids = self.pool.get('note.stage').search(cr,uid,[('user_id','=',uid)], context=context)
        #return ids and ids[0] or False
        return False

Now create new note with "undefined" stage, save that. After you can change stage what you wont.

Viktor Vorobjov
On 1/12/14, 5:57 PM

Second part.

When note create some function from email check followers, but we have access rule

<record id="note_note_rule_global" model="ir.rule"> <field name="name">Only followers can access a sticky notes</field> <field model="ir.model" ref="model_note_note" name="model_id"/> <field name="domain_force">[('message_follower_ids','=',user.partner_id.id)]</field> <field eval="True" name="global"/> <field eval="1" name="perm_unlink"/> <field eval="0" name="perm_write"/> <field eval="1" name="perm_read"/> <field eval="0" name="perm_create"/> </record>

it can't add note without error Access check. What need. Need add create. It add follower for new note before system check follower for new note.

note.py for class note_note(osv.osv):

def create(self, cr, uid, vals, context=None):

    new_id = super(note_note, self).create(cr, uid, vals, context=context)

    res_users_obj = self.pool.get('res.users')
    res_users_ids = res_users_obj.read(cr, uid, uid, ['partner_id'], context=None)

    if res_users_ids:

        partner_id_print = res_users_ids['partner_id'][0]
        res_follower_obj = self.pool.get('mail.followers')

        res_follower_id = res_follower_obj.create(cr, uid,
        { 'res_model': 'note.note',
          'res_id' : new_id,
          'partner_id': partner_id_print ,

    return new_id

But now we have problem with access to mail.follower. Temporary need grand access for creat to ( mail.followers.al , mail.followers.user)

Viktor Vorobjov
on 1/13/14, 3:46 AM

About This Community

This platform is for beginners and experts willing to share their Odoo knowledge. It's not a forum to discuss ideas, but a knowledge base of questions and their answers.


Odoo Training Center

Access to our E-learning platform and experience all Odoo Apps through learning videos, exercises and Quizz.

Test it now

Question tools

0 follower(s)


Asked: 12/29/13, 5:57 PM
Seen: 1411 times
Last updated: 3/16/15, 8:10 AM