This question has been flagged
3 Replies
6503 Views

Hello !

I would like to give access to customer invoices but not to supplier invoices to a group of users.

I was told to duplicate a group to achieve it, but in openerp-7.0-20130820-231334, i cannot do that (constraint error).

Is there something special to duplicate it ? Or would you advise me to do it in another way ?

Thanks a lot

AJ

Avatar
Discard
Author Best Answer

Thank you Borni for your answer.

I've changed a few things in addons/base/res/res_users.py :

in function "copy"

        group_name = self.read(cr, uid, [id], ['name'])[0]['name']
        _logger.debug("DEBUG Current group name  : %s", group_name)
        default = default.copy()
        default.update({'name': group_name + " (Copy)"})
        _logger.debug("DEBUG Updated group name  : %s", default)
        return super(groups, self).copy(cr, uid, id, default, context)

and in function "write", i output the name of the group. Strangely, it is not updated :

(timestamp) DEBUG MY_DB openerp.addons.base.res.res_users: DEBUG Current group name  : Invoicing & Payments
(timestamp) DEBUG MY_DB openerp.addons.base.res.res_users: DEBUG Updated group name  : {'name': u'Invoicing & Payments (Copy)'}
(timestamp) DEBUG MY_DB openerp.addons.base.res.res_users: DEBUG Writing group : {u'name': u'Invoicing & Payments'}

I don't get why the "default" object isn't actually updated with the new value.

Can you give me a track for finding out ?

Thanks a lot AJ

Avatar
Discard
Best Answer

Hi,

You can Export the user group to xls/csv and Import it with another value in 'Name' field. This makes a duplicate and  you can adjust the new entry as you wish. Tested and works fine.

Avatar
Discard
Best Answer

Hi,

in function copy :

         Craft our own `<name> (copy)` in en_US (self.copy_translation()

         will do the other languages).

you can see function copy in product.product.

must be used lang in context

Avatar
Discard