From 27a739385249cff8c8779cb0d7be140e0b89226a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Aur=C3=A9lien=20Warnon?= Date: Thu, 27 Sep 2018 09:42:17 +0200 Subject: [IMP] product,(website_)sale: Product configurator default_get cleanup Targets commit d3530eb07e24278117ab396ecb86a59deecc312d Purpose ======= [Follow up AL review] Removed the default_get override in the sale_order_line model. - The default values to create records are now specified by pefixing them with "default_" in the JS. That will use the built-in framework method, which is more simple/clean. - The "list_editable_renderer.js" file for the product configurator was removed and its content is now merged within the SectionAndNoteListRenderer. Updated fields: - [sale_order_line in sale/sale.py] "product_no_variant_attribute_values" to "product_no_variant_attribute_value_ids" --- addons/web/static/src/js/views/basic/basic_model.js | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) (limited to 'addons/web/static/src/js/views/basic/basic_model.js') diff --git a/addons/web/static/src/js/views/basic/basic_model.js b/addons/web/static/src/js/views/basic/basic_model.js index 94d0ea78c0e..f6bf46aed68 100644 --- a/addons/web/static/src/js/views/basic/basic_model.js +++ b/addons/web/static/src/js/views/basic/basic_model.js @@ -1328,10 +1328,10 @@ var BasicModel = AbstractModel.extend({ * @param {Object} [options] * @param {string} [options.position=top] if the new record should be added * on top or on bottom of the list - * @param {Object} [options.[context]] additional context to be merged before + * @param {Array} [options.[context]] additional context to be merged before * calling the default_get (eg. to set default values). * If several contexts are found, multiple records are added - * @param {boolean} [params.allowWarning=false] if true, the default record + * @param {boolean} [options.allowWarning=false] if true, the default record * operation can complete, even if a warning is raised * @returns {Deferred<[string]>} resolves to the new records ids */ @@ -1349,7 +1349,7 @@ var BasicModel = AbstractModel.extend({ var additionalContexts = options && options.context; var makeDefaultRecords = []; - if(additionalContexts){ + if (additionalContexts){ _.each(additionalContexts, function (context) { params.context = self._getContext(list, {additionalContext: context}); makeDefaultRecords.push(self._makeDefaultRecord(list.model, params)); @@ -1359,9 +1359,9 @@ var BasicModel = AbstractModel.extend({ makeDefaultRecords.push(self._makeDefaultRecord(list.model, params)); } - return $.when.apply($, makeDefaultRecords).then(function(){ + return $.when.apply($, makeDefaultRecords).then(function (){ var ids = []; - _.each(arguments, function(id){ + _.each(arguments, function (id){ ids.push(id); list._changes.push({operation: 'ADD', id: id, position: position, isNew: true}); @@ -1394,7 +1394,7 @@ var BasicModel = AbstractModel.extend({ * it was changed. * @param {string} [options.viewType] current viewType. If not set, we will assume * main viewType from the record - * @param {boolean} [params.allowWarning=false] if true, change + * @param {boolean} [options.allowWarning=false] if true, change * operation can complete, even if a warning is raised * (only supported by X2ManyChange) * @returns {Deferred} list of changed fields @@ -1745,7 +1745,7 @@ var BasicModel = AbstractModel.extend({ * key. For example, it looks like {operation: ADD, id: 'partner_1'} * @param {string} [viewType] current viewType. If not set, we will assume * main viewType from the record - * @param {boolean} [params.allowWarning=false] if true, change + * @param {boolean} [allowWarning=false] if true, change * operation can complete, even if a warning is raised * (only supported by the 'CREATE' command.operation) * @returns {Deferred} -- cgit v1.2.3