Přejít na obsah
Menu
You need to be registered to interact with the community.
This question has been flagged
2 Odpovědi
4997 Zobrazení

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.

Avatar
Zrušit
Autor Nejlepší odpověď

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
Avatar
Zrušit
Autor

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

Related Posts Odpovědi Zobrazení Aktivita
4
bře 15
8188
2
bře 15
4298
0
bře 15
3364
0
led 25
925
0
zář 22
2938