Review: Needs Fixing
Fix is pretty good and correctly solves problem, but code can be improved:
* fields_get call is redundant, we already have fields because
`self.form_dialog.form` has `fields_view` which stores result of its
`fields_view_get`.
* Also default_get should only request fields that are missing (not in `data`)
otherwise if fields are function fields can cost lots, so default_get should
ask for
_.difference(_(self.form_dialog.form.fields_view.fields).keys(),
_(data).keys())
(_.difference returns values in first array which are not in second array, so
we want fields of fields_view_get which are not already in data)
this way default_get does not ask for values already provided by user (fields
name, date from and date to)
* Underscore has function to merge objects together:
data = _.extend(default_value, data)
no need to do by hand (warning: _.extend merges second object and after into
first one, so it modifies first object also)
* Also default_get should only happen in second function argument to
dataset.create: if name, date_from and date_to are enough to create event,
there is no need for default_get so user can be faster if we don't do it
--
https://code.launchpad.net/~openerp-dev/openerp-web/trunk-bug-893498-vme/+merge/83252
Your team OpenERP R&D Team is subscribed to branch
lp:~openerp-dev/openerp-web/trunk-bug-893498-vme.
_______________________________________________
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