Hi all, We still have a problem with this issue. We have extended the partner and user objects as follows: class res_partner(osv.osv): """Extension of class res.partner to link a Partner object with one or more Department objects. Adds a new field departments_id """
_inherit = 'res.partner' # Columns added to res_partner table _columns = { 'departments_id': fields.many2many('hr.department', 'hr_department_partner_rel', 'partner_id', 'department_id', 'Departments'), } res_partner() class res_users(osv.osv): """ Add departments to user object. This way we can compare the departments a user belongs to with a partner's ones""" _inherit = 'res.users' _description = 'res.users' _columns = { 'department_ids': fields.many2many('hr.department', 'hr_department_user_rel', 'user_id', 'department_id', 'Departments'), } res_users() - A global record rule has been created on object Partner: Partner/Departments in User/Departments - Partners are displayed properly according to this configuration. However, when a user tries to create an invoice, an exception "You try to bypass an access rule (Document type: Partner)" is thrown. The exception is thrown in invoice.py, method action_move_create at line context.update({'lang': inv.partner_id.lang}) Commenting this line makes the creation of invoices work. inv.partner_id is the function browse_record(res.partner, 4) Anyone has found a similar problem? Is it due to the many2many relation in both directions (Partner <-> Department; User <-> Department)?[/code] ------------------------ Jose A. Corbacho Trobz (www.trobz.com) -------------------- m2f -------------------- -- http://www.openobject.com/forum/viewtopic.php?p=50559#50559 -------------------- m2f -------------------- _______________________________________________ Tinyerp-users mailing list http://tiny.be/mailman2/listinfo/tinyerp-users
