Merge PR #1917 into 12.0

Signed-off-by pedrobaeza
pull/1921/head
OCA-git-bot 2021-05-04 16:07:12 +00:00
commit eb1c07c243
5 changed files with 61 additions and 34 deletions

View File

@ -6,15 +6,16 @@ msgid ""
msgstr "" msgstr ""
"Project-Id-Version: Odoo Server 12.0\n" "Project-Id-Version: Odoo Server 12.0\n"
"Report-Msgid-Bugs-To: \n" "Report-Msgid-Bugs-To: \n"
"PO-Revision-Date: 2021-02-17 13:45+0000\n" "POT-Creation-Date: 2021-05-04 13:10+0000\n"
"PO-Revision-Date: 2021-05-04 17:17+0200\n"
"Last-Translator: claudiagn <claudia.gargallo@qubiq.es>\n" "Last-Translator: claudiagn <claudia.gargallo@qubiq.es>\n"
"Language-Team: none\n" "Language-Team: none\n"
"Language: es\n" "Language: es\n"
"MIME-Version: 1.0\n" "MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n" "Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: \n" "Content-Transfer-Encoding: 8bit\n"
"Plural-Forms: nplurals=2; plural=n != 1;\n" "Plural-Forms: nplurals=2; plural=n != 1;\n"
"X-Generator: Weblate 4.3.2\n" "X-Generator: Poedit 2.4.1\n"
#. module: web_widget_one2many_product_picker #. module: web_widget_one2many_product_picker
#. openerp-web #. openerp-web
@ -37,19 +38,24 @@ msgstr "Todo"
msgid "Groups" msgid "Groups"
msgstr "Grupos" msgstr "Grupos"
#. module: web_widget_one2many_product_picker
#: model:ir.model,name:web_widget_one2many_product_picker.model_ir_http
msgid "HTTP Routing"
msgstr "Enrutamiento HTTP"
#. module: web_widget_one2many_product_picker #. module: web_widget_one2many_product_picker
#. openerp-web #. openerp-web
#: code:addons/web_widget_one2many_product_picker/static/src/xml/one2many_product_picker.xml:43 #: code:addons/web_widget_one2many_product_picker/static/src/xml/one2many_product_picker.xml:43
#, python-format #, python-format
msgid "Lines" msgid "Lines"
msgstr "Línias" msgstr "Líneas"
#. module: web_widget_one2many_product_picker #. module: web_widget_one2many_product_picker
#. openerp-web #. openerp-web
#: code:addons/web_widget_one2many_product_picker/static/src/xml/one2many_product_picker.xml:67 #: code:addons/web_widget_one2many_product_picker/static/src/xml/one2many_product_picker.xml:67
#, python-format #, python-format
msgid "Load More" msgid "Load More"
msgstr "Carga más" msgstr "Cargar más"
#. module: web_widget_one2many_product_picker #. module: web_widget_one2many_product_picker
#. openerp-web #. openerp-web
@ -58,6 +64,11 @@ msgstr "Carga más"
msgid "Price:" msgid "Price:"
msgstr "Precio:" msgstr "Precio:"
#. module: web_widget_one2many_product_picker
#: model:ir.model,name:web_widget_one2many_product_picker.model_product_pricelist_item
msgid "Pricelist Item"
msgstr "Elemento de tarifa"
#. module: web_widget_one2many_product_picker #. module: web_widget_one2many_product_picker
#: model:ir.model,name:web_widget_one2many_product_picker.model_product_product #: model:ir.model,name:web_widget_one2many_product_picker.model_product_product
msgid "Product" msgid "Product"
@ -114,10 +125,7 @@ msgstr "Imagen variante media (calculada)"
#. module: web_widget_one2many_product_picker #. module: web_widget_one2many_product_picker
#. openerp-web #. openerp-web
#: code:addons/web_widget_one2many_product_picker/static/src/js/views/One2ManyProductPicker/record.js:363 #: code:addons/web_widget_one2many_product_picker/static/src/js/views/One2ManyProductPicker/record.js:361
#, python-format #, python-format
msgid "[No widget %s]" msgid "[No widget %s]"
msgstr "[Sin widget %s]" msgstr "[Sin widget %s]"
#~ msgid "Add 1"
#~ msgstr "Añadir 1"

View File

@ -6,6 +6,8 @@ msgid ""
msgstr "" msgstr ""
"Project-Id-Version: Odoo Server 12.0\n" "Project-Id-Version: Odoo Server 12.0\n"
"Report-Msgid-Bugs-To: \n" "Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2021-05-04 13:10+0000\n"
"PO-Revision-Date: 2021-05-04 13:10+0000\n"
"Last-Translator: <>\n" "Last-Translator: <>\n"
"Language-Team: \n" "Language-Team: \n"
"MIME-Version: 1.0\n" "MIME-Version: 1.0\n"
@ -34,6 +36,11 @@ msgstr ""
msgid "Groups" msgid "Groups"
msgstr "" msgstr ""
#. module: web_widget_one2many_product_picker
#: model:ir.model,name:web_widget_one2many_product_picker.model_ir_http
msgid "HTTP Routing"
msgstr ""
#. module: web_widget_one2many_product_picker #. module: web_widget_one2many_product_picker
#. openerp-web #. openerp-web
#: code:addons/web_widget_one2many_product_picker/static/src/xml/one2many_product_picker.xml:43 #: code:addons/web_widget_one2many_product_picker/static/src/xml/one2many_product_picker.xml:43
@ -55,6 +62,11 @@ msgstr ""
msgid "Price:" msgid "Price:"
msgstr "" msgstr ""
#. module: web_widget_one2many_product_picker
#: model:ir.model,name:web_widget_one2many_product_picker.model_product_pricelist_item
msgid "Pricelist Item"
msgstr ""
#. module: web_widget_one2many_product_picker #. module: web_widget_one2many_product_picker
#: model:ir.model,name:web_widget_one2many_product_picker.model_product_product #: model:ir.model,name:web_widget_one2many_product_picker.model_product_product
msgid "Product" msgid "Product"
@ -103,7 +115,7 @@ msgstr ""
#. module: web_widget_one2many_product_picker #. module: web_widget_one2many_product_picker
#. openerp-web #. openerp-web
#: code:addons/web_widget_one2many_product_picker/static/src/js/views/One2ManyProductPicker/record.js:363 #: code:addons/web_widget_one2many_product_picker/static/src/js/views/One2ManyProductPicker/record.js:361
#, python-format #, python-format
msgid "[No widget %s]" msgid "[No widget %s]"
msgstr "" msgstr ""

