Jump to content

Event listener - Require timelog comments


Lucas Correia

Recommended Posts

Hi,

I've created an event listener to require comments when logging time on certain tasks, and thought I should share it with the community. It shows the usage of triggering and handling an actions UI based on an event. Please let me know if you have any comments or feedback.

 

You can find the snippet on bitbucket.

 

Event listener: Require timelog comments
The event listener can be used to require comments when logging time against certain tasks from the ftrack interface. The event listener will trigger an Action UI to require timelog comments if the custom attribute require_comments is set on the timelog context.
 

Configuration

You can configure the following in the script:

REQUIRE_COMMENTS_ATTRIBUTE
    The name of the custom attribute, that can be used to control if a task requires timelog comments.

 

Running the event listener

You can run the event listener from the command line::

python require_timelog_comments.py

You can also register the event listener as a plugin. For more information, see the links below.

Quote

You can use something like Supervisor or Monit to monitor and ensure the event listener is always running.

 

Read more

Find more information in our documentation:

* Developing: Events
* Event: Action - trigger interface
* Event: Update
* Tracking time
* Python API: Configuring plugins
* Python API: Environment variables

Link to comment
Share on other sites

  • 3 weeks later...

Hi Lucas,

 

thanks for sharing it.

 

During the tests I face some issues: if the custom attribute REQUIRE_COMMENTS_ATTRIBUTE changes on the task while the event is running, the event still uses the initial value. How can we fix it?

I have the same issue if I would like to query the project period for eg.

I use ftrack-python-api-1.0.1 and ftrack-api-3.3.34.

 

Regards,

Laura

 

Link to comment
Share on other sites

Thanks for raising the issue Laura.

I've confirmed the behaviour, and have no good workaround at this point.

A brute-force solution would be to call `session.reset()` on line 57 of the snippet, but this is far from optimal and will discuss this with the team to see if we can find a long term solution to this.

Regards,
Lucas

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...