Odoo Help

1

Duplicate group leads to Constraint error

By
Gregoire Huet
on 9/3/13, 6:19 AM 3,091 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

1
Gregoire Huet
On 9/3/13, 8:42 AM

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

0
Marko Happonen
On 10/4/16, 2:45 PM

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.

0
Borni DHIFI
On 9/3/13, 6:52 AM

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

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.

Register

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

1 follower(s)

Stats

Asked: 9/3/13, 6:19 AM
Seen: 3091 times
Last updated: 10/4/16, 2:45 PM