We want to correctly implement Tryton - Wizard options, where every change made in the Wizard, at the end of the Wizard, is presented in every open interface by the User who made the change.
The context:
We have a menu to manage records, records start with a “status 1” by default.
To facilitate the management of records by status, submenus are implemented, therefore, When the User applies double click on a submenu #1, records with status #1 appear in a tree view. likewise, for all other submenus.
Image: Interface Menu and submenus.
To manage statuses, double-clicking on each record displays the form view assigned to the status, and in the form, the User has selection fields and text fields and buttons. The buttons are used to change the status.
Image: Form view interface.
Each button triggers a Wizard that prompts the User to select the reason for the status change, and enter text with observations of the status change. The Wizard ends by changing to the new status and saving the information.
Image: Wizard window interface.
The difficulty:
Immediately the Wizard finishes, the information entered by the User is saved in the database, but in the current User’s interface the changes are not visible.
To force to see the changes, the User has to switch to the tree view and then click on the “update” button in the Tryton toolbar.
Expected:
To avoid errors or to streamline the workflow, it is required that at the end of each Wizard:
- Automatically update all changes in the User interface.
or alternatively:
- The form view is changed to tree view, showing the new information.
Environment:
- OS: Ubuntu 20.04.1 LTS
- Python: 3.8.5
- Trytond: 5.8.1
- Tryton: 5.8.1
- Module: 5.8
- Postgresql: 12.5
Example code:
We have the following code of a Wizard that allows to make changes in the registry, at the end, it calls ‘reload’ to refresh the User interface, without success.
Trying to test another alternative, the code calls the other window action with the new state that will have the registry, we also failed to open that window action.
start_state = 'parameters'
parameters = StateView(
'records.manage_records.parameters',
'records.manage_records_parameters_view_form', [
Button('Cancelar', 'end', 'tryton-cancel'),
Button('Guardar', 'save', 'tryton-forward', default=True)
])
save = StateTransition()
open_records = StateAction('records.act_state_closed_list')
def default_parameters(self, name):
return {
'closing_date': datetime.date.today(),
}
def transition_save(self):
pool = Pool()
Record = pool.get('records')
records = Record.browse(Transaction().context['active_ids'])
for record in records:
record.closing_date = self.parameters.closing_date
record.solution_summary = self.parameters.solution_summary
record.cause_incidence = self.parameters.cause_record
record.sub_state = 'new_closed'
Record.save(records)
# Option 1
return 'end'
# Option 2
return 'open_records'
def do_open_record(self):
return 'end'
# the last step ...
def end(self):
return 'reload'
We appreciate your help !