Review: Disapprove
This is typically the kind of change that is very "Wishlist" and puts a stable
version at risk by introducing worse behavior just because some customer has
reported a behavior that they don't like. Changing it will probably make the
experience worse for many people and there will never be a 100% satisfying set
of on_change methods because the system cannot guess in which order the user
will fill the fields, and which one he expects to be updated by on_change
depending on the case. How do you know if 'modified price' was actually
modified or not, and if the modification should prevail over the new change or
not, even if it was modified?
We should just pick one behavior that seems logical and stick with it. For
example changing the selected product is not an use case to consider because
it's not the normal flow, it's an exception and users can manually fix it.
And on a code style note:
1. As repeated countless times, calling dict.get(key, False) is useless if you
only want to test whether the result is "falsy", because dict.get() will return
None if the key is missing, and this is fine in most circumstances.
modified_name = context.get('modified_name', False) # useless parameter for
get
modified_name = context.get('modified_name') # just fine
2. As repeated countless times, that calling dict.update({...}) with a literal
dict argument is useless, you can simply pass keywords to dict.update() without
building a temporary dict:
res['value'].update(name=modified_name or product.name,
notes=modified_purchase_desc or
product.description_purchase)
The code style does not matter much here, but please keep it in mind for future
patches, and inform your colleagues who keep doing the same mistakes too :-)
--
https://code.launchpad.net/~openerp-dev/openobject-addons/6.1-opw-381574-rgo/+merge/93978
Your team OpenERP R&D Team is subscribed to branch
lp:~openerp-dev/openobject-addons/6.1-opw-381574-rgo.
_______________________________________________
Mailing list: https://launchpad.net/~openerp-dev-gtk
Post to : [email protected]
Unsubscribe : https://launchpad.net/~openerp-dev-gtk
More help : https://help.launchpad.net/ListHelp