This question has been flagged
1 Reply
4009 Views

We use the module "project" and "project_issue" of odoo. here we created a project with different stages. So the issues in this project can be moved in any stage. To indicate if an issue is done and for later usage we modified the stage configuration (added a field to indicate if this stage is for the "done tickets"). Later we want to run actions if one ticket is moved to this stage.


To avoid unintended changings of the stage changes of a ticket we want to show a model if the ticket is moved to the "done stage". This modal should ask if the user wants to change this ticket to this stage. I tried a bit but found no working solutions for this.


I tried these possible solutions:

  1. I created a new function with @api.onchange('stage') for model ticket.issue. But this function was never called (I added a test print).

  2. Another possible solution are the workflows. I created a new workflow for the project.issue model and created an action. Also this action wasn't called. But maybe I did something wrong because I never worked with workflows in odoo.


Do you have any suggestions or ideas how to solve this issue?

Avatar
Discard
Best Answer

Hi Christoph,

Try with write() method.

When the state being changed the write method is called in back end.

Here is the sample of write method if you are using api coding standard.


@api.multi 
def write(self, vals):
#your custom code
result = super(class_name, self).write()
#your custom code
return result

Hope this will help.

Regards,

Anil


Avatar
Discard