← Back to team overview

c2c-oerpscenario team mailing list archive

[Bug 652213] Re: [5.0 & 6.0] Print workflow doesn't work if there is more than one workflow defined

 

** Changed in: openobject-server
       Status: New => Triaged

-- 
You received this bug notification because you are a member of C2C
OERPScenario, which is subscribed to the OpenERP Project Group.
https://bugs.launchpad.net/bugs/652213

Title:
  [5.0 & 6.0] Print workflow doesn't work if there is more than one workflow defined

Status in OpenObject Server:
  Triaged

Bug description:
  The print workflow report (bin/addons/base/ir/workflow/print_instance.py) will print a blank page for objects with more than one workflow defined.

This usually won't happen for a default installation of OpenERP, as most objects currently have just one workflow. But it may happen when a developer wants to create an alternative workflow (either to replace a default workflow [the new workflow would have on_create = True, and the original workflow would be set to on_create = False], or just to have alternative workflows that would be instanced by hand [on create = False]).

*** HOW TO REPRODUCE ***  

- Print the sale order's workflow => it works.
- Go to Administration -> Customization -> Workflow definitions -> Workflows.
- Create a new workflow (as simple as possible) for the sale order. 
- Set the new workflow as default ("On Create" set), and disable the original one ("On Create" unset).
- Print the previous sale order's workflow again => it works (still uses the original workflow).
- Create a new sale order (this sale order will get the new workflow).
- Print the new sale order's workflow => it prints a blank page.

*** DETAILS ***

When generating the report, only the first kind of workflow available for the given model (for the sale order object for example) is checked. So, when the object (whose workflow instance is being printed) created ("on create") a different kind of workflow, it is unable to find the workflow instance to print and a blank page is printed instead.

*** SOLUTION ***

- The report should check first if the object has a workflow instance already and, if available, use that instance workflow instead of the default one. 
- Otherwise (new object instance), the first workflow with "on_create" should be used (instead of just the first one).