nh_activity_data¶
-
class
activity.nh_activity_data(pool, cr)[source]¶ Abstract class that relates to activity from which every activity type will inherit from.
-
activity_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
Trueto 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.
-
assign(*args, **kwargs)[source]¶ Assigns activity to a user. Raises an exception if it is already assigned to another user. If it is already assigned to the same user, then the activity is locked.
Parameters: Returns: TrueReturn type:
-
cancel(*args, **kwargs)[source]¶ Cancels an activity and sets its
date_terminated.Parameters: activity_id (int) – activityidReturns: TrueReturn type: bool
-
complete(*args, **kwargs)[source]¶ Completes an activity and sets its
date_terminated.Parameters: activity_id (int) – activityidReturns: TrueReturn type: bool
-
convert_record_to_data_ref(*args, **kwargs)[source]¶ Useful for getting the value for domains so you can search on data_ref.
Returns: Return type: str
-
create(vals) → record[source]¶ Creates a new record for the model.
The new record is initialized using the values from
valsand if necessary those fromdefault_get().Parameters: vals (dict) –
values for the model’s fields, as a dictionary:
{'field_name': field_value, ...}
see
write()for detailsReturns: new record created
Raises: - AccessError –
- if user has no create rights on the requested object
- if user tries to bypass access rules for create on the requested object
- ValidateError – if user tries to enter invalid value for a field that is not in selection
- UserError – if a loop would be created in a hierarchy of objects a result of the operation (such as setting an object as its own parent)
- AccessError –
-
create_activity(*args, **kwargs)[source]¶ Creates a new
activityof the current data type.Parameters: Returns: activityid.Return type:
-
date_started¶
-
date_terminated¶
-
get_latest_activity(*args, **kwargs)[source]¶ Return the most recent activity for a given data model.
Parameters: - data_model –
- spell_activity_id –
Returns:
-
get_open_activities(*args, **kwargs)[source]¶ Get open activity(s) for one spell or all spells. :return: list of activities :rtype: list
-
get_open_activity(*args, **kwargs)[source]¶ Get the latest open activity for the given model. The method assumes that only one open activity at a time is possible for the given model. If more than one is found an exception is raised.
Parameters: spell_activity_id – Returns:
-
is_action_allowed(state, action)[source]¶ Tells us if the specified action is allowed in the specified state.
Parameters: Returns: TrueorFalseReturn type:
-
name¶ Basic string field, can be length-limited, usually displayed as a single-line string in clients
Parameters:
-
schedule(*args, **kwargs)[source]¶ Schedules an activity and sets its
date_scheduled.Parameters: Returns: TrueReturn type:
-
start(*args, **kwargs)[source]¶ Starts an activity and sets its
date_started.Parameters: activity_id (int) – activityidReturns: TrueReturn type: bool
-
state¶ Basic string field, can be length-limited, usually displayed as a single-line string in clients
Parameters:
-
submit(*args, **kwargs)[source]¶ Updates submitted data. It creates a new instance of the data model if it does not exist yet.
Parameters: Returns: TrueReturn type:
-
terminate_uid¶ 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
Trueto 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.
-