Refactor old style wizards using OOP osv_memory instead

Registered by Raphaël Valyi - http://www.akretion.com

old wizards are not OOP and lead to non compatibles modules/ugly code/non maintainable code because of this.
Since rewriting all wizards is too much work for 5.2, I propose to rewrite at least the main ones we often need to extend.

Blueprint information

Status:
Complete
Approver:
None
Priority:
High
Drafter:
None
Direction:
Needs approval
Assignee:
None
Definition:
Discussion
Series goal:
None
Implementation:
Implemented
Milestone target:
milestone icon 6.0
Started by
Raphaël Valyi - http://www.akretion.com
Completed by
Raphaël Valyi - http://www.akretion.com

Sprints

Whiteboard

Hope this will help community.
http://doc.openerp.com/developer/3_10_wizard/index.html#guidelines-on-how-to-convert-old-style-wizard-to-new-osv-memory-style

The main old wizards I would like to see rewritten using osv_memory are:

- packing wizards: partial packing, return packing, etc.
- invoice on picking
- pay invoice
- group purchase orders
- transform lead into partner in CRM
- mass reconciliation

others?

ISSUE:
The issue is, as you can see on our branch where we already did it for the "invoice on pciking":
https://code.launchpad.net/~openerp-community/openobject-addons/addons5.2-osv_mem-wizards

But currently, The OpenObject framework has limitations with osv_memory wizard, especially in the clients that make it impossible to make the a drop in replacement for old non OOP wizards.

Especially:
1) osv_memory wizards can't be put in the right side panel with the other wizards
2) it looks like osv_memory wizards can't be called with several records like other wizards
3) we need some scoping guidance. Putting all wizard specif code inside the object main file doesn't scale as it doesn't explicit where things are dependents or independents. Having a separated file like the old wizard is much better to this respect. However, in the current codebase, no osv_memory has been put inside such external files, we need some good convention to be established by Tiny so it can be followed.

We first need a guidance from Tiny on how to refactor those wizards with a working example, then the community would be very happy to refactor them.

Raphaël Valyi - 15/02/2010
Using Twitter, Olivier Dony from Tiny just mentioned me that osv_memory may actually be able to do the job.
He suggest we investigate that new example:
http://bazaar.launchpad.net/~openerp-commiter/openobject-addons/trunk-extra-addons/annotate/head:/memento_idea/wizard/cleanup.xml#L30
Anyone to confirm? I'll look at that myself too later in the week, so feel free to finish our invoice on packing example in the meantime in our branch, it's open to the committer group. If that works, then we can allocate the refactoring work for the other wizards.

Numérigraphe - 2010-03-30
Refactoring the stock packing wizards is on our radar. They're definitly unusable in our business, and I think I can provide a cleaner wizard using a bare-bone old-style wizard and a few osv_memory objects.
If anyone else is working on this, please let me know: I'll gladly help or review.
Lionel

Sharoon Thomas - 2010-03-30
Quote :"1) osv_memory wizards can't be put in the right side panel with the other wizards"
 - osv_memory wizards can be used with wizard buttons. (Answer: yes we can do this, don't use wizard element, but record element on ir.values "Christophe Chauvet")
Quote : "2) it looks like osv_memory wizards can't be called with several records like other wizards"
 - It can be done with active_ids too (Answer: yes it works in list view, see the first answer)

All right it has all been implemented in v6 by now. Cool!

(?)

Work Items