nh_activity

class activity.nh_activity(pool, cr)[source]

Class representing any event that needs to be recorded by the system.

Any user executed event that has a starting and ending point in time could be represented as an instance of this class.

Most of them will need extra information recorded within them and that is why this class is closely related to the data model classes, which could be also named activity type.

assign(**kwargs)[source]

Sets user_id to the specified user if allowed by access rights.

See data model assign for full implementation.

Parameters:
Returns:

True

Return type:

bool

assign_locked
cancel(**kwargs)[source]

Sets activity state to cancelled and records the date and user on date_terminated and terminate_uid respectively. See data model cancel for full implementation.

Parameters:activity_id (int) – activity id
Returns:True
Return type:bool
child_ids

One2many field; the value of such a field is the recordset of all the records in comodel_name such that the field inverse_name is equal to the current record.

Parameters:
  • comodel_name – name of the target model (string)
  • inverse_name – name of the inverse Many2one field in comodel_name (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)
  • auto_join – whether JOINs are generated upon search through that field (boolean, by default False)
  • limit – optional limit to use upon read (integer)

The attributes comodel_name and inverse_name are mandatory except in the case of related fields or field extensions.

complete(**kwargs)[source]

Sets activity state to completed and records the date and user on date_terminated and terminate_uid respectively. See data model complete for full implementation.

Parameters:activity_id (int) – activity id
Returns:True
Return type:bool
create(*args, **kwargs)[source]

Creates an activity. Raises an exception if data_model isn’t in parameter vals or if data_model doesn’t exist as a table in the database.

Parameters:vals (dict) – must include data_model key:value pair
Raises:osv.except_osv
Returns:id of created activity
Return type:int
create_date
create_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 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.

created_ids

One2many field; the value of such a field is the recordset of all the records in comodel_name such that the field inverse_name is equal to the current record.

Parameters:
  • comodel_name – name of the target model (string)
  • inverse_name – name of the inverse Many2one field in comodel_name (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)
  • auto_join – whether JOINs are generated upon search through that field (boolean, by default False)
  • limit – optional limit to use upon read (integer)

The attributes comodel_name and inverse_name are mandatory except in the case of related fields or field extensions.

creator_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.

data_model

Very similar to Char but used for longer contents, does not have a size and usually displayed as a multiline text box.

Parameters:translate – whether the value of this field can be translated
data_ref
date_deadline
date_expiry
date_planned
date_scheduled
date_started
date_terminated
get_recursive_created_ids(*args, **kwargs)[source]

Recursively gets ids of all activities created by an activity or all activitie

Parameters:activity_id (int) – id of activity
Returns:list of activity ids
Return type:list
notes

Very similar to Char but used for longer contents, does not have a size and usually displayed as a multiline text box.

Parameters:translate – whether the value of this field can be translated
parent_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.

schedule(**kwargs)[source]

Sets date_scheduled to the specified date and changes the activity state to scheduled. See data model schedule for full implementation.

Parameters:
  • activity_id (int) – activity id
  • date_scheduled (str) – date formatted string
Returns:

True

Return type:

bool

sequence
start(**kwargs)[source]

Sets activity state to started.

See data model start for full implementation.

Parameters:activity_id (int) – activity id
Returns:True
Return type:bool
state
Parameters:
  • selection – specifies the possible values for this field. It is given as either a list of pairs (value, string), or a model method, or a method name.
  • selection_add – provides an extension of the selection in the case of an overridden field. It is a list of pairs (value, string).

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

submit(**kwargs)[source]

Updates activity data. See data model submit for full implementation.

Parameters:
  • activity_id (int) – activity id
  • vals (dict) – dictionary containing {field_name: new_value}
Returns:

True

Return type:

bool

summary

Basic string field, can be length-limited, usually displayed as a single-line string in clients

Parameters:
  • size (int) – the maximum size of values stored for that field
  • translate (bool) – whether the values of this field can be translated
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 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.

unassign(**kwargs)[source]

Sets user_id to False. Only the current owner of the activity is allowed to do this action. See data model unassign for full implementation.

Parameters:activity_id (int) – activity id
Returns:True
Return type:bool
update_activity(**kwargs)[source]

This method is meant to refresh any real time data that needs to be refreshed on the activity. Does nothing as default. Included for potential utility on some activity types.

Parameters:activity_id (int) – activity id
Returns:True
Return type:bool
user_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.

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

Writes to an activity. sequence will be updated if the the state of the activity is changed.

Parameters:
  • ids (list) – activity ids to write to
  • vals (dict) – values to write to activity
Returns:

True

Return type:

bool

write_date
write_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 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.