Odoo Help

Welcome!

This community 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.

0

New note access denied

By
ViktorV
on 12/29/13, 5:57 PM 1,100 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.

0
ViktorV
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)

ViktorV
on 1/13/14, 3:46 AM

Your Answer

Please try to give a substantial answer. If you wanted to comment on the question or answer, just use the commenting tool. Please remember that you can always revise your answers - no need to answer the same question twice. Also, please don't forget to vote - it really helps to select the best questions and answers!

About This Community

This community is for professionals and enthusiasts of our products and services. Read Guidelines

Question tools

0 follower(s)

Stats

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