View File

@ -249,23 +249,21 @@ odoo.define("web_widget_one2many_product_picker.One2ManyProductPickerRecord", fu
var context = {}; var context = {};
context["default_" + this.options.basicFieldParams.relation_field] = context["default_" + this.options.basicFieldParams.relation_field] =
this.options.basicFieldParams.state.id || null; this.options.basicFieldParams.state.id || null;
context["default_" + this.options.fieldMap.product] =
this.recordSearch.id || null;
return context; return context;
}, },
/** /**
* Forced data used in virtual states. * Forced data used in virtual states.
* Be careful with the onchanges sequence. Think as user interaction, not as CRUD operation. * Be careful with the onchanges sequence. Think as user interaction ("ADD", "DELETE", ... commands), not as CRUD operation.
* *
* @private * @private
* @returns {Object} * @returns {Object}
*/ */
_getInternalVirtualRecordData: function () { _getInternalVirtualRecordData: function() {
var data = {}; // To be overwritten
data[this.options.fieldMap.product] = { return {};
operation: 'ADD',
id: this.recordSearch.id,
};
return data;
}, },
/** /**

View File

@ -142,11 +142,6 @@ odoo.define("web_widget_one2many_product_picker.One2ManyProductPickerRenderer",
} }
} }
if (this.search_group.name === "main_lines") {
_.invoke(to_destroy, "destroy");
return $.when();
}
// If doesn't exists other records with the same product, we need // If doesn't exists other records with the same product, we need
// create a 'pure virtual' record again. // create a 'pure virtual' record again.
for (var index_destroy in to_destroy) { for (var index_destroy in to_destroy) {

View File

@ -588,17 +588,24 @@ odoo.define("web_widget_one2many_product_picker.FieldOne2ManyProductPicker", fun
model.setPureVirtual(evt.data.id, false); model.setPureVirtual(evt.data.id, false);
if (this.options.auto_save) { if (this.options.auto_save) {
// Dont trigger state update // Don't notifyChange because we already have all the onchange data for 1 qty
this._setValue( this._setValue(
{operation: "ADD", id: evt.data.id}, {operation: "ADD", id: evt.data.id},
{notifyChange: false} {notifyChange: false}
).then(function () { ).then(function () {
self.parent_controller.saveRecord(undefined, {stayInEdit: true}).then(function () { self.parent_controller.saveRecord(undefined, {stayInEdit: true}).then(function () {
self.renderer.updateState(model.get(self.parent_controller.handle).data[self.name], {force: true}); // When call 'saveRecord' with 'stayInEdit' the changes aren't confirmed so we force it
var parent_record = model.get(self.parent_controller.handle);
self.parent_controller.renderer.confirmChange(parent_record, parent_record.id, [self.name]).then(function() {
// Second call to callback method.
// We call two times because the first is for fast update
// this second is the update after parent changes
if (evt.data.callback) { if (evt.data.callback) {
evt.data.callback(); evt.data.callback();
} }
}); });
});
// First call to callback method
if (evt.data.callback) { if (evt.data.callback) {
evt.data.callback(); evt.data.callback();
} }
@ -620,17 +627,24 @@ odoo.define("web_widget_one2many_product_picker.FieldOne2ManyProductPicker", fun
_doUpdateQuickRecord: function (id, data, callback) { _doUpdateQuickRecord: function (id, data, callback) {
if (this.options.auto_save) { if (this.options.auto_save) {
var self = this; var self = this;
// Dont trigger state update var model = this.parent_controller.model;
this._setValue( this._setValue(
{operation: "UPDATE", id: id, data: data}, {operation: "UPDATE", id: id, data: data},
{notifyChange: false} {notifyChange: true}
).then(function () { ).then(function () {
self.parent_controller.saveRecord(undefined, {stayInEdit: true}).then(function () { self.parent_controller.saveRecord(undefined, {stayInEdit: true}).then(function () {
self.renderer.updateState(self.parent_controller.model.get(self.parent_controller.handle).data[self.name], {force: true}); // When call 'saveRecord' with 'stayInEdit' the changes aren't confirmed so we force it
var parent_record = model.get(self.parent_controller.handle);
self.parent_controller.renderer.confirmChange(parent_record, parent_record.id, [self.name]).then(function() {
// Second call to callback method.
// We call two times because the first is for fast update
// this second is the update after parent changes
if (callback) { if (callback) {
callback(); callback();
} }
}); });
});
// First call to callback method
if (callback) { if (callback) {
callback(); callback();
} }