Users

class user.res_users(pool, cr)[source]

Extends Odoo’s res_users to include point of service, parent locations of responsibility, following patients and the related doctor for the user.

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

Checks if user has an assigned point of service (POS).

Parameters:
  • user_id (int) – id of user to check
  • exception (bool) – False [default]
Returns:

if exception parameter is False, then returns True if POS is defined. Otherwise False. If is True, them returns True if POS is defined. If POS is undefined, then osv.except_osv is raised

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

Extends Odoo’s create() to update fields group_ids and doctor_id.

Parameters:vals (dict) – values to initialise the new record
Returns:id of created record
Return type:int
doctor_id

The value of such a field is a recordset of size 0 (no record) or 1 (a single record).

Parameters:
  • comodel_name – name of the target model (string)
  • 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)
  • ondelete – what to do when the referred record is deleted; possible values are: 'set null', 'restrict', 'cascade'
  • auto_join – whether JOINs are generated upon search through that field (boolean, by default False)
  • delegate – set it to True to make fields of the target model accessible from the current model (corresponds to _inherits)

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

filter_hcas(*args, **kwargs)[source]
filter_nurses(*args, **kwargs)[source]
classmethod filter_users_by_group(users, group)[source]
following_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)
get_groups_string(*args, **kwargs)[source]
Returns:list of NH Clinical user groups for UID in string format
get_name(*args, **kwargs)[source]
is_doctor(*args, **kwargs)[source]
Returns:
Return type:bool
is_senior_manager(*args, **kwargs)[source]
Returns:
Return type:bool
is_shift_coordinator(*args, **kwargs)[source]
Returns:
Return type:bool
is_system_admin(*args, **kwargs)[source]
Returns:
Return type:bool
location_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]

Gets the names of users.

Parameters:ids (list or int) – user ids
Returns:user names
Return type:list
pos_id

The value of such a field is a recordset of size 0 (no record) or 1 (a single record).

Parameters:
  • comodel_name – name of the target model (string)
  • 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)
  • ondelete – what to do when the referred record is deleted; possible values are: 'set null', 'restrict', 'cascade'
  • auto_join – whether JOINs are generated upon search through that field (boolean, by default False)
  • delegate – set it to True to make fields of the target model accessible from the current model (corresponds to _inherits)

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

pos_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)
update_doctor_status(*args, **kwargs)[source]

Updates doctor field in res_partner if user is a doctor.

Parameters:ids (list) – user ids
Returns:True
Return type:bool
update_group_vals(*args, **kwargs)[source]

Updates a user’s groups(see res_partner_category_extension and res_groups) for the user.

Parameters:
  • user_id (int) – id of user
  • vals (dict) – expecting a dictionary with keys group_ids and/or category_id. Values will be a list of ints
Returns:

True

Return type:

bool

static user_in_group(user, group)[source]
write(*args, **kwargs)[source]

Extends Odoo’s write() method.

Parameters:
  • ids (list or int) – id of records to update
  • values (dict) – values to update the records with
Returns:

True

Return type:

bool