Sao client how to avoid #ERROR when deleting a line with a wizard

Hi,

Is there a way to avoid the #ERROR in the tree view when we delete one record with a wizard action on it ? Just before the ‘reload’ the user could see a moment with lines deleted by the wizard with #ERROR. This view is linked with a class with a table_query method.

Tks,
Laurent

This text means there is some error on while loading the some field of the view.
You should review your server logs and fix the errors show there. Once the errors are fixes the error is fixed.

What are exactly the actions done by this wizard?

the wizard delete some of the selected records, modify the other and create new ones. It’s the deleted ones that contain the #ERROR but disappear after the reload.
What is the mecanism, the end of the wizard is sending a refresh to the view ?

A wizard is not supposed to delete record on which it is running because at the end of the execution, the client reload all the selected record but it does not know that some has been deleted.

I have used a similar pattern something like

def transition_start(self):
    pool = Pool()

    .....

    return 'end'

def end(self):
    return 'reload'

Just to mention this is on version 6.4

The selected records are still reloaded before the execution of the client action.
So this just hide the error.

Now maybe we could skip the implicit reload of the ids when there is client action. But this must be carefully thought to not break existing wizards.

Yes this was my point, the mecanism between the view and the wizard in term of reload. I use the code above with return ‘reload’. It’s nice to present to the user the result of the wizard without he has to reload manually, it works for new lines, updated lines but not for deleted. In term of functionnality I start from a quantity to affect in the wizard and if it’s a part of the quantity, it’s an update. Could be a split with new lines but if you use all the quantity I need to delete the line …

I can just temporary hide the line by setting a flag ‘visible’ (table_query should have it in the where clause) to false and deleting later …
=> No it doesn’t work ! Same thing #ERROR by changing the flag

So I’m curious Cédric how you’ll handle this, a list of physical quantities let’s say your stock. You can select one and then apply action of decrease quantity (update line), split (create new lines) or use it totally (delete the line). so what you select in the report, you’re not sure that it will be here at the end of the action.

Set the quantity to 0.
Deleting record should always be used in last resort.

The problem is that the user can decide to split by 10 for 10 sales and finally 5 min after wanted to split just in 4. An action called ‘Unsplit’ will put 0 for 6 lines and the user for sure will tell me “Could you please drop the line with quantity = 0” :slight_smile:
You was talking about implicit reload, do you think it’s possible to shunt it without modifying the core module ?

Ok I’ve temporary modified wizard.js by commenting this line in the destroy function of the wizard dialog:

//prm = screen.reload(ids, true);

With the final reload, it works fine but I havn’t tested a lot of configuration …