Location¶
-
class
location.nh_clinical_location(pool, cr)[source]¶ Represents a location where a patient may be located or an activity may take place.
There are different types of locations. The most common usage is to have a hospital as a parent location to a group of wards where each ward is a parent to several beds. The bed location is where the patient can be placed.
-
check_context_ids(*args, **kwargs)[source]¶ Check that the context can be applied to the model
Parameters: context_ids – Returns:
-
create(*args, **kwargs)[source]¶ Extends Odoo’s
create()method. Updatesnh_clinical_locationto write context_ids field.Parameters: vals (dict) – values to update the records with Returns: TrueReturn type: bool
-
get_available_location_ids(*args, **kwargs)[source]¶ Gets a list of available locations, only returning beds unless specified otherwise.
Parameters: usages – location type ( ward,bed, etc.) of available locationsReturns: location ids of available locations (default usage is bed)iReturn type: list
-
get_by_code(*args, **kwargs)[source]¶ Gets the location’s id by the location’s code. Creates a location if
auto_createisTrueand the location doesn’t exist.Parameters: Returns: location id of the location.
Falseifauto_createisTrueand location doesn’t exist, the location id of new ward location created. OtherwiseFalseReturn type:
-
get_closest_parent_id(*args, **kwargs)[source]¶ Gets a location’s closest ancestor (parent) location id of a particular usage. Returns
Falseif no such location exists.Parameters: - location_id (int) – location id
- usage – usage of location.
See
nh_clinical_location
Returns: location id of the ancestor. Otherwise
FalseReturn type:
-
is_child_of(*args, **kwargs)[source]¶ Checks if a location is a child of another location.
Parameters: Returns: the dictionary
location_id(key) and a string containing location name and parent location name (value) OtherwiseFalseis returned.Return type:
-
onchange_usage(*args, **kwargs)[source]¶ Hospital locations don’t have parent locations and they are always Point of Service type.
-