Partner Category Extension

class partner.res_partner_category_extension(pool, cr)[source]

Extends Odoo’s res_partner_category to add functionality for roles.

Creates many-to-many relationship between categories (roles) and groups, allowing a relation between each role and corresponding group(s).

An example would be the role ‘Registrar’ belonging to groups base, doctor, senior doctor and registrar groups.

get_child_of_ids(*args, **kwargs)[source]

Gets all child category ids of parent, recursively.

Parameters:id (int) – parent id
Returns:parent id follow by child ids
Return type:list
get_user_roles(*args, **kwargs)[source]
group_ids

Many2many field; the value of such a field is the recordset.

Parameters:comodel_name – name of the target model (string)

The attribute comodel_name is mandatory except in the case of related fields or field extensions.

Parameters:
  • relation – optional name of the table that stores the relation in the database (string)
  • column1 – optional name of the column referring to “these” records in the table relation (string)
  • column2 – optional name of the column referring to “those” records in the table relation (string)

The attributes relation, column1 and column2 are optional. If not given, names are automatically generated from model names, provided model_name and comodel_name are different!

Parameters:
  • domain – an optional domain to set on candidate values on the client side (domain or string)
  • context – an optional context to use on the client side when handling that field (dictionary)
  • limit – optional limit to use upon read (integer)
name_get(*args, **kwargs)[source]

Extends Odoo’s name_get() method, fetching the short version of category name belonging to ids (without their direct parent).

Parameters:
  • user (int) – user id
  • ids (list) – ids of the categories
Returns:

categories’ display names

Return type:

list