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.

1

Duplicate group leads to Constraint error

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

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
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

Borni DHIFI

--Borni DHIFI--
5102
| 6 8 9
Tunis, Tunisia
--Borni DHIFI--

Techno Functional Consultant Odoo(OpenERP) 

http://www.linkedin.com/in/borni

Skype : dhifi.borni

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

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

1 follower(s)

Stats

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