hooks for extension
during the community days 2010 we realized that some methods are to complex to allow easy extension
I'll try to define some problems
* computation of qty*price
** it would be desirable to create a separate function for this (at product_product)
* write (stock_picking, stock_move, account_move, account_move_line, ...)
Example bank_statement - button confirm
* writes twice into account_move_lines - no chance to add a data field
- solution
* button_confirm
** write_1
*** accmount_
** write_2
*** accmount_
whereas the intermediate write1 and write2 do nothing except calling accmount_
this would allow to overwrite
* each of the bank_statement intermediate writes
* the account_move_line write.
ideally the write of resources is only defined and done in a method defined in the target class itself.
if this is the way to go it should be implemented in V6
Please comment
Blueprint information
- Status:
- Not started
- Approver:
- None
- Priority:
- Undefined
- Drafter:
- None
- Direction:
- Needs approval
- Assignee:
- None
- Definition:
- New
- Series goal:
- None
- Implementation:
- Unknown
- Milestone target:
- None
- Started by
- Completed by
Related branches
Related bugs
Sprints
Whiteboard
One solution is to refactor code.
Using multiple method instead of a big one.
So you will have more control on what to changes.
I have the same problem with document (in 5.0).
Document module is providing, storage method and other usefull stuff in one big method. To inherit this class you have to copy/paste the code.
-------
We should use the "template method pattern" (http://
As an example, on the account_
def button_
...
val = {
}
...
This could be improved to use the template method pattern:
def _get_move_
def button_
...
val = {
}
...
val = self._get_
This would mean that another module would be able to extend the button_confirm just redefining the _get_move_
def _get_move_