[REF] *: Replace underscore functions by native JS
Replace _.last, _find, _.extend, _.some, _.every Taskid 3246238 closes odoo/odoo#117319 Signed-off-by: Bruno Boi (boi) <boi@odoo.com>
This commit is contained in:
@@ -154,10 +154,10 @@ QUnit.test("leave stats reload when employee/department changes", async (assert)
|
|||||||
</form>`,
|
</form>`,
|
||||||
mockRPC(route, args) {
|
mockRPC(route, args) {
|
||||||
if (args.model === "hr.leave" && args.method === "search_read") {
|
if (args.model === "hr.leave" && args.method === "search_read") {
|
||||||
assert.ok(_.some(args.kwargs.domain, _.matcher(["department_id", "=", 11])));
|
assert.ok(args.kwargs.domain.some(_.matcher(["department_id", "=", 11])));
|
||||||
}
|
}
|
||||||
if (args.model === "hr.leave" && args.method === "read_group") {
|
if (args.model === "hr.leave" && args.method === "read_group") {
|
||||||
assert.ok(_.some(args.kwargs.domain, _.matcher(["employee_id", "=", 200])));
|
assert.ok(args.kwargs.domain.some(_.matcher(["employee_id", "=", 200])));
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -22,11 +22,8 @@ Model({
|
|||||||
* @param {Object} [options={}]
|
* @param {Object} [options={}]
|
||||||
*/
|
*/
|
||||||
addMessage(data, options) {
|
addMessage(data, options) {
|
||||||
const hasAlreadyMessage = _.some(
|
const hasAlreadyMessage = this.messaging.publicLivechatGlobal.messages.some(
|
||||||
this.messaging.publicLivechatGlobal.messages,
|
(msg) => data.id === msg.id
|
||||||
function (msg) {
|
|
||||||
return data.id === msg.id;
|
|
||||||
}
|
|
||||||
);
|
);
|
||||||
if (hasAlreadyMessage) {
|
if (hasAlreadyMessage) {
|
||||||
return;
|
return;
|
||||||
|
|||||||
@@ -4,16 +4,16 @@ import {_lt} from "web.core";
|
|||||||
import snippetsEditor from "web_editor.snippet.editor";
|
import snippetsEditor from "web_editor.snippet.editor";
|
||||||
|
|
||||||
const MassMailingSnippetsMenu = snippetsEditor.SnippetsMenu.extend({
|
const MassMailingSnippetsMenu = snippetsEditor.SnippetsMenu.extend({
|
||||||
events: _.extend({}, snippetsEditor.SnippetsMenu.prototype.events, {
|
events: Object.assign({}, snippetsEditor.SnippetsMenu.prototype.events, {
|
||||||
'click .o_we_customize_design_btn': '_onDesignTabClick',
|
'click .o_we_customize_design_btn': '_onDesignTabClick',
|
||||||
}),
|
}),
|
||||||
custom_events: _.extend({}, snippetsEditor.SnippetsMenu.prototype.custom_events, {
|
custom_events: Object.assign({}, snippetsEditor.SnippetsMenu.prototype.custom_events, {
|
||||||
drop_zone_over: '_onDropZoneOver',
|
drop_zone_over: '_onDropZoneOver',
|
||||||
drop_zone_out: '_onDropZoneOut',
|
drop_zone_out: '_onDropZoneOut',
|
||||||
drop_zone_start: '_onDropZoneStart',
|
drop_zone_start: '_onDropZoneStart',
|
||||||
drop_zone_stop: '_onDropZoneStop',
|
drop_zone_stop: '_onDropZoneStop',
|
||||||
}),
|
}),
|
||||||
tabs: _.extend({}, snippetsEditor.SnippetsMenu.prototype.tabs, {
|
tabs: Object.assign({}, snippetsEditor.SnippetsMenu.prototype.tabs, {
|
||||||
DESIGN: 'design',
|
DESIGN: 'design',
|
||||||
}),
|
}),
|
||||||
optionsTabStructure: [
|
optionsTabStructure: [
|
||||||
|
|||||||
@@ -231,7 +231,7 @@ export const PosDB = core.Class.extend({
|
|||||||
add_packagings: function (product_packagings) {
|
add_packagings: function (product_packagings) {
|
||||||
var self = this;
|
var self = this;
|
||||||
_.map(product_packagings, function (product_packaging) {
|
_.map(product_packagings, function (product_packaging) {
|
||||||
if (_.find(self.product_by_id, { id: product_packaging.product_id[0] })) {
|
if (self.product_by_id.find(({ id }) => id === product_packaging.product_id[0])) {
|
||||||
self.product_packaging_by_barcode[product_packaging.barcode] = product_packaging;
|
self.product_packaging_by_barcode[product_packaging.barcode] = product_packaging;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -1679,7 +1679,7 @@ export class Product extends PosModel {
|
|||||||
let price_extra = 0.0;
|
let price_extra = 0.0;
|
||||||
let draftPackLotLines, weight, description, packLotLinesToEdit;
|
let draftPackLotLines, weight, description, packLotLinesToEdit;
|
||||||
|
|
||||||
if (_.some(this.attribute_line_ids, (id) => id in this.pos.attributes_by_ptal_id)) {
|
if (this.attribute_line_ids.some((id) => id in this.pos.attributes_by_ptal_id)) {
|
||||||
const attributes = _.map(
|
const attributes = _.map(
|
||||||
this.attribute_line_ids,
|
this.attribute_line_ids,
|
||||||
(id) => this.pos.attributes_by_ptal_id[id]
|
(id) => this.pos.attributes_by_ptal_id[id]
|
||||||
@@ -1769,8 +1769,9 @@ export class Product extends PosModel {
|
|||||||
return { draftPackLotLines, quantity: weight, description, price_extra };
|
return { draftPackLotLines, quantity: weight, description, price_extra };
|
||||||
}
|
}
|
||||||
isPricelistItemUsable(item, date) {
|
isPricelistItemUsable(item, date) {
|
||||||
|
const categories = this.parent_category_ids.concat(this.categ.id);
|
||||||
return (
|
return (
|
||||||
(!item.categ_id || _.contains(this.parent_category_ids.concat(this.categ.id), item.categ_id[0])) &&
|
(!item.categ_id || categories.includes(item.categ_id[0])) &&
|
||||||
(!item.date_start || moment.utc(item.date_start).isSameOrBefore(date)) &&
|
(!item.date_start || moment.utc(item.date_start).isSameOrBefore(date)) &&
|
||||||
(!item.date_end || moment.utc(item.date_end).isSameOrAfter(date))
|
(!item.date_end || moment.utc(item.date_end).isSameOrAfter(date))
|
||||||
);
|
);
|
||||||
@@ -1824,13 +1825,13 @@ export class Product extends PosModel {
|
|||||||
if (price_extra) {
|
if (price_extra) {
|
||||||
price += price_extra;
|
price += price_extra;
|
||||||
}
|
}
|
||||||
_.find(pricelist_items, function (rule) {
|
pricelist_items.find(function (rule) {
|
||||||
if (rule.min_quantity && quantity < rule.min_quantity) {
|
if (rule.min_quantity && quantity < rule.min_quantity) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (rule.base === "pricelist") {
|
if (rule.base === "pricelist") {
|
||||||
const base_pricelist = _.find(self.pos.pricelists, function (pricelist) {
|
const base_pricelist = self.pos.pricelists.find(function (pricelist) {
|
||||||
return pricelist.id === rule.base_pricelist_id[0];
|
return pricelist.id === rule.base_pricelist_id[0];
|
||||||
});
|
});
|
||||||
if (base_pricelist) {
|
if (base_pricelist) {
|
||||||
@@ -1949,10 +1950,7 @@ export class Orderline extends PosModel {
|
|||||||
var pack_lot_lines = json.pack_lot_ids;
|
var pack_lot_lines = json.pack_lot_ids;
|
||||||
for (var i = 0; i < pack_lot_lines.length; i++) {
|
for (var i = 0; i < pack_lot_lines.length; i++) {
|
||||||
var packlotline = pack_lot_lines[i][2];
|
var packlotline = pack_lot_lines[i][2];
|
||||||
var pack_lot_line = new Packlotline(
|
var pack_lot_line = new Packlotline({}, { json: { ...packlotline, order_line: this } });
|
||||||
{},
|
|
||||||
{ json: _.extend({ ...packlotline }, { order_line: this }) }
|
|
||||||
);
|
|
||||||
this.pack_lot_lines.add(pack_lot_line);
|
this.pack_lot_lines.add(pack_lot_line);
|
||||||
}
|
}
|
||||||
this.tax_ids = json.tax_ids && json.tax_ids.length !== 0 ? json.tax_ids[0][2] : undefined;
|
this.tax_ids = json.tax_ids && json.tax_ids.length !== 0 ? json.tax_ids[0][2] : undefined;
|
||||||
@@ -2335,8 +2333,8 @@ export class Orderline extends PosModel {
|
|||||||
tax: this.get_tax(),
|
tax: this.get_tax(),
|
||||||
product_description: this.get_product().description,
|
product_description: this.get_product().description,
|
||||||
product_description_sale: this.get_product().description_sale,
|
product_description_sale: this.get_product().description_sale,
|
||||||
pack_lot_lines: this.get_lot_lines(),
|
pack_lot_lines: this.get_lot_lines(),
|
||||||
customer_note: this.get_customer_note(),
|
customer_note: this.get_customer_note(),
|
||||||
taxed_lst_unit_price: this.get_taxed_lst_unit_price(),
|
taxed_lst_unit_price: this.get_taxed_lst_unit_price(),
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
@@ -2425,26 +2423,27 @@ export class Orderline extends PosModel {
|
|||||||
return this.get_base_price();
|
return this.get_base_price();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
get_taxed_lst_unit_price(){
|
get_taxed_lst_unit_price() {
|
||||||
var lst_price = this.compute_fixed_price(this.get_lst_price());
|
var lst_price = this.compute_fixed_price(this.get_lst_price());
|
||||||
if (this.pos.config.iface_tax_included === 'total') {
|
if (this.pos.config.iface_tax_included === "total") {
|
||||||
var product = this.get_product();
|
var product = this.get_product();
|
||||||
var taxes_ids = product.taxes_id;
|
var taxes_ids = product.taxes_id;
|
||||||
var product_taxes = this.pos.get_taxes_after_fp(taxes_ids);
|
var product_taxes = this.pos.get_taxes_after_fp(taxes_ids);
|
||||||
return this.compute_all(product_taxes, lst_price, 1, this.pos.currency.rounding).total_included;
|
return this.compute_all(product_taxes, lst_price, 1, this.pos.currency.rounding)
|
||||||
|
.total_included;
|
||||||
}
|
}
|
||||||
return lst_price;
|
return lst_price;
|
||||||
}
|
}
|
||||||
get_price_without_tax(){
|
get_price_without_tax() {
|
||||||
return this.get_all_prices().priceWithoutTax;
|
return this.get_all_prices().priceWithoutTax;
|
||||||
}
|
}
|
||||||
get_price_with_tax(){
|
get_price_with_tax() {
|
||||||
return this.get_all_prices().priceWithTax;
|
return this.get_all_prices().priceWithTax;
|
||||||
}
|
}
|
||||||
get_price_with_tax_before_discount () {
|
get_price_with_tax_before_discount() {
|
||||||
return this.get_all_prices().priceWithTaxBeforeDiscount;
|
return this.get_all_prices().priceWithTaxBeforeDiscount;
|
||||||
}
|
}
|
||||||
get_tax(){
|
get_tax() {
|
||||||
return this.get_all_prices().tax;
|
return this.get_all_prices().tax;
|
||||||
}
|
}
|
||||||
get_applicable_taxes() {
|
get_applicable_taxes() {
|
||||||
@@ -2598,8 +2597,8 @@ export class Orderline extends PosModel {
|
|||||||
get_fixed_lst_price() {
|
get_fixed_lst_price() {
|
||||||
return this.compute_fixed_price(this.get_lst_price());
|
return this.compute_fixed_price(this.get_lst_price());
|
||||||
}
|
}
|
||||||
get_lst_price(){
|
get_lst_price() {
|
||||||
return this.product.get_price(this.pos.default_pricelist, 1, 0)
|
return this.product.get_price(this.pos.default_pricelist, 1, 0);
|
||||||
}
|
}
|
||||||
set_lst_price(price) {
|
set_lst_price(price) {
|
||||||
this.order.assert_editable();
|
this.order.assert_editable();
|
||||||
@@ -2842,7 +2841,7 @@ export class Order extends PosModel {
|
|||||||
this.uid = this.generate_unique_id();
|
this.uid = this.generate_unique_id();
|
||||||
this.name = _.str.sprintf(_t("Order %s"), this.uid);
|
this.name = _.str.sprintf(_t("Order %s"), this.uid);
|
||||||
this.validation_date = undefined;
|
this.validation_date = undefined;
|
||||||
this.fiscal_position = _.find(this.pos.fiscal_positions, function (fp) {
|
this.fiscal_position = this.pos.fiscal_positions.find(function (fp) {
|
||||||
return fp.id === self.pos.config.default_fiscal_position_id[0];
|
return fp.id === self.pos.config.default_fiscal_position_id[0];
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@@ -2884,7 +2883,7 @@ export class Order extends PosModel {
|
|||||||
this.firstDraft = false;
|
this.firstDraft = false;
|
||||||
|
|
||||||
if (json.fiscal_position_id) {
|
if (json.fiscal_position_id) {
|
||||||
var fiscal_position = _.find(this.pos.fiscal_positions, function (fp) {
|
var fiscal_position = this.pos.fiscal_positions.find(function (fp) {
|
||||||
return fp.id === json.fiscal_position_id;
|
return fp.id === json.fiscal_position_id;
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -2896,7 +2895,7 @@ export class Order extends PosModel {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (json.pricelist_id) {
|
if (json.pricelist_id) {
|
||||||
this.pricelist = _.find(this.pos.pricelists, function (pricelist) {
|
this.pricelist = this.pos.pricelists.find(function (pricelist) {
|
||||||
return pricelist.id === json.pricelist_id;
|
return pricelist.id === json.pricelist_id;
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
@@ -3325,7 +3324,7 @@ export class Order extends PosModel {
|
|||||||
this.select_orderline(this.get_last_orderline());
|
this.select_orderline(this.get_last_orderline());
|
||||||
}
|
}
|
||||||
|
|
||||||
isFirstDraft(){
|
isFirstDraft() {
|
||||||
return this.firstDraft;
|
return this.firstDraft;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -181,7 +181,7 @@ var PortalChatter = publicWidget.Widget.extend({
|
|||||||
params: this._messageFetchPrepareParams()
|
params: this._messageFetchPrepareParams()
|
||||||
}).then(function (result) {
|
}).then(function (result) {
|
||||||
self.result = result;
|
self.result = result;
|
||||||
self.options = _.extend(self.options, self.result['options'] || {});
|
self.options = Object.assign(self.options, self.result['options'] || {});
|
||||||
return result;
|
return result;
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -78,7 +78,7 @@ var PortalComposer = publicWidget.Widget.extend({
|
|||||||
_onAttachmentDeleteClick: function (ev) {
|
_onAttachmentDeleteClick: function (ev) {
|
||||||
var self = this;
|
var self = this;
|
||||||
var attachmentId = $(ev.currentTarget).closest('.o_portal_chatter_attachment').data('id');
|
var attachmentId = $(ev.currentTarget).closest('.o_portal_chatter_attachment').data('id');
|
||||||
var accessToken = _.find(this.attachments, {'id': attachmentId}).access_token;
|
var accessToken = this.attachments.find(attachment => attachment.id === attachmentId).access_token;
|
||||||
ev.preventDefault();
|
ev.preventDefault();
|
||||||
ev.stopPropagation();
|
ev.stopPropagation();
|
||||||
|
|
||||||
|
|||||||
@@ -111,7 +111,7 @@ var SignatureForm = publicWidget.Widget.extend({
|
|||||||
|
|
||||||
return this._rpc({
|
return this._rpc({
|
||||||
route: this.callUrl,
|
route: this.callUrl,
|
||||||
params: _.extend(this.rpcParams, {
|
params: Object.assign(this.rpcParams, {
|
||||||
'name': name,
|
'name': name,
|
||||||
'signature': signature,
|
'signature': signature,
|
||||||
}),
|
}),
|
||||||
|
|||||||
@@ -15,7 +15,7 @@ var qweb = core.qweb;
|
|||||||
* Extends Frontend Chatter to handle rating
|
* Extends Frontend Chatter to handle rating
|
||||||
*/
|
*/
|
||||||
PortalChatter.include({
|
PortalChatter.include({
|
||||||
events: _.extend({}, PortalChatter.prototype.events, {
|
events: Object.assign({}, PortalChatter.prototype.events, {
|
||||||
// star based control
|
// star based control
|
||||||
'click .o_website_rating_table_row': '_onClickStarDomain',
|
'click .o_website_rating_table_row': '_onClickStarDomain',
|
||||||
'click .o_website_rating_selection_reset': '_onClickStarDomainReset',
|
'click .o_website_rating_selection_reset': '_onClickStarDomainReset',
|
||||||
@@ -199,7 +199,7 @@ PortalChatter.include({
|
|||||||
ratingData.publisher_name = rawRating.publisher_id[1];
|
ratingData.publisher_name = rawRating.publisher_id[1];
|
||||||
ratingData.publisher_avatar = _.str.sprintf('/web/image/res.partner/%s/avatar_128/50x50', ratingData.publisher_id);
|
ratingData.publisher_avatar = _.str.sprintf('/web/image/res.partner/%s/avatar_128/50x50', ratingData.publisher_id);
|
||||||
}
|
}
|
||||||
var commentData = _.extend(this._newPublisherCommentData(messageIndex), ratingData);
|
var commentData = Object.assign(this._newPublisherCommentData(messageIndex), ratingData);
|
||||||
return commentData;
|
return commentData;
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|||||||
@@ -13,7 +13,7 @@ var PortalComposer = portalComposer.PortalComposer;
|
|||||||
* Extends Portal Composer to handle rating submission
|
* Extends Portal Composer to handle rating submission
|
||||||
*/
|
*/
|
||||||
PortalComposer.include({
|
PortalComposer.include({
|
||||||
events: _.extend({}, PortalComposer.prototype.events, {
|
events: Object.assign({}, PortalComposer.prototype.events, {
|
||||||
'click .stars i': '_onClickStar',
|
'click .stars i': '_onClickStar',
|
||||||
'mouseleave .stars': '_onMouseleaveStarBlock',
|
'mouseleave .stars': '_onMouseleaveStarBlock',
|
||||||
'mousemove .stars i': '_onMoveStar',
|
'mousemove .stars i': '_onMoveStar',
|
||||||
|
|||||||
@@ -114,7 +114,7 @@ const RatingPopupComposer = publicWidget.Widget.extend({
|
|||||||
delete data.rating_count;
|
delete data.rating_count;
|
||||||
delete data.rating_value;
|
delete data.rating_value;
|
||||||
|
|
||||||
this.options = _.extend(this.options, data);
|
this.options = Object.assign(this.options, data);
|
||||||
|
|
||||||
this._reloadRatingPopupComposer();
|
this._reloadRatingPopupComposer();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -102,7 +102,7 @@ export const PaymentAdyen = PaymentInterface.extend({
|
|||||||
var line = order.selected_paymentline;
|
var line = order.selected_paymentline;
|
||||||
var data = {
|
var data = {
|
||||||
SaleToPOIRequest: {
|
SaleToPOIRequest: {
|
||||||
MessageHeader: _.extend(this._adyen_common_message_header(), {
|
MessageHeader: Object.assign(this._adyen_common_message_header(), {
|
||||||
MessageCategory: "Payment",
|
MessageCategory: "Payment",
|
||||||
}),
|
}),
|
||||||
PaymentRequest: {
|
PaymentRequest: {
|
||||||
@@ -156,7 +156,7 @@ export const PaymentAdyen = PaymentInterface.extend({
|
|||||||
var self = this;
|
var self = this;
|
||||||
var config = this.pos.config;
|
var config = this.pos.config;
|
||||||
var previous_service_id = this.most_recent_service_id;
|
var previous_service_id = this.most_recent_service_id;
|
||||||
var header = _.extend(this._adyen_common_message_header(), {
|
var header = Object.assign(this._adyen_common_message_header(), {
|
||||||
MessageCategory: "Abort",
|
MessageCategory: "Abort",
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
@@ -425,7 +425,7 @@ patch(PaymentScreen.prototype, "pos_mercury.PaymentScreen", {
|
|||||||
transaction: def,
|
transaction: def,
|
||||||
});
|
});
|
||||||
|
|
||||||
var request_data = _.extend(
|
var request_data = Object.assign(
|
||||||
{
|
{
|
||||||
transaction_type: "Credit",
|
transaction_type: "Credit",
|
||||||
transaction_code: "VoidSaleByRecordNo",
|
transaction_code: "VoidSaleByRecordNo",
|
||||||
|
|||||||
@@ -102,7 +102,7 @@ patch(Payment.prototype, "pos_mercury.Payment", {
|
|||||||
this.set_credit_card_name();
|
this.set_credit_card_name();
|
||||||
},
|
},
|
||||||
export_as_JSON() {
|
export_as_JSON() {
|
||||||
return _.extend(this._super(...arguments), {
|
return Object.assign(this._super(...arguments), {
|
||||||
paid: this.paid,
|
paid: this.paid,
|
||||||
mercury_card_number: this.mercury_card_number,
|
mercury_card_number: this.mercury_card_number,
|
||||||
mercury_card_brand: this.mercury_card_brand,
|
mercury_card_brand: this.mercury_card_brand,
|
||||||
|
|||||||
@@ -29,7 +29,7 @@ export const PaymentSix = PaymentInterface.extend({
|
|||||||
this.enable_reversals();
|
this.enable_reversals();
|
||||||
|
|
||||||
var terminal_ip = this.payment_method.six_terminal_ip;
|
var terminal_ip = this.payment_method.six_terminal_ip;
|
||||||
var instanced_payment_method = _.find(this.pos.payment_methods, function (payment_method) {
|
var instanced_payment_method = this.pos.payment_methods.find(function (payment_method) {
|
||||||
return (
|
return (
|
||||||
payment_method.use_payment_terminal === "six" &&
|
payment_method.use_payment_terminal === "six" &&
|
||||||
payment_method.six_terminal_ip === terminal_ip &&
|
payment_method.six_terminal_ip === terminal_ip &&
|
||||||
|
|||||||
@@ -7,7 +7,7 @@ import ServicesMixin from 'web.ServicesMixin';
|
|||||||
import VariantMixin from 'sale.VariantMixin';
|
import VariantMixin from 'sale.VariantMixin';
|
||||||
|
|
||||||
export const OptionalProductsModal = Dialog.extend(ServicesMixin, VariantMixin, {
|
export const OptionalProductsModal = Dialog.extend(ServicesMixin, VariantMixin, {
|
||||||
events: _.extend({}, Dialog.prototype.events, VariantMixin.events, {
|
events: Object.assign({}, Dialog.prototype.events, VariantMixin.events, {
|
||||||
'click a.js_add, a.js_remove': '_onAddOrRemoveOption',
|
'click a.js_add, a.js_remove': '_onAddOrRemoveOption',
|
||||||
'click button.js_add_cart_json': 'onClickAddCartJSON',
|
'click button.js_add_cart_json': 'onClickAddCartJSON',
|
||||||
'change .in_cart input.js_quantity': '_onChangeQuantity',
|
'change .in_cart input.js_quantity': '_onChangeQuantity',
|
||||||
@@ -37,7 +37,7 @@ export const OptionalProductsModal = Dialog.extend(ServicesMixin, VariantMixin,
|
|||||||
init: function (parent, params) {
|
init: function (parent, params) {
|
||||||
var self = this;
|
var self = this;
|
||||||
|
|
||||||
var options = _.extend({
|
var options = Object.assign({
|
||||||
size: 'large',
|
size: 'large',
|
||||||
buttons: [{
|
buttons: [{
|
||||||
text: params.okButtonText,
|
text: params.okButtonText,
|
||||||
@@ -85,7 +85,7 @@ export const OptionalProductsModal = Dialog.extend(ServicesMixin, VariantMixin,
|
|||||||
force_dialog: self.forceDialog,
|
force_dialog: self.forceDialog,
|
||||||
no_attribute: self.rootProduct.no_variant_attribute_values,
|
no_attribute: self.rootProduct.no_variant_attribute_values,
|
||||||
custom_attribute: self.rootProduct.product_custom_attribute_values,
|
custom_attribute: self.rootProduct.product_custom_attribute_values,
|
||||||
context: _.extend({'quantity': self.rootProduct.quantity}, this.context),
|
context: Object.assign({'quantity': self.rootProduct.quantity}, this.context),
|
||||||
})
|
})
|
||||||
.then(function (modalContent) {
|
.then(function (modalContent) {
|
||||||
if (modalContent) {
|
if (modalContent) {
|
||||||
|
|||||||
@@ -125,7 +125,7 @@ function _genericJsonRpc (fct_name, params, settings, fct) {
|
|||||||
function jsonRpc(url, fct_name, params, settings) {
|
function jsonRpc(url, fct_name, params, settings) {
|
||||||
settings = settings || {};
|
settings = settings || {};
|
||||||
return _genericJsonRpc(fct_name, params, settings, function(data) {
|
return _genericJsonRpc(fct_name, params, settings, function(data) {
|
||||||
return $.ajax(url, _.extend({}, settings, {
|
return $.ajax(url, Object.assign({}, settings, {
|
||||||
url: url,
|
url: url,
|
||||||
dataType: 'json',
|
dataType: 'json',
|
||||||
type: 'POST',
|
type: 'POST',
|
||||||
@@ -275,7 +275,7 @@ var loadAsset = (function () {
|
|||||||
if (cache[xmlId]) {
|
if (cache[xmlId]) {
|
||||||
return cache[xmlId];
|
return cache[xmlId];
|
||||||
}
|
}
|
||||||
context = _.extend({}, session.user_context, context);
|
context = Object.assign({}, session.user_context, context);
|
||||||
const params = {
|
const params = {
|
||||||
args: [xmlId, {
|
args: [xmlId, {
|
||||||
debug: config.isDebug()
|
debug: config.isDebug()
|
||||||
@@ -316,7 +316,7 @@ var loadAsset = (function () {
|
|||||||
return load;
|
return load;
|
||||||
})();
|
})();
|
||||||
|
|
||||||
_.extend(ajax, {
|
Object.assign(ajax, {
|
||||||
jsonRpc: jsonRpc,
|
jsonRpc: jsonRpc,
|
||||||
rpc: rpc,
|
rpc: rpc,
|
||||||
loadAsset: loadAsset,
|
loadAsset: loadAsset,
|
||||||
|
|||||||
@@ -18,11 +18,11 @@ var _t = core._t;
|
|||||||
**/
|
**/
|
||||||
var Dialog = Widget.extend({
|
var Dialog = Widget.extend({
|
||||||
tagName: 'main',
|
tagName: 'main',
|
||||||
custom_events: _.extend({}, Widget.prototype.custom_events, {
|
custom_events: Object.assign({}, Widget.prototype.custom_events, {
|
||||||
focus_control_button: '_onFocusControlButton',
|
focus_control_button: '_onFocusControlButton',
|
||||||
close_dialog: '_onCloseDialog',
|
close_dialog: '_onCloseDialog',
|
||||||
}),
|
}),
|
||||||
events: _.extend({}, Widget.prototype.events, {
|
events: Object.assign({}, Widget.prototype.events, {
|
||||||
'keydown .modal-footer button': '_onFooterButtonKeyDown',
|
'keydown .modal-footer button': '_onFooterButtonKeyDown',
|
||||||
}),
|
}),
|
||||||
/**
|
/**
|
||||||
@@ -411,7 +411,7 @@ Dialog.alert = function (owner, message, options) {
|
|||||||
close: true,
|
close: true,
|
||||||
click: options && options.confirm_callback,
|
click: options && options.confirm_callback,
|
||||||
}];
|
}];
|
||||||
return new Dialog(owner, _.extend({
|
return new Dialog(owner, Object.assign({
|
||||||
size: 'medium',
|
size: 'medium',
|
||||||
buttons: buttons,
|
buttons: buttons,
|
||||||
$content: $('<main/>', {
|
$content: $('<main/>', {
|
||||||
@@ -464,7 +464,7 @@ Dialog.confirm = function (owner, message, options) {
|
|||||||
click: makeCallback('cancel_callback'),
|
click: makeCallback('cancel_callback'),
|
||||||
}
|
}
|
||||||
];
|
];
|
||||||
return new Dialog(owner, _.extend({
|
return new Dialog(owner, Object.assign({
|
||||||
size: 'medium',
|
size: 'medium',
|
||||||
buttons: buttons,
|
buttons: buttons,
|
||||||
$content: $('<main/>', {
|
$content: $('<main/>', {
|
||||||
@@ -518,7 +518,7 @@ Dialog.safeConfirm = function (owner, message, options) {
|
|||||||
click: options && options.cancel_callback
|
click: options && options.cancel_callback
|
||||||
}
|
}
|
||||||
];
|
];
|
||||||
var dialog = new Dialog(owner, _.extend({
|
var dialog = new Dialog(owner, Object.assign({
|
||||||
size: 'medium',
|
size: 'medium',
|
||||||
buttons: buttons,
|
buttons: buttons,
|
||||||
$content: $content,
|
$content: $content,
|
||||||
|
|||||||
@@ -406,7 +406,7 @@ var dom = {
|
|||||||
* @returns {jQuery}
|
* @returns {jQuery}
|
||||||
*/
|
*/
|
||||||
renderButton: function (options) {
|
renderButton: function (options) {
|
||||||
var jQueryParams = _.extend({
|
var jQueryParams = Object.assign({
|
||||||
type: 'button',
|
type: 'button',
|
||||||
}, options.attrs || {});
|
}, options.attrs || {});
|
||||||
|
|
||||||
|
|||||||
@@ -140,13 +140,9 @@ var Domain = collections.Tree.extend({
|
|||||||
} else { // The domain is a set of [name, operator, value] entitie(s)
|
} else { // The domain is a set of [name, operator, value] entitie(s)
|
||||||
switch (this._data) {
|
switch (this._data) {
|
||||||
case "&":
|
case "&":
|
||||||
return _.every(this._children, function (child) {
|
return this._children.every(child => child.compute(values));
|
||||||
return child.compute(values);
|
|
||||||
});
|
|
||||||
case "|":
|
case "|":
|
||||||
return _.some(this._children, function (child) {
|
return this._children.some(child => child.compute(values));
|
||||||
return child.compute(values);
|
|
||||||
});
|
|
||||||
case "!":
|
case "!":
|
||||||
return !this._children[0].compute(values);
|
return !this._children[0].compute(values);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -20,7 +20,7 @@ try {
|
|||||||
* it's not up to them to handle these cases.
|
* it's not up to them to handle these cases.
|
||||||
*/
|
*/
|
||||||
storage = (function () {
|
storage = (function () {
|
||||||
var storage = Object.create(_.extend({
|
var storage = Object.create(Object.assign({
|
||||||
getItem: localStorage.getItem.bind(localStorage),
|
getItem: localStorage.getItem.bind(localStorage),
|
||||||
setItem: localStorage.setItem.bind(localStorage),
|
setItem: localStorage.setItem.bind(localStorage),
|
||||||
removeItem: localStorage.removeItem.bind(localStorage),
|
removeItem: localStorage.removeItem.bind(localStorage),
|
||||||
|
|||||||
@@ -119,7 +119,7 @@ function OdooEvent(target, name, data) {
|
|||||||
this.target = target;
|
this.target = target;
|
||||||
this.name = name;
|
this.name = name;
|
||||||
this.data = Object.create(null);
|
this.data = Object.create(null);
|
||||||
_.extend(this.data, data);
|
Object.assign(this.data, data);
|
||||||
this.stopped = false;
|
this.stopped = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -238,7 +238,7 @@ var Events = Class.extend({
|
|||||||
* @name EventDispatcherMixin
|
* @name EventDispatcherMixin
|
||||||
* @mixin
|
* @mixin
|
||||||
*/
|
*/
|
||||||
var EventDispatcherMixin = _.extend({}, ParentedMixin, {
|
var EventDispatcherMixin = Object.assign({}, ParentedMixin, {
|
||||||
__eventDispatcherMixin: true,
|
__eventDispatcherMixin: true,
|
||||||
custom_events: {},
|
custom_events: {},
|
||||||
init: function () {
|
init: function () {
|
||||||
@@ -358,7 +358,7 @@ var EventDispatcherMixin = _.extend({}, ParentedMixin, {
|
|||||||
* @name PropertiesMixin
|
* @name PropertiesMixin
|
||||||
* @mixin
|
* @mixin
|
||||||
*/
|
*/
|
||||||
var PropertiesMixin = _.extend({}, EventDispatcherMixin, {
|
var PropertiesMixin = Object.assign({}, EventDispatcherMixin, {
|
||||||
init: function () {
|
init: function () {
|
||||||
EventDispatcherMixin.init.call(this);
|
EventDispatcherMixin.init.call(this);
|
||||||
this.__getterSetterInternalMap = {};
|
this.__getterSetterInternalMap = {};
|
||||||
|
|||||||
@@ -183,7 +183,7 @@ var Factory = Class.extend({
|
|||||||
var renderer = self.getRenderer(parent, state);
|
var renderer = self.getRenderer(parent, state);
|
||||||
var Controller = self.Controller || self.config.Controller;
|
var Controller = self.Controller || self.config.Controller;
|
||||||
const initialState = model.get(handle);
|
const initialState = model.get(handle);
|
||||||
var controllerParams = _.extend({
|
var controllerParams = Object.assign({
|
||||||
initialState,
|
initialState,
|
||||||
handle,
|
handle,
|
||||||
}, self.controllerParams);
|
}, self.controllerParams);
|
||||||
|
|||||||
@@ -105,7 +105,7 @@ function wrap_context(context) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function eval_contexts(contexts, evaluation_context) {
|
function eval_contexts(contexts, evaluation_context) {
|
||||||
evaluation_context = _.extend(pycontext(), evaluation_context || {});
|
evaluation_context = Object.assign(pycontext(), evaluation_context || {});
|
||||||
return _(contexts).reduce(function (result_context, ctx) {
|
return _(contexts).reduce(function (result_context, ctx) {
|
||||||
// __eval_context evaluations can lead to some of `contexts`'s
|
// __eval_context evaluations can lead to some of `contexts`'s
|
||||||
// values being null, skip them as well as empty contexts
|
// values being null, skip them as well as empty contexts
|
||||||
@@ -123,18 +123,18 @@ function eval_contexts(contexts, evaluation_context) {
|
|||||||
case 'compound_context':
|
case 'compound_context':
|
||||||
var eval_context = eval_contexts([ctx.__eval_context]);
|
var eval_context = eval_contexts([ctx.__eval_context]);
|
||||||
evaluated = eval_contexts(
|
evaluated = eval_contexts(
|
||||||
ctx.__contexts, _.extend({}, evaluation_context, eval_context));
|
ctx.__contexts, Object.assign({}, evaluation_context, eval_context));
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
// add newly evaluated context to evaluation context for following
|
// add newly evaluated context to evaluation context for following
|
||||||
// siblings
|
// siblings
|
||||||
_.extend(evaluation_context, evaluated);
|
Object.assign(evaluation_context, evaluated);
|
||||||
return _.extend(result_context, evaluated);
|
return Object.assign(result_context, evaluated);
|
||||||
}, {});
|
}, {});
|
||||||
}
|
}
|
||||||
|
|
||||||
function eval_domains(domains, evaluation_context) {
|
function eval_domains(domains, evaluation_context) {
|
||||||
evaluation_context = _.extend(pycontext(), evaluation_context || {});
|
evaluation_context = Object.assign(pycontext(), evaluation_context || {});
|
||||||
var result_domain = [];
|
var result_domain = [];
|
||||||
// Normalize only if the first domain is the array ["|"] or ["!"]
|
// Normalize only if the first domain is the array ["|"] or ["!"]
|
||||||
var need_normalization = (
|
var need_normalization = (
|
||||||
@@ -187,7 +187,7 @@ function get_normalized_domain(domain_array) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function eval_groupbys(contexts, evaluation_context) {
|
function eval_groupbys(contexts, evaluation_context) {
|
||||||
evaluation_context = _.extend(pycontext(), evaluation_context || {});
|
evaluation_context = Object.assign(pycontext(), evaluation_context || {});
|
||||||
var result_group = [];
|
var result_group = [];
|
||||||
_(contexts).each(function (ctx) {
|
_(contexts).each(function (ctx) {
|
||||||
if (_.isString(ctx)) {
|
if (_.isString(ctx)) {
|
||||||
@@ -204,7 +204,7 @@ function eval_groupbys(contexts, evaluation_context) {
|
|||||||
case 'compound_context':
|
case 'compound_context':
|
||||||
var eval_context = eval_contexts([ctx.__eval_context]);
|
var eval_context = eval_contexts([ctx.__eval_context]);
|
||||||
evaluated = eval_contexts(
|
evaluated = eval_contexts(
|
||||||
ctx.__contexts, _.extend({}, evaluation_context, eval_context));
|
ctx.__contexts, Object.assign({}, evaluation_context, eval_context));
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
group = evaluated.group_by;
|
group = evaluated.group_by;
|
||||||
@@ -217,7 +217,7 @@ function eval_groupbys(contexts, evaluation_context) {
|
|||||||
throw new Error('Got invalid groupby {{'
|
throw new Error('Got invalid groupby {{'
|
||||||
+ JSON.stringify(group) + '}}');
|
+ JSON.stringify(group) + '}}');
|
||||||
}
|
}
|
||||||
_.extend(evaluation_context, evaluated);
|
Object.assign(evaluation_context, evaluated);
|
||||||
});
|
});
|
||||||
return result_group;
|
return result_group;
|
||||||
}
|
}
|
||||||
@@ -285,7 +285,7 @@ function pycontext() {
|
|||||||
* @param {Object} [context] evaluation context
|
* @param {Object} [context] evaluation context
|
||||||
*/
|
*/
|
||||||
function pyeval(type, object, context) {
|
function pyeval(type, object, context) {
|
||||||
context = _.extend(pycontext(), context || {});
|
context = Object.assign(pycontext(), context || {});
|
||||||
|
|
||||||
//noinspection FallthroughInSwitchStatementJS
|
//noinspection FallthroughInSwitchStatementJS
|
||||||
switch(type) {
|
switch(type) {
|
||||||
@@ -347,7 +347,7 @@ function eval_domains_and_contexts(source) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function py_eval(expr, context) {
|
function py_eval(expr, context) {
|
||||||
return py.eval(expr, _.extend({}, context || {}, {"true": true, "false": false, "null": null}));
|
return py.eval(expr, Object.assign({}, context || {}, {"true": true, "false": false, "null": null}));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -17,7 +17,7 @@ function QWeb(debug, default_dict, enableTranslation) {
|
|||||||
enableTranslation = true;
|
enableTranslation = true;
|
||||||
}
|
}
|
||||||
var qweb = new QWeb2.Engine();
|
var qweb = new QWeb2.Engine();
|
||||||
qweb.default_dict = _.extend({}, default_dict || {}, {
|
qweb.default_dict = Object.assign({}, default_dict || {}, {
|
||||||
'_' : _,
|
'_' : _,
|
||||||
'JSON': JSON,
|
'JSON': JSON,
|
||||||
'_t' : translation._t,
|
'_t' : translation._t,
|
||||||
|
|||||||
@@ -46,7 +46,7 @@ const rpc = {
|
|||||||
params.args = options.args || [];
|
params.args = options.args || [];
|
||||||
params.model = options.model;
|
params.model = options.model;
|
||||||
params.method = options.method;
|
params.method = options.method;
|
||||||
params.kwargs = _.extend(params.kwargs || {}, options.kwargs);
|
params.kwargs = Object.assign(params.kwargs || {}, options.kwargs);
|
||||||
params.kwargs.context = options.context || params.context || params.kwargs.context;
|
params.kwargs.context = options.context || params.context || params.kwargs.context;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -124,7 +124,7 @@ var Session = core.Class.extend(mixins.EventDispatcherMixin, {
|
|||||||
if (!result.uid) {
|
if (!result.uid) {
|
||||||
return Promise.reject();
|
return Promise.reject();
|
||||||
}
|
}
|
||||||
_.extend(self, result);
|
Object.assign(self, result);
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
session_logout: function () {
|
session_logout: function () {
|
||||||
@@ -228,8 +228,8 @@ var Session = core.Class.extend(mixins.EventDispatcherMixin, {
|
|||||||
* @returns {Promise} promise indicating the session is done reloading
|
* @returns {Promise} promise indicating the session is done reloading
|
||||||
*/
|
*/
|
||||||
session_reload: function () {
|
session_reload: function () {
|
||||||
var result = _.extend({}, session);
|
var result = Object.assign({}, session);
|
||||||
_.extend(this, result);
|
Object.assign(this, result);
|
||||||
return Promise.resolve();
|
return Promise.resolve();
|
||||||
},
|
},
|
||||||
/**
|
/**
|
||||||
@@ -247,17 +247,17 @@ var Session = core.Class.extend(mixins.EventDispatcherMixin, {
|
|||||||
rpc: function (url, params, options) {
|
rpc: function (url, params, options) {
|
||||||
var self = this;
|
var self = this;
|
||||||
options = _.clone(options || {});
|
options = _.clone(options || {});
|
||||||
options.headers = _.extend({}, options.headers);
|
options.headers = Object.assign({}, options.headers);
|
||||||
|
|
||||||
// we add here the user context for ALL queries, mainly to pass
|
// we add here the user context for ALL queries, mainly to pass
|
||||||
// the allowed_company_ids key
|
// the allowed_company_ids key
|
||||||
if (params && params.kwargs) {
|
if (params && params.kwargs) {
|
||||||
params.kwargs.context = _.extend(params.kwargs.context || {}, this.user_context);
|
params.kwargs.context = Object.assign(params.kwargs.context || {}, this.user_context);
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO: remove
|
// TODO: remove
|
||||||
if (! _.isString(url)) {
|
if (! _.isString(url)) {
|
||||||
_.extend(options, url);
|
Object.assign(options, url);
|
||||||
url = url.url;
|
url = url.url;
|
||||||
}
|
}
|
||||||
if (self.use_cors) {
|
if (self.use_cors) {
|
||||||
@@ -267,7 +267,7 @@ var Session = core.Class.extend(mixins.EventDispatcherMixin, {
|
|||||||
return ajax.jsonRpc(url, "call", params, options);
|
return ajax.jsonRpc(url, "call", params, options);
|
||||||
},
|
},
|
||||||
url: function (path, params) {
|
url: function (path, params) {
|
||||||
params = _.extend(params || {});
|
params = Object.assign(params || {});
|
||||||
var qs = $.param(params);
|
var qs = $.param(params);
|
||||||
if (qs.length > 0)
|
if (qs.length > 0)
|
||||||
qs = "?" + qs;
|
qs = "?" + qs;
|
||||||
|
|||||||
@@ -20,7 +20,7 @@ try {
|
|||||||
* it's not up to them to handle these cases.
|
* it's not up to them to handle these cases.
|
||||||
*/
|
*/
|
||||||
storage = (function () {
|
storage = (function () {
|
||||||
var storage = Object.create(_.extend({
|
var storage = Object.create(Object.assign({
|
||||||
getItem: sessionStorage.getItem.bind(sessionStorage),
|
getItem: sessionStorage.getItem.bind(sessionStorage),
|
||||||
setItem: sessionStorage.setItem.bind(sessionStorage),
|
setItem: sessionStorage.setItem.bind(sessionStorage),
|
||||||
removeItem: sessionStorage.removeItem.bind(sessionStorage),
|
removeItem: sessionStorage.removeItem.bind(sessionStorage),
|
||||||
|
|||||||
@@ -364,7 +364,7 @@ var Widget = core.Class.extend(mixins.PropertiesMixin, ServicesMixin, {
|
|||||||
* @return {jQuery}
|
* @return {jQuery}
|
||||||
*/
|
*/
|
||||||
_makeDescriptive: function () {
|
_makeDescriptive: function () {
|
||||||
var attrs = _.extend({}, this.attributes || {});
|
var attrs = Object.assign({}, this.attributes || {});
|
||||||
if (this.id) {
|
if (this.id) {
|
||||||
attrs.id = this.id;
|
attrs.id = this.id;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -432,7 +432,7 @@ var AbstractField = Widget.extend({
|
|||||||
if (!formatType) {
|
if (!formatType) {
|
||||||
throw new Error(`Missing format type for '${this.name}' value from the '${this.model}' model`);
|
throw new Error(`Missing format type for '${this.name}' value from the '${this.model}' model`);
|
||||||
}
|
}
|
||||||
var options = _.extend({}, this.nodeOptions, { data: this.recordData }, this.formatOptions);
|
var options = Object.assign({}, this.nodeOptions, { data: this.recordData }, this.formatOptions);
|
||||||
return field_utils.format[formatType](value, this.field, options);
|
return field_utils.format[formatType](value, this.field, options);
|
||||||
},
|
},
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -60,7 +60,7 @@ var TranslatableFieldMixin = {
|
|||||||
var FieldBoolean = AbstractField.extend({
|
var FieldBoolean = AbstractField.extend({
|
||||||
className: 'o_field_boolean',
|
className: 'o_field_boolean',
|
||||||
description: _lt("Checkbox"),
|
description: _lt("Checkbox"),
|
||||||
events: _.extend({}, AbstractField.prototype.events, {
|
events: Object.assign({}, AbstractField.prototype.events, {
|
||||||
change: '_onChange',
|
change: '_onChange',
|
||||||
}),
|
}),
|
||||||
supportedFieldTypes: ['boolean'],
|
supportedFieldTypes: ['boolean'],
|
||||||
@@ -308,10 +308,10 @@ var DebouncedField = AbstractField.extend({
|
|||||||
});
|
});
|
||||||
|
|
||||||
var InputField = DebouncedField.extend({
|
var InputField = DebouncedField.extend({
|
||||||
custom_events: _.extend({}, DebouncedField.prototype.custom_events, {
|
custom_events: Object.assign({}, DebouncedField.prototype.custom_events, {
|
||||||
field_changed: '_onFieldChanged',
|
field_changed: '_onFieldChanged',
|
||||||
}),
|
}),
|
||||||
events: _.extend({}, DebouncedField.prototype.events, {
|
events: Object.assign({}, DebouncedField.prototype.events, {
|
||||||
'input': '_onInput',
|
'input': '_onInput',
|
||||||
'change': '_onChange',
|
'change': '_onChange',
|
||||||
'blur' : '_onBlur',
|
'blur' : '_onBlur',
|
||||||
@@ -417,10 +417,10 @@ var InputField = DebouncedField.extend({
|
|||||||
var inputAttrs = { placeholder: this.attrs.placeholder || "" };
|
var inputAttrs = { placeholder: this.attrs.placeholder || "" };
|
||||||
var inputVal;
|
var inputVal;
|
||||||
if (this.nodeOptions.isPassword) {
|
if (this.nodeOptions.isPassword) {
|
||||||
inputAttrs = _.extend(inputAttrs, { type: 'password', autocomplete: this.attrs.autocomplete || 'new-password' });
|
inputAttrs = Object.assign(inputAttrs, { type: 'password', autocomplete: this.attrs.autocomplete || 'new-password' });
|
||||||
inputVal = this.value || '';
|
inputVal = this.value || '';
|
||||||
} else {
|
} else {
|
||||||
inputAttrs = _.extend(inputAttrs, { type: 'text', autocomplete: this.attrs.autocomplete || 'off'});
|
inputAttrs = Object.assign(inputAttrs, { type: 'text', autocomplete: this.attrs.autocomplete || 'off'});
|
||||||
inputVal = this._formatValue(this.value);
|
inputVal = this._formatValue(this.value);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1427,7 +1427,7 @@ var FieldText = InputField.extend(TranslatableFieldMixin, {
|
|||||||
var UrlWidget = InputField.extend({
|
var UrlWidget = InputField.extend({
|
||||||
description: _lt("URL"),
|
description: _lt("URL"),
|
||||||
className: 'o_field_url',
|
className: 'o_field_url',
|
||||||
events: _.extend({}, InputField.prototype.events, {
|
events: Object.assign({}, InputField.prototype.events, {
|
||||||
'click': '_onClick',
|
'click': '_onClick',
|
||||||
}),
|
}),
|
||||||
supportedFieldTypes: ['char'],
|
supportedFieldTypes: ['char'],
|
||||||
@@ -1503,7 +1503,7 @@ var UrlWidget = InputField.extend({
|
|||||||
});
|
});
|
||||||
|
|
||||||
var AbstractFieldBinary = AbstractField.extend({
|
var AbstractFieldBinary = AbstractField.extend({
|
||||||
events: _.extend({}, AbstractField.prototype.events, {
|
events: Object.assign({}, AbstractField.prototype.events, {
|
||||||
'change .o_input_file': 'on_file_change',
|
'change .o_input_file': 'on_file_change',
|
||||||
'click .o_select_file_button': function () {
|
'click .o_select_file_button': function () {
|
||||||
this.$('.o_input_file').click();
|
this.$('.o_input_file').click();
|
||||||
@@ -1627,7 +1627,7 @@ var AbstractFieldBinary = AbstractField.extend({
|
|||||||
var FieldBinaryFile = AbstractFieldBinary.extend({
|
var FieldBinaryFile = AbstractFieldBinary.extend({
|
||||||
description: _lt("File"),
|
description: _lt("File"),
|
||||||
template: 'FieldBinaryFile',
|
template: 'FieldBinaryFile',
|
||||||
events: _.extend({}, AbstractFieldBinary.prototype.events, {
|
events: Object.assign({}, AbstractFieldBinary.prototype.events, {
|
||||||
'click': function (event) {
|
'click': function (event) {
|
||||||
if (this.mode === 'readonly' && this.value && this.recordData.id) {
|
if (this.mode === 'readonly' && this.value && this.recordData.id) {
|
||||||
this.on_save_as(event);
|
this.on_save_as(event);
|
||||||
|
|||||||
@@ -360,7 +360,7 @@ function formatMonetary(value, field, options) {
|
|||||||
digits = field.digits || digits;
|
digits = field.digits || digits;
|
||||||
}
|
}
|
||||||
var formatted_value = formatFloat(value, field,
|
var formatted_value = formatFloat(value, field,
|
||||||
_.extend({}, options , {digits: digits})
|
Object.assign({}, options , {digits: digits})
|
||||||
);
|
);
|
||||||
|
|
||||||
if (!currency || options.noSymbol) {
|
if (!currency || options.noSymbol) {
|
||||||
@@ -402,9 +402,7 @@ function formatPercentage(value, field, options) {
|
|||||||
* @param {boolean} [options.escape=false] if true, escapes the formatted value
|
* @param {boolean} [options.escape=false] if true, escapes the formatted value
|
||||||
*/
|
*/
|
||||||
function formatSelection(value, field, options) {
|
function formatSelection(value, field, options) {
|
||||||
var val = _.find(field.selection, function (option) {
|
var val = field.selection.find(option => option[0] === value);
|
||||||
return option[0] === value;
|
|
||||||
});
|
|
||||||
if (!val) {
|
if (!val) {
|
||||||
return '';
|
return '';
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -75,12 +75,12 @@ var FieldMany2One = AbstractField.extend({
|
|||||||
description: _lt("Many2one"),
|
description: _lt("Many2one"),
|
||||||
supportedFieldTypes: ['many2one'],
|
supportedFieldTypes: ['many2one'],
|
||||||
template: 'FieldMany2One',
|
template: 'FieldMany2One',
|
||||||
custom_events: _.extend({}, AbstractField.prototype.custom_events, {
|
custom_events: Object.assign({}, AbstractField.prototype.custom_events, {
|
||||||
'closed_unset': '_onDialogClosedUnset',
|
'closed_unset': '_onDialogClosedUnset',
|
||||||
'field_changed': '_onFieldChanged',
|
'field_changed': '_onFieldChanged',
|
||||||
'quick_create': '_onQuickCreate',
|
'quick_create': '_onQuickCreate',
|
||||||
}),
|
}),
|
||||||
events: _.extend({}, AbstractField.prototype.events, {
|
events: Object.assign({}, AbstractField.prototype.events, {
|
||||||
'click input': '_onInputClick',
|
'click input': '_onInputClick',
|
||||||
'click': '_onLinkClick',
|
'click': '_onLinkClick',
|
||||||
'focusout input': '_onInputFocusout',
|
'focusout input': '_onInputFocusout',
|
||||||
@@ -421,7 +421,7 @@ var FieldMany2One = AbstractField.extend({
|
|||||||
return {
|
return {
|
||||||
resModel: this.field.relation,
|
resModel: this.field.relation,
|
||||||
domain: this.record.getDomain({fieldName: this.name}),
|
domain: this.record.getDomain({fieldName: this.name}),
|
||||||
context: _.extend({}, this.record.getContext(this.recordParams), context || {}),
|
context: Object.assign({}, this.record.getContext(this.recordParams), context || {}),
|
||||||
dynamicFilters: dynamicFilters || [],
|
dynamicFilters: dynamicFilters || [],
|
||||||
title: _.str.sprintf((view === 'search' ? _t("Search: %s") : _t("Create: %s")), this.string),
|
title: _.str.sprintf((view === 'search' ? _t("Search: %s") : _t("Create: %s")), this.string),
|
||||||
multiSelect: false,
|
multiSelect: false,
|
||||||
@@ -973,10 +973,10 @@ var FieldMany2ManyTags = AbstractField.extend({
|
|||||||
tag_template: "FieldMany2ManyTag",
|
tag_template: "FieldMany2ManyTag",
|
||||||
className: "o_field_many2manytags",
|
className: "o_field_many2manytags",
|
||||||
supportedFieldTypes: ['many2many'],
|
supportedFieldTypes: ['many2many'],
|
||||||
custom_events: _.extend({}, AbstractField.prototype.custom_events, {
|
custom_events: Object.assign({}, AbstractField.prototype.custom_events, {
|
||||||
field_changed: '_onFieldChanged',
|
field_changed: '_onFieldChanged',
|
||||||
}),
|
}),
|
||||||
events: _.extend({}, AbstractField.prototype.events, {
|
events: Object.assign({}, AbstractField.prototype.events, {
|
||||||
'click .o_delete': '_onDeleteTag',
|
'click .o_delete': '_onDeleteTag',
|
||||||
}),
|
}),
|
||||||
relatedFields: {
|
relatedFields: {
|
||||||
@@ -1125,7 +1125,7 @@ var FieldMany2ManyTags = AbstractField.extend({
|
|||||||
var options = _getSearchCreatePopupOptions.apply(this, arguments);
|
var options = _getSearchCreatePopupOptions.apply(this, arguments);
|
||||||
var domain = this.record.getDomain({fieldName: this.name});
|
var domain = this.record.getDomain({fieldName: this.name});
|
||||||
var m2mRecords = [];
|
var m2mRecords = [];
|
||||||
return _.extend({}, options, {
|
return Object.assign({}, options, {
|
||||||
domain: domain.concat(["!", ["id", "in", self.value.res_ids]]),
|
domain: domain.concat(["!", ["id", "in", self.value.res_ids]]),
|
||||||
multiSelect: true,
|
multiSelect: true,
|
||||||
onSelected: function (recordIds) {
|
onSelected: function (recordIds) {
|
||||||
@@ -1293,7 +1293,7 @@ const ListMany2ManyTagsAvatar = FieldMany2ManyTagsAvatar.extend(M2MAvatarMixin,
|
|||||||
});
|
});
|
||||||
|
|
||||||
var FormFieldMany2ManyTags = FieldMany2ManyTags.extend({
|
var FormFieldMany2ManyTags = FieldMany2ManyTags.extend({
|
||||||
events: _.extend({}, FieldMany2ManyTags.prototype.events, {
|
events: Object.assign({}, FieldMany2ManyTags.prototype.events, {
|
||||||
'click .dropdown-toggle': '_onOpenColorPicker',
|
'click .dropdown-toggle': '_onOpenColorPicker',
|
||||||
'mousedown .o_colorpicker a': '_onUpdateColor',
|
'mousedown .o_colorpicker a': '_onUpdateColor',
|
||||||
'mousedown .o_colorpicker .o_hide_in_kanban': '_onUpdateColor',
|
'mousedown .o_colorpicker .o_hide_in_kanban': '_onUpdateColor',
|
||||||
@@ -1413,7 +1413,7 @@ var FieldSelection = AbstractField.extend({
|
|||||||
template: 'web.Legacy.FieldSelection',
|
template: 'web.Legacy.FieldSelection',
|
||||||
specialData: "_fetchSpecialRelation",
|
specialData: "_fetchSpecialRelation",
|
||||||
supportedFieldTypes: ['selection'],
|
supportedFieldTypes: ['selection'],
|
||||||
events: _.extend({}, AbstractField.prototype.events, {
|
events: Object.assign({}, AbstractField.prototype.events, {
|
||||||
'change': '_onChange',
|
'change': '_onChange',
|
||||||
}),
|
}),
|
||||||
isQuickEditable: true,
|
isQuickEditable: true,
|
||||||
@@ -1532,9 +1532,7 @@ var FieldSelection = AbstractField.extend({
|
|||||||
_onChange: function () {
|
_onChange: function () {
|
||||||
var res_id = JSON.parse(this.$el.val());
|
var res_id = JSON.parse(this.$el.val());
|
||||||
if (this.field.type === 'many2one') {
|
if (this.field.type === 'many2one') {
|
||||||
var value = _.find(this.values, function (val) {
|
var value = this.values.find(val => val[0] === res_id);
|
||||||
return val[0] === res_id;
|
|
||||||
});
|
|
||||||
this._setValue({id: res_id, display_name: value[1]});
|
this._setValue({id: res_id, display_name: value[1]});
|
||||||
} else {
|
} else {
|
||||||
this._setValue(res_id);
|
this._setValue(res_id);
|
||||||
@@ -1549,7 +1547,7 @@ var FieldRadio = FieldSelection.extend({
|
|||||||
tagName: 'div',
|
tagName: 'div',
|
||||||
specialData: "_fetchSpecialMany2ones",
|
specialData: "_fetchSpecialMany2ones",
|
||||||
supportedFieldTypes: ['selection', 'many2one'],
|
supportedFieldTypes: ['selection', 'many2one'],
|
||||||
events: _.extend({}, AbstractField.prototype.events, {
|
events: Object.assign({}, AbstractField.prototype.events, {
|
||||||
'click input': '_onInputClick',
|
'click input': '_onInputClick',
|
||||||
}),
|
}),
|
||||||
isQuickEditable: true,
|
isQuickEditable: true,
|
||||||
|
|||||||
@@ -48,11 +48,11 @@ var localeDef = lang !== 'en_US' ? loadJS('/web/webclient/locale/' + lang.replac
|
|||||||
* children and handle them.
|
* children and handle them.
|
||||||
*/
|
*/
|
||||||
export const PublicRoot = publicWidget.RootWidget.extend({
|
export const PublicRoot = publicWidget.RootWidget.extend({
|
||||||
events: _.extend({}, publicWidget.RootWidget.prototype.events || {}, {
|
events: Object.assign({}, publicWidget.RootWidget.prototype.events || {}, {
|
||||||
'submit .js_website_submit_form': '_onWebsiteFormSubmit',
|
'submit .js_website_submit_form': '_onWebsiteFormSubmit',
|
||||||
'click .js_disable_on_click': '_onDisableOnClick',
|
'click .js_disable_on_click': '_onDisableOnClick',
|
||||||
}),
|
}),
|
||||||
custom_events: _.extend({}, publicWidget.RootWidget.prototype.custom_events || {}, {
|
custom_events: Object.assign({}, publicWidget.RootWidget.prototype.custom_events || {}, {
|
||||||
call_service: '_onCallService',
|
call_service: '_onCallService',
|
||||||
context_get: '_onContextGet',
|
context_get: '_onContextGet',
|
||||||
main_object_request: '_onMainObjectRequest',
|
main_object_request: '_onMainObjectRequest',
|
||||||
@@ -124,7 +124,7 @@ export const PublicRoot = publicWidget.RootWidget.extend({
|
|||||||
* @returns {Object}
|
* @returns {Object}
|
||||||
*/
|
*/
|
||||||
_getContext: function (context) {
|
_getContext: function (context) {
|
||||||
return _.extend({
|
return Object.assign({
|
||||||
'lang': getLang(),
|
'lang': getLang(),
|
||||||
}, context || {});
|
}, context || {});
|
||||||
},
|
},
|
||||||
@@ -237,7 +237,7 @@ export const PublicRoot = publicWidget.RootWidget.extend({
|
|||||||
*/
|
*/
|
||||||
_onCallService: function (ev) {
|
_onCallService: function (ev) {
|
||||||
function _computeContext(context, noContextKeys) {
|
function _computeContext(context, noContextKeys) {
|
||||||
context = _.extend({}, this._getContext(), context);
|
context = Object.assign({}, this._getContext(), context);
|
||||||
if (noContextKeys) {
|
if (noContextKeys) {
|
||||||
context = _.omit(context, noContextKeys);
|
context = _.omit(context, noContextKeys);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -104,9 +104,7 @@ var AbstractModel = mvc.Model.extend({
|
|||||||
value = fieldUtils.parse[field.type](value, field, {isUTC: true});
|
value = fieldUtils.parse[field.type](value, field, {isUTC: true});
|
||||||
} else if (field.type === 'selection' && value === false) {
|
} else if (field.type === 'selection' && value === false) {
|
||||||
// process selection: convert false to 0, if 0 is a valid key
|
// process selection: convert false to 0, if 0 is a valid key
|
||||||
var hasKey0 = _.find(field.selection, function (option) {
|
var hasKey0 = field.selection.find(option => option[0] === 0);
|
||||||
return option[0] === 0;
|
|
||||||
});
|
|
||||||
value = hasKey0 ? 0 : value;
|
value = hasKey0 ? 0 : value;
|
||||||
}
|
}
|
||||||
return value;
|
return value;
|
||||||
|
|||||||
@@ -187,7 +187,7 @@ var BasicModel = AbstractModel.extend({
|
|||||||
addDefaultRecord: function (listID, options) {
|
addDefaultRecord: function (listID, options) {
|
||||||
var self = this;
|
var self = this;
|
||||||
var list = this.localData[listID];
|
var list = this.localData[listID];
|
||||||
var context = _.extend({}, this._getDefaultContext(list), this._getContext(list));
|
var context = Object.assign({}, this._getDefaultContext(list), this._getContext(list));
|
||||||
|
|
||||||
var position = (options && options.position) || 'top';
|
var position = (options && options.position) || 'top';
|
||||||
var params = {
|
var params = {
|
||||||
@@ -225,7 +225,7 @@ var BasicModel = AbstractModel.extend({
|
|||||||
*/
|
*/
|
||||||
addFieldsInfo: async function (dataPointID, viewInfo) {
|
addFieldsInfo: async function (dataPointID, viewInfo) {
|
||||||
var dataPoint = this.localData[dataPointID];
|
var dataPoint = this.localData[dataPointID];
|
||||||
dataPoint.fields = _.extend({}, dataPoint.fields, viewInfo.fields);
|
dataPoint.fields = Object.assign({}, dataPoint.fields, viewInfo.fields);
|
||||||
// complete the given fieldInfo with the fields of the main view, so
|
// complete the given fieldInfo with the fields of the main view, so
|
||||||
// that those field will be reloaded if a reload is triggered by the
|
// that those field will be reloaded if a reload is triggered by the
|
||||||
// secondary view
|
// secondary view
|
||||||
@@ -254,7 +254,7 @@ var BasicModel = AbstractModel.extend({
|
|||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
// case 'record': on datapoints of all x2many fields
|
// case 'record': on datapoints of all x2many fields
|
||||||
const values = _.extend({}, dataPoint.data, dataPoint._changes);
|
const values = Object.assign({}, dataPoint.data, dataPoint._changes);
|
||||||
Object.keys(fieldInfo).forEach(fieldName => {
|
Object.keys(fieldInfo).forEach(fieldName => {
|
||||||
const fieldType = dataPoint.fields[fieldName].type;
|
const fieldType = dataPoint.fields[fieldName].type;
|
||||||
if (fieldType === 'one2many' || fieldType === 'many2many') {
|
if (fieldType === 'one2many' || fieldType === 'many2many') {
|
||||||
@@ -335,7 +335,7 @@ var BasicModel = AbstractModel.extend({
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
// 2.2. no drop on new addition on "UPDATE"
|
// 2.2. no drop on new addition on "UPDATE"
|
||||||
var lastEntry = _.last(parent._savePoint);
|
var lastEntry = parent._savePoint.at(-1);
|
||||||
if (lastEntry.operation === 'UPDATE' && lastEntry.id === id) {
|
if (lastEntry.operation === 'UPDATE' && lastEntry.id === id) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@@ -360,7 +360,7 @@ var BasicModel = AbstractModel.extend({
|
|||||||
deleteRecords: function (recordIds, modelName) {
|
deleteRecords: function (recordIds, modelName) {
|
||||||
var self = this;
|
var self = this;
|
||||||
var records = _.map(recordIds, function (id) { return self.localData[id]; });
|
var records = _.map(recordIds, function (id) { return self.localData[id]; });
|
||||||
var context = _.extend(records[0].getContext(), session.user_context);
|
var context = Object.assign(records[0].getContext(), session.user_context);
|
||||||
return this._rpc({
|
return this._rpc({
|
||||||
model: modelName,
|
model: modelName,
|
||||||
method: 'unlink',
|
method: 'unlink',
|
||||||
@@ -410,7 +410,7 @@ var BasicModel = AbstractModel.extend({
|
|||||||
if (elem._savePoint instanceof Array) {
|
if (elem._savePoint instanceof Array) {
|
||||||
elem._changes = elem._savePoint.slice(0);
|
elem._changes = elem._savePoint.slice(0);
|
||||||
} else {
|
} else {
|
||||||
elem._changes = _.extend({}, elem._savePoint);
|
elem._changes = Object.assign({}, elem._savePoint);
|
||||||
}
|
}
|
||||||
elem._isDirty = !isNew;
|
elem._isDirty = !isNew;
|
||||||
} else {
|
} else {
|
||||||
@@ -621,8 +621,8 @@ var BasicModel = AbstractModel.extend({
|
|||||||
}
|
}
|
||||||
|
|
||||||
var list = {
|
var list = {
|
||||||
aggregateValues: _.extend({}, element.aggregateValues),
|
aggregateValues: Object.assign({}, element.aggregateValues),
|
||||||
context: _.extend({}, element.context),
|
context: Object.assign({}, element.context),
|
||||||
count: element.count,
|
count: element.count,
|
||||||
data: _.map(element.data, function (elemID) {
|
data: _.map(element.data, function (elemID) {
|
||||||
return self.__get(elemID, options);
|
return self.__get(elemID, options);
|
||||||
@@ -1119,7 +1119,7 @@ var BasicModel = AbstractModel.extend({
|
|||||||
if (newValue instanceof Array) {
|
if (newValue instanceof Array) {
|
||||||
rec._savePoint = newValue.slice(0);
|
rec._savePoint = newValue.slice(0);
|
||||||
} else {
|
} else {
|
||||||
rec._savePoint = _.extend({}, newValue);
|
rec._savePoint = Object.assign({}, newValue);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -1190,7 +1190,7 @@ var BasicModel = AbstractModel.extend({
|
|||||||
reject,
|
reject,
|
||||||
);
|
);
|
||||||
} else {
|
} else {
|
||||||
_.extend(record.data, _changes);
|
Object.assign(record.data, _changes);
|
||||||
resolve(changedFields);
|
resolve(changedFields);
|
||||||
}
|
}
|
||||||
}).guardedCatch(reject);
|
}).guardedCatch(reject);
|
||||||
@@ -1403,7 +1403,7 @@ var BasicModel = AbstractModel.extend({
|
|||||||
unfreezeOrder: function (elementID) {
|
unfreezeOrder: function (elementID) {
|
||||||
var list = this.localData[elementID];
|
var list = this.localData[elementID];
|
||||||
if (list.type === 'record') {
|
if (list.type === 'record') {
|
||||||
var data = _.extend({}, list.data, list._changes);
|
var data = Object.assign({}, list.data, list._changes);
|
||||||
for (var fieldName in data) {
|
for (var fieldName in data) {
|
||||||
var field = list.fields[fieldName];
|
var field = list.fields[fieldName];
|
||||||
if (!field || !data[fieldName]) {
|
if (!field || !data[fieldName]) {
|
||||||
@@ -1561,7 +1561,7 @@ var BasicModel = AbstractModel.extend({
|
|||||||
resolve(_.keys(changes).concat(Object.keys(result && result.value || {})));
|
resolve(_.keys(changes).concat(Object.keys(result && result.value || {})));
|
||||||
}).guardedCatch(function () {
|
}).guardedCatch(function () {
|
||||||
self._visitChildren(record, function (elem) {
|
self._visitChildren(record, function (elem) {
|
||||||
_.extend(elem, initialData[elem.id]);
|
Object.assign(elem, initialData[elem.id]);
|
||||||
});
|
});
|
||||||
reject();
|
reject();
|
||||||
});
|
});
|
||||||
@@ -1806,7 +1806,7 @@ var BasicModel = AbstractModel.extend({
|
|||||||
// CREATE or UPDATE
|
// CREATE or UPDATE
|
||||||
if (command[0] === 0 && command[1]) {
|
if (command[0] === 0 && command[1]) {
|
||||||
// updating an existing (virtual) record
|
// updating an existing (virtual) record
|
||||||
var previousChange = _.find(oldChanges, function (operation) {
|
var previousChange = oldChanges.find(operation => {
|
||||||
var child = self.localData[operation.id];
|
var child = self.localData[operation.id];
|
||||||
return child && (child.ref === command[1]);
|
return child && (child.ref === command[1]);
|
||||||
});
|
});
|
||||||
@@ -2014,7 +2014,7 @@ var BasicModel = AbstractModel.extend({
|
|||||||
model: list.model,
|
model: list.model,
|
||||||
method: 'read',
|
method: 'read',
|
||||||
args: [_.pluck(data, 'id'), fieldNames],
|
args: [_.pluck(data, 'id'), fieldNames],
|
||||||
context: _.extend({}, record.context, field.context, list.getContext()),
|
context: Object.assign({}, record.context, field.context, list.getContext()),
|
||||||
}).then(function (records) {
|
}).then(function (records) {
|
||||||
_.each(records, function (record) {
|
_.each(records, function (record) {
|
||||||
list_records[record.id].data = record;
|
list_records[record.id].data = record;
|
||||||
@@ -2029,7 +2029,7 @@ var BasicModel = AbstractModel.extend({
|
|||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case 'CREATE':
|
case 'CREATE':
|
||||||
var createOptions = _.extend({
|
var createOptions = Object.assign({
|
||||||
context: command.context,
|
context: command.context,
|
||||||
position: command.position
|
position: command.position
|
||||||
}, options || {});
|
}, options || {});
|
||||||
@@ -2517,9 +2517,7 @@ var BasicModel = AbstractModel.extend({
|
|||||||
})
|
})
|
||||||
.then(function (name_gets) {
|
.then(function (name_gets) {
|
||||||
_.each(records, function (record) {
|
_.each(records, function (record) {
|
||||||
var nameGet = _.find(name_gets, function (nameGet) {
|
var nameGet = name_gets.find(nameGet => nameGet[0] === record.data.id);
|
||||||
return nameGet[0] === record.data.id;
|
|
||||||
});
|
|
||||||
record.data.display_name = nameGet[1];
|
record.data.display_name = nameGet[1];
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
@@ -2546,14 +2544,14 @@ var BasicModel = AbstractModel.extend({
|
|||||||
model: record.model,
|
model: record.model,
|
||||||
method: 'read',
|
method: 'read',
|
||||||
args: [[record.res_id], fieldNames],
|
args: [[record.res_id], fieldNames],
|
||||||
context: _.extend({bin_size: true}, record.getContext()),
|
context: Object.assign({bin_size: true}, record.getContext()),
|
||||||
})
|
})
|
||||||
.then(function (result) {
|
.then(function (result) {
|
||||||
if (result.length === 0) {
|
if (result.length === 0) {
|
||||||
return Promise.reject();
|
return Promise.reject();
|
||||||
}
|
}
|
||||||
result = result[0];
|
result = result[0];
|
||||||
record.data = _.extend({}, record.data, result);
|
record.data = Object.assign({}, record.data, result);
|
||||||
})
|
})
|
||||||
.then(function () {
|
.then(function () {
|
||||||
self._parseServerData(fieldNames, record, record.data);
|
self._parseServerData(fieldNames, record, record.data);
|
||||||
@@ -3174,9 +3172,9 @@ var BasicModel = AbstractModel.extend({
|
|||||||
var changes;
|
var changes;
|
||||||
const changesOnly = 'changesOnly' in options ? !!options.changesOnly : true;
|
const changesOnly = 'changesOnly' in options ? !!options.changesOnly : true;
|
||||||
if (!changesOnly) {
|
if (!changesOnly) {
|
||||||
changes = _.extend({}, record.data, record._changes);
|
changes = Object.assign({}, record.data, record._changes);
|
||||||
} else {
|
} else {
|
||||||
changes = _.extend({}, record._changes);
|
changes = Object.assign({}, record._changes);
|
||||||
}
|
}
|
||||||
var withReadonly = options.withReadonly || false;
|
var withReadonly = options.withReadonly || false;
|
||||||
var commands = this._generateX2ManyCommands(record, {
|
var commands = this._generateX2ManyCommands(record, {
|
||||||
@@ -3231,11 +3229,11 @@ var BasicModel = AbstractModel.extend({
|
|||||||
* @returns {Object} the data
|
* @returns {Object} the data
|
||||||
*/
|
*/
|
||||||
_generateOnChangeData: function (record, options) {
|
_generateOnChangeData: function (record, options) {
|
||||||
options = _.extend({}, options || {}, {withReadonly: true});
|
options = Object.assign({}, options || {}, {withReadonly: true});
|
||||||
var data = {};
|
var data = {};
|
||||||
if (!options.firstOnChange) {
|
if (!options.firstOnChange) {
|
||||||
var commands = this._generateX2ManyCommands(record, options);
|
var commands = this._generateX2ManyCommands(record, options);
|
||||||
data = _.extend(this.get(record.id, {raw: true}).data, commands);
|
data = Object.assign(this.get(record.id, {raw: true}).data, commands);
|
||||||
// 'display_name' is automatically added to the list of fields to fetch,
|
// 'display_name' is automatically added to the list of fields to fetch,
|
||||||
// when fetching a record, even if it doesn't appear in the view. However,
|
// when fetching a record, even if it doesn't appear in the view. However,
|
||||||
// only the fields in the view must be passed to the onchange RPC, so we
|
// only the fields in the view must be passed to the onchange RPC, so we
|
||||||
@@ -3286,7 +3284,7 @@ var BasicModel = AbstractModel.extend({
|
|||||||
fields = _.pick(fields, options.fieldNames);
|
fields = _.pick(fields, options.fieldNames);
|
||||||
}
|
}
|
||||||
var commands = {};
|
var commands = {};
|
||||||
var data = _.extend({}, record.data, record._changes);
|
var data = Object.assign({}, record.data, record._changes);
|
||||||
var type;
|
var type;
|
||||||
for (var fieldName in fields) {
|
for (var fieldName in fields) {
|
||||||
type = fields[fieldName].type;
|
type = fields[fieldName].type;
|
||||||
@@ -3851,7 +3849,7 @@ var BasicModel = AbstractModel.extend({
|
|||||||
_getRecordEvalContext: function (record, forDomain) {
|
_getRecordEvalContext: function (record, forDomain) {
|
||||||
var self = this;
|
var self = this;
|
||||||
var relDataPoint;
|
var relDataPoint;
|
||||||
var context = _.extend({}, record.data, record._changes);
|
var context = Object.assign({}, record.data, record._changes);
|
||||||
|
|
||||||
// calls _generateX2ManyCommands for a given field, and returns the array of commands
|
// calls _generateX2ManyCommands for a given field, and returns the array of commands
|
||||||
function _generateX2ManyCommands(fieldName) {
|
function _generateX2ManyCommands(fieldName) {
|
||||||
@@ -4146,7 +4144,7 @@ var BasicModel = AbstractModel.extend({
|
|||||||
var res_ids = params.res_ids || [];
|
var res_ids = params.res_ids || [];
|
||||||
var data = params.data || (type === 'record' ? {} : []);
|
var data = params.data || (type === 'record' ? {} : []);
|
||||||
var context = params.context;
|
var context = params.context;
|
||||||
var fields = _.extend({
|
var fields = Object.assign({
|
||||||
display_name: {type: 'char'},
|
display_name: {type: 'char'},
|
||||||
id: {type: 'integer'},
|
id: {type: 'integer'},
|
||||||
}, params.fields);
|
}, params.fields);
|
||||||
@@ -4424,7 +4422,7 @@ var BasicModel = AbstractModel.extend({
|
|||||||
var self = this;
|
var self = this;
|
||||||
|
|
||||||
// save the RPC request
|
// save the RPC request
|
||||||
var request = _.extend({}, params);
|
var request = Object.assign({}, params);
|
||||||
var prom = new Promise(function (resolve, reject) {
|
var prom = new Promise(function (resolve, reject) {
|
||||||
request.resolve = resolve;
|
request.resolve = resolve;
|
||||||
request.reject = reject;
|
request.reject = reject;
|
||||||
@@ -4449,7 +4447,7 @@ var BasicModel = AbstractModel.extend({
|
|||||||
var request = batchedRPCsRequests[i];
|
var request = batchedRPCsRequests[i];
|
||||||
key = request.model + ',' + JSON.stringify(request.context);
|
key = request.model + ',' + JSON.stringify(request.context);
|
||||||
if (!batches[key]) {
|
if (!batches[key]) {
|
||||||
batches[key] = _.extend({}, request, {requests: [request]});
|
batches[key] = Object.assign({}, request, {requests: [request]});
|
||||||
} else {
|
} else {
|
||||||
batches[key].ids = _.uniq(batches[key].ids.concat(request.ids));
|
batches[key].ids = _.uniq(batches[key].ids.concat(request.ids));
|
||||||
batches[key].fieldNames = _.uniq(batches[key].fieldNames.concat(request.fieldNames));
|
batches[key].fieldNames = _.uniq(batches[key].fieldNames.concat(request.fieldNames));
|
||||||
@@ -4702,7 +4700,7 @@ var BasicModel = AbstractModel.extend({
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
var record = self.localData[dataPointID];
|
var record = self.localData[dataPointID];
|
||||||
var data = _.extend({}, record.data, record._changes);
|
var data = Object.assign({}, record.data, record._changes);
|
||||||
if (_.difference(fieldNames, _.keys(data)).length) {
|
if (_.difference(fieldNames, _.keys(data)).length) {
|
||||||
missingIDs.push(resId);
|
missingIDs.push(resId);
|
||||||
}
|
}
|
||||||
@@ -4730,7 +4728,7 @@ var BasicModel = AbstractModel.extend({
|
|||||||
dataPoint = self.localData[list._cache[id]];
|
dataPoint = self.localData[list._cache[id]];
|
||||||
if (data) {
|
if (data) {
|
||||||
self._parseServerData(fieldNames, dataPoint, data);
|
self._parseServerData(fieldNames, dataPoint, data);
|
||||||
_.extend(dataPoint.data, data);
|
Object.assign(dataPoint.data, data);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
dataPoint = self._makeDataPoint({
|
dataPoint = self._makeDataPoint({
|
||||||
@@ -4815,9 +4813,7 @@ var BasicModel = AbstractModel.extend({
|
|||||||
// the 'title'.
|
// the 'title'.
|
||||||
var value = group[groupByField];
|
var value = group[groupByField];
|
||||||
if (list.fields[rawGroupBy].type === "selection") {
|
if (list.fields[rawGroupBy].type === "selection") {
|
||||||
var choice = _.find(list.fields[rawGroupBy].selection, function (c) {
|
var choice = list.fields[rawGroupBy].selection.find(c => c[0] === value);
|
||||||
return c[0] === value;
|
|
||||||
});
|
|
||||||
value = choice ? choice[1] : false;
|
value = choice ? choice[1] : false;
|
||||||
}
|
}
|
||||||
var newGroup = self._makeDataPoint({
|
var newGroup = self._makeDataPoint({
|
||||||
@@ -4839,9 +4835,7 @@ var BasicModel = AbstractModel.extend({
|
|||||||
type: 'list',
|
type: 'list',
|
||||||
viewType: list.viewType,
|
viewType: list.viewType,
|
||||||
});
|
});
|
||||||
var oldGroup = _.find(previousGroups, function (g) {
|
var oldGroup = previousGroups.find(g => g.res_id === newGroup.res_id && g.value === newGroup.value);
|
||||||
return g.res_id === newGroup.res_id && g.value === newGroup.value;
|
|
||||||
});
|
|
||||||
if (oldGroup) {
|
if (oldGroup) {
|
||||||
delete self.localData[newGroup.id];
|
delete self.localData[newGroup.id];
|
||||||
// restore the internal state of the group
|
// restore the internal state of the group
|
||||||
@@ -5122,7 +5116,7 @@ var BasicModel = AbstractModel.extend({
|
|||||||
route: '/web/dataset/search_read',
|
route: '/web/dataset/search_read',
|
||||||
model: list.model,
|
model: list.model,
|
||||||
fields: fieldNames,
|
fields: fieldNames,
|
||||||
context: _.extend({}, list.getContext(), {bin_size: true}),
|
context: Object.assign({}, list.getContext(), {bin_size: true}),
|
||||||
domain: this._getUngroupedListDomain(list),
|
domain: this._getUngroupedListDomain(list),
|
||||||
limit: list.limit,
|
limit: list.limit,
|
||||||
offset: list.loadMoreOffset + list.offset,
|
offset: list.loadMoreOffset + list.offset,
|
||||||
@@ -5264,8 +5258,8 @@ var BasicModel = AbstractModel.extend({
|
|||||||
}
|
}
|
||||||
var r1 = self.localData[record1ID];
|
var r1 = self.localData[record1ID];
|
||||||
var r2 = self.localData[record2ID];
|
var r2 = self.localData[record2ID];
|
||||||
var data1 = _.extend({}, r1.data, r1._changes);
|
var data1 = Object.assign({}, r1.data, r1._changes);
|
||||||
var data2 = _.extend({}, r2.data, r2._changes);
|
var data2 = Object.assign({}, r2.data, r2._changes);
|
||||||
|
|
||||||
// Default value to sort against: the value of the field
|
// Default value to sort against: the value of the field
|
||||||
var orderData1 = data1[order.name];
|
var orderData1 = data1[order.name];
|
||||||
|
|||||||
@@ -12,7 +12,7 @@ import FieldManagerMixin from 'web.FieldManagerMixin';
|
|||||||
* @property {Function} _confirmChange
|
* @property {Function} _confirmChange
|
||||||
* @property {Function} _registerWidget
|
* @property {Function} _registerWidget
|
||||||
*/
|
*/
|
||||||
var StandaloneFieldManagerMixin = _.extend({}, FieldManagerMixin, {
|
var StandaloneFieldManagerMixin = Object.assign({}, FieldManagerMixin, {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @override
|
* @override
|
||||||
|
|||||||
@@ -31,9 +31,7 @@ var viewUtils = {
|
|||||||
case 'many2one':
|
case 'many2one':
|
||||||
return group.res_id || false;
|
return group.res_id || false;
|
||||||
case 'selection':
|
case 'selection':
|
||||||
var descriptor = _.find(groupedByField.selection, function (option) {
|
var descriptor = groupedByField.selection.find(option => option[1] === group.value);
|
||||||
return option[1] === group.value;
|
|
||||||
});
|
|
||||||
return descriptor && descriptor[0];
|
return descriptor && descriptor[0];
|
||||||
case 'char':
|
case 'char':
|
||||||
case 'boolean':
|
case 'boolean':
|
||||||
|
|||||||
@@ -177,7 +177,7 @@ var ColorpickerWidget = Widget.extend({
|
|||||||
if (!rgb) {
|
if (!rgb) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
_.extend(this.colorComponents,
|
Object.assign(this.colorComponents,
|
||||||
{hex: hex},
|
{hex: hex},
|
||||||
rgb,
|
rgb,
|
||||||
ColorpickerWidget.convertRgbToHsl(rgb.red, rgb.green, rgb.blue)
|
ColorpickerWidget.convertRgbToHsl(rgb.red, rgb.green, rgb.blue)
|
||||||
@@ -207,7 +207,7 @@ var ColorpickerWidget = Widget.extend({
|
|||||||
if (!hex) {
|
if (!hex) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
_.extend(this.colorComponents,
|
Object.assign(this.colorComponents,
|
||||||
{red: r, green: g, blue: b},
|
{red: r, green: g, blue: b},
|
||||||
a === undefined ? {} : {opacity: a},
|
a === undefined ? {} : {opacity: a},
|
||||||
{hex: hex},
|
{hex: hex},
|
||||||
@@ -236,7 +236,7 @@ var ColorpickerWidget = Widget.extend({
|
|||||||
}
|
}
|
||||||
// We receive an hexa as we ignore the opacity
|
// We receive an hexa as we ignore the opacity
|
||||||
const hex = ColorpickerWidget.convertRgbaToCSSColor(rgb.red, rgb.green, rgb.blue);
|
const hex = ColorpickerWidget.convertRgbaToCSSColor(rgb.red, rgb.green, rgb.blue);
|
||||||
_.extend(this.colorComponents,
|
Object.assign(this.colorComponents,
|
||||||
{hue: h, saturation: s, lightness: l},
|
{hue: h, saturation: s, lightness: l},
|
||||||
rgb,
|
rgb,
|
||||||
{hex: hex},
|
{hex: hex},
|
||||||
@@ -254,7 +254,7 @@ var ColorpickerWidget = Widget.extend({
|
|||||||
if (a < 0 || a > 100) {
|
if (a < 0 || a > 100) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
_.extend(this.colorComponents,
|
Object.assign(this.colorComponents,
|
||||||
{opacity: a}
|
{opacity: a}
|
||||||
);
|
);
|
||||||
this._updateCssColor();
|
this._updateCssColor();
|
||||||
@@ -277,7 +277,7 @@ var ColorpickerWidget = Widget.extend({
|
|||||||
const g = this.colorComponents.green;
|
const g = this.colorComponents.green;
|
||||||
const b = this.colorComponents.blue;
|
const b = this.colorComponents.blue;
|
||||||
const a = this.colorComponents.opacity;
|
const a = this.colorComponents.opacity;
|
||||||
_.extend(this.colorComponents,
|
Object.assign(this.colorComponents,
|
||||||
{cssColor: ColorpickerWidget.convertRgbaToCSSColor(r, g, b, a)}
|
{cssColor: ColorpickerWidget.convertRgbaToCSSColor(r, g, b, a)}
|
||||||
);
|
);
|
||||||
if (this.previewActive) {
|
if (this.previewActive) {
|
||||||
@@ -702,7 +702,7 @@ const ColorpickerDialog = Dialog.extend({
|
|||||||
*/
|
*/
|
||||||
init: function (parent, options) {
|
init: function (parent, options) {
|
||||||
this.options = options || {};
|
this.options = options || {};
|
||||||
this._super(parent, _.extend({
|
this._super(parent, Object.assign({
|
||||||
size: 'small',
|
size: 'small',
|
||||||
title: _t('Pick a color'),
|
title: _t('Pick a color'),
|
||||||
buttons: [
|
buttons: [
|
||||||
@@ -716,7 +716,7 @@ const ColorpickerDialog = Dialog.extend({
|
|||||||
*/
|
*/
|
||||||
start: function () {
|
start: function () {
|
||||||
const proms = [this._super(...arguments)];
|
const proms = [this._super(...arguments)];
|
||||||
this.colorPicker = new ColorpickerWidget(this, _.extend({
|
this.colorPicker = new ColorpickerWidget(this, Object.assign({
|
||||||
colorPreview: true,
|
colorPreview: true,
|
||||||
}, this.options));
|
}, this.options));
|
||||||
proms.push(this.colorPicker.appendTo(this.$el));
|
proms.push(this.colorPicker.appendTo(this.$el));
|
||||||
|
|||||||
@@ -26,7 +26,7 @@ var DateWidget = Widget.extend({
|
|||||||
this._super.apply(this, arguments);
|
this._super.apply(this, arguments);
|
||||||
|
|
||||||
this.name = parent.name;
|
this.name = parent.name;
|
||||||
this.options = _.extend({
|
this.options = Object.assign({
|
||||||
locale: moment.locale(),
|
locale: moment.locale(),
|
||||||
format : this.type_of_date === 'datetime' ? time.getLangDatetimeFormat() : time.getLangDateFormat(),
|
format : this.type_of_date === 'datetime' ? time.getLangDatetimeFormat() : time.getLangDateFormat(),
|
||||||
minDate: moment({ y: 1000 }),
|
minDate: moment({ y: 1000 }),
|
||||||
@@ -339,7 +339,7 @@ var DateWidget = Widget.extend({
|
|||||||
var DateTimeWidget = DateWidget.extend({
|
var DateTimeWidget = DateWidget.extend({
|
||||||
type_of_date: "datetime",
|
type_of_date: "datetime",
|
||||||
init: function (parent, options) {
|
init: function (parent, options) {
|
||||||
this._super(parent, _.extend({
|
this._super(parent, Object.assign({
|
||||||
buttons: {
|
buttons: {
|
||||||
showToday: false,
|
showToday: false,
|
||||||
showClear: false,
|
showClear: false,
|
||||||
|
|||||||
@@ -71,7 +71,7 @@ var DomainNode = Widget.extend({
|
|||||||
this._super.apply(this, arguments);
|
this._super.apply(this, arguments);
|
||||||
|
|
||||||
this.model = model;
|
this.model = model;
|
||||||
this.options = _.extend({
|
this.options = Object.assign({
|
||||||
readonly: true,
|
readonly: true,
|
||||||
operators: null,
|
operators: null,
|
||||||
debugMode: false,
|
debugMode: false,
|
||||||
@@ -162,7 +162,7 @@ var DomainNode = Widget.extend({
|
|||||||
*/
|
*/
|
||||||
var DomainTree = DomainNode.extend({
|
var DomainTree = DomainNode.extend({
|
||||||
template: "DomainTree",
|
template: "DomainTree",
|
||||||
events: _.extend({}, DomainNode.prototype.events, {
|
events: Object.assign({}, DomainNode.prototype.events, {
|
||||||
"click .o_domain_tree_operator_selector .dropdown-item": "_onOperatorChange",
|
"click .o_domain_tree_operator_selector .dropdown-item": "_onOperatorChange",
|
||||||
}),
|
}),
|
||||||
custom_events: {
|
custom_events: {
|
||||||
@@ -461,11 +461,11 @@ var DomainTree = DomainNode.extend({
|
|||||||
*/
|
*/
|
||||||
var DomainSelector = DomainTree.extend({
|
var DomainSelector = DomainTree.extend({
|
||||||
template: "DomainSelector",
|
template: "DomainSelector",
|
||||||
events: _.extend({}, DomainTree.prototype.events, {
|
events: Object.assign({}, DomainTree.prototype.events, {
|
||||||
"click .o_domain_add_first_node_button": "_onAddFirstButtonClick",
|
"click .o_domain_add_first_node_button": "_onAddFirstButtonClick",
|
||||||
"change .o_domain_debug_input": "_onDebugInputChange",
|
"change .o_domain_debug_input": "_onDebugInputChange",
|
||||||
}),
|
}),
|
||||||
custom_events: _.extend({}, DomainTree.prototype.custom_events, {
|
custom_events: Object.assign({}, DomainTree.prototype.custom_events, {
|
||||||
domain_changed: "_onDomainChange",
|
domain_changed: "_onDomainChange",
|
||||||
}),
|
}),
|
||||||
|
|
||||||
@@ -637,7 +637,7 @@ var DomainSelector = DomainTree.extend({
|
|||||||
*/
|
*/
|
||||||
var DomainLeaf = DomainNode.extend({
|
var DomainLeaf = DomainNode.extend({
|
||||||
template: "DomainLeaf",
|
template: "DomainLeaf",
|
||||||
events: _.extend({}, DomainNode.prototype.events, {
|
events: Object.assign({}, DomainNode.prototype.events, {
|
||||||
"change .o_domain_leaf_operator_select": "_onOperatorSelectChange",
|
"change .o_domain_leaf_operator_select": "_onOperatorSelectChange",
|
||||||
"change .o_domain_leaf_value_input": "_onValueInputChange",
|
"change .o_domain_leaf_value_input": "_onValueInputChange",
|
||||||
|
|
||||||
@@ -922,7 +922,7 @@ var DomainLeaf = DomainNode.extend({
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
operators = _.extend({}, operator_mapping);
|
operators = Object.assign({}, operator_mapping);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -11,13 +11,13 @@ var _t = core._t;
|
|||||||
* @class DomainSelectorDialog
|
* @class DomainSelectorDialog
|
||||||
*/
|
*/
|
||||||
export default Dialog.extend({
|
export default Dialog.extend({
|
||||||
custom_events: _.extend({}, Dialog.prototype.custom_events, {
|
custom_events: Object.assign({}, Dialog.prototype.custom_events, {
|
||||||
domain_changed: "_onDomainChange",
|
domain_changed: "_onDomainChange",
|
||||||
}),
|
}),
|
||||||
init: function (parent, model, domain, options) {
|
init: function (parent, model, domain, options) {
|
||||||
this.model = model;
|
this.model = model;
|
||||||
this.newDomain = null;
|
this.newDomain = null;
|
||||||
this.options = _.extend({
|
this.options = Object.assign({
|
||||||
readonly: true,
|
readonly: true,
|
||||||
debugMode: false,
|
debugMode: false,
|
||||||
}, options || {});
|
}, options || {});
|
||||||
@@ -38,7 +38,7 @@ export default Dialog.extend({
|
|||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
this._super(parent, _.extend({}, {
|
this._super(parent, Object.assign({}, {
|
||||||
title: _t("Domain"),
|
title: _t("Domain"),
|
||||||
buttons: buttons,
|
buttons: buttons,
|
||||||
}, options || {}));
|
}, options || {}));
|
||||||
|
|||||||
@@ -56,7 +56,7 @@ var ModelFieldSelector = Widget.extend({
|
|||||||
|
|
||||||
this.model = model;
|
this.model = model;
|
||||||
this.chain = chain;
|
this.chain = chain;
|
||||||
this.options = _.extend({
|
this.options = Object.assign({
|
||||||
order: 'string',
|
order: 'string',
|
||||||
readonly: true,
|
readonly: true,
|
||||||
fields: null,
|
fields: null,
|
||||||
@@ -67,7 +67,7 @@ var ModelFieldSelector = Widget.extend({
|
|||||||
this.popover = new ModelFieldSelectorPopover(this, model, chain, options);
|
this.popover = new ModelFieldSelectorPopover(this, model, chain, options);
|
||||||
|
|
||||||
if (!this.options.readonly) {
|
if (!this.options.readonly) {
|
||||||
_.extend(this.events, this.edition_events);
|
Object.assign(this.events, this.edition_events);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -86,7 +86,7 @@ var ModelFieldSelectorPopover = Widget.extend({
|
|||||||
|
|
||||||
this.model = model;
|
this.model = model;
|
||||||
this.chain = chain;
|
this.chain = chain;
|
||||||
this.options = _.extend({
|
this.options = Object.assign({
|
||||||
order: 'string',
|
order: 'string',
|
||||||
filters: {},
|
filters: {},
|
||||||
fields: null,
|
fields: null,
|
||||||
@@ -98,7 +98,7 @@ var ModelFieldSelectorPopover = Widget.extend({
|
|||||||
cancelOnEscape: false,
|
cancelOnEscape: false,
|
||||||
chainedTitle: false
|
chainedTitle: false
|
||||||
}, options || {});
|
}, options || {});
|
||||||
this.options.filters = _.extend({
|
this.options.filters = Object.assign({
|
||||||
searchable: true,
|
searchable: true,
|
||||||
}, this.options.filters);
|
}, this.options.filters);
|
||||||
|
|
||||||
@@ -149,7 +149,7 @@ var ModelFieldSelectorPopover = Widget.extend({
|
|||||||
* @returns {Object}
|
* @returns {Object}
|
||||||
*/
|
*/
|
||||||
getSelectedField: function () {
|
getSelectedField: function () {
|
||||||
return _.findWhere(this.pages[this.chain.length - 1], {name: _.last(this.chain)});
|
return _.findWhere(this.pages[this.chain.length - 1], {name: this.chain.at(-1)});
|
||||||
},
|
},
|
||||||
/**
|
/**
|
||||||
* Saves a new field chain (array) and re-render.
|
* Saves a new field chain (array) and re-render.
|
||||||
@@ -213,7 +213,7 @@ var ModelFieldSelectorPopover = Widget.extend({
|
|||||||
* to its name
|
* to its name
|
||||||
/*/
|
/*/
|
||||||
_getLastPageField: function (name) {
|
_getLastPageField: function (name) {
|
||||||
return _.findWhere(_.last(this.pages), {
|
return _.findWhere(this.pages.at(-1) , {
|
||||||
name: name,
|
name: name,
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
@@ -404,10 +404,10 @@ var ModelFieldSelectorPopover = Widget.extend({
|
|||||||
var title = "";
|
var title = "";
|
||||||
if (this.pages.length > 1) {
|
if (this.pages.length > 1) {
|
||||||
var prevField = _.findWhere(this.pages[this.pages.length - 2], {
|
var prevField = _.findWhere(this.pages[this.pages.length - 2], {
|
||||||
name: (this.chain.length === this.pages.length) ? this.chain[this.chain.length - 2] : _.last(this.chain),
|
name: (this.chain.length === this.pages.length) ? this.chain[this.chain.length - 2] : this.chain.at(-1),
|
||||||
});
|
});
|
||||||
if (prevField) {
|
if (prevField) {
|
||||||
this.titlesNames[_.last(this.chain)] = prevField.string;
|
this.titlesNames[this.chain.at(-1)] = prevField.string;
|
||||||
title = prevField.string;
|
title = prevField.string;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -426,7 +426,7 @@ var ModelFieldSelectorPopover = Widget.extend({
|
|||||||
this._adaptInputVisibility();
|
this._adaptInputVisibility();
|
||||||
|
|
||||||
// Adapt the popover content
|
// Adapt the popover content
|
||||||
var page = _.last(this.pages);
|
var page = this.pages.at(-1);
|
||||||
this.$(".o_field_selector_popover_header .o_field_selector_title").text(this._getTitle());
|
this.$(".o_field_selector_popover_header .o_field_selector_title").text(this._getTitle());
|
||||||
|
|
||||||
var lines = _.filter(page, this.options.filter);
|
var lines = _.filter(page, this.options.filter);
|
||||||
@@ -722,7 +722,7 @@ function sortFields(fields, model, order) {
|
|||||||
array = array.sortBy(function (p) {return p[1][order]; });
|
array = array.sortBy(function (p) {return p[1][order]; });
|
||||||
}
|
}
|
||||||
return array.map(function (p) {
|
return array.map(function (p) {
|
||||||
return _.extend({
|
return Object.assign({
|
||||||
name: p[0],
|
name: p[0],
|
||||||
model: model,
|
model: model,
|
||||||
}, p[1]);
|
}, p[1]);
|
||||||
|
|||||||
@@ -423,7 +423,7 @@ var NameAndSignature = Widget.extend({
|
|||||||
}
|
}
|
||||||
self.$signatureField.jSignature('reset');
|
self.$signatureField.jSignature('reset');
|
||||||
var ignoredContext = _.pick(context, ['shadowOffsetX', 'shadowOffsetY']);
|
var ignoredContext = _.pick(context, ['shadowOffsetX', 'shadowOffsetY']);
|
||||||
_.extend(context, {shadowOffsetX: 0, shadowOffsetY: 0});
|
Object.assign(context, {shadowOffsetX: 0, shadowOffsetY: 0});
|
||||||
context.drawImage(image,
|
context.drawImage(image,
|
||||||
0,
|
0,
|
||||||
0,
|
0,
|
||||||
@@ -434,7 +434,7 @@ var NameAndSignature = Widget.extend({
|
|||||||
width,
|
width,
|
||||||
height
|
height
|
||||||
);
|
);
|
||||||
_.extend(context, ignoredContext);
|
Object.assign(context, ignoredContext);
|
||||||
self.trigger_up('signature_changed');
|
self.trigger_up('signature_changed');
|
||||||
}, 0);
|
}, 0);
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -40,9 +40,9 @@ QUnit.module('core', {}, function () {
|
|||||||
['user_id', '=', 3],
|
['user_id', '=', 3],
|
||||||
['member_ids', 'in', [3]]
|
['member_ids', 'in', [3]]
|
||||||
];
|
];
|
||||||
assert.ok(new Domain(currentDomain).compute(_.extend({}, web, {section_id: 42})));
|
assert.ok(new Domain(currentDomain).compute(Object.assign({}, web, {section_id: 42})));
|
||||||
assert.ok(new Domain(currentDomain).compute(_.extend({}, web, {user_id: 3})));
|
assert.ok(new Domain(currentDomain).compute(Object.assign({}, web, {user_id: 3})));
|
||||||
assert.ok(new Domain(currentDomain).compute(_.extend({}, web, {member_ids: 3})));
|
assert.ok(new Domain(currentDomain).compute(Object.assign({}, web, {member_ids: 3})));
|
||||||
});
|
});
|
||||||
|
|
||||||
QUnit.test("not", function (assert) {
|
QUnit.test("not", function (assert) {
|
||||||
|
|||||||
@@ -66,7 +66,7 @@ QUnit.module('core', function () {
|
|||||||
// Port from pypy/lib_pypy/test_datetime.py
|
// Port from pypy/lib_pypy/test_datetime.py
|
||||||
function makeEq(assert, c2) {
|
function makeEq(assert, c2) {
|
||||||
var ctx = pyUtils.context();
|
var ctx = pyUtils.context();
|
||||||
var c = _.extend({ td: ctx.datetime.timedelta }, c2 || {});
|
var c = Object.assign({ td: ctx.datetime.timedelta }, c2 || {});
|
||||||
return function (a, b, message) {
|
return function (a, b, message) {
|
||||||
assert.ok(py.eval(a + ' == ' + b, c), message);
|
assert.ok(py.eval(a + ' == ' + b, c), message);
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -362,7 +362,7 @@ var MockServer = Class.extend({
|
|||||||
var attrs = node.getAttribute('attrs');
|
var attrs = node.getAttribute('attrs');
|
||||||
if (attrs) {
|
if (attrs) {
|
||||||
attrs = pyUtils.py_eval(attrs);
|
attrs = pyUtils.py_eval(attrs);
|
||||||
_.extend(modifiers, attrs);
|
Object.assign(modifiers, attrs);
|
||||||
}
|
}
|
||||||
|
|
||||||
var states = node.getAttribute('states');
|
var states = node.getAttribute('states');
|
||||||
@@ -422,7 +422,7 @@ var MockServer = Class.extend({
|
|||||||
// this is hackhish, but _getView modifies the subview document in place,
|
// this is hackhish, but _getView modifies the subview document in place,
|
||||||
// especially to generate the "modifiers" attribute
|
// especially to generate the "modifiers" attribute
|
||||||
const { models } = self._getView(childNode, relModel,
|
const { models } = self._getView(childNode, relModel,
|
||||||
relFields, _.extend({}, context, {base_model_name: model}));
|
relFields, Object.assign({}, context, {base_model_name: model}));
|
||||||
[...models].forEach((modelName) => relatedModels.add(modelName));
|
[...models].forEach((modelName) => relatedModels.add(modelName));
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
@@ -570,7 +570,7 @@ var MockServer = Class.extend({
|
|||||||
var model = this.data[modelName];
|
var model = this.data[modelName];
|
||||||
var newID = this._getUnusedID(modelName);
|
var newID = this._getUnusedID(modelName);
|
||||||
var originalRecord = _.findWhere(model.records, {id: id});
|
var originalRecord = _.findWhere(model.records, {id: id});
|
||||||
var duplicateRecord = _.extend({}, originalRecord, {id: newID});
|
var duplicateRecord = Object.assign({}, originalRecord, {id: newID});
|
||||||
duplicateRecord.display_name = originalRecord.display_name + ' (copy)';
|
duplicateRecord.display_name = originalRecord.display_name + ' (copy)';
|
||||||
model.records.push(duplicateRecord);
|
model.records.push(duplicateRecord);
|
||||||
return newID;
|
return newID;
|
||||||
|
|||||||
@@ -218,13 +218,13 @@ function _mockGlobalObjects(params) {
|
|||||||
for (key in config) {
|
for (key in config) {
|
||||||
delete config[key];
|
delete config[key];
|
||||||
}
|
}
|
||||||
_.extend(config, initialConfig);
|
Object.assign(config, initialConfig);
|
||||||
}
|
}
|
||||||
if ('translateParameters' in params) {
|
if ('translateParameters' in params) {
|
||||||
for (key in core._t.database.parameters) {
|
for (key in core._t.database.parameters) {
|
||||||
delete core._t.database.parameters[key];
|
delete core._t.database.parameters[key];
|
||||||
}
|
}
|
||||||
_.extend(core._t.database.parameters, initialParameters);
|
Object.assign(core._t.database.parameters, initialParameters);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1442,7 +1442,7 @@
|
|||||||
WidgetComponent.template = xml`<div>Component</div>`;
|
WidgetComponent.template = xml`<div>Component</div>`;
|
||||||
|
|
||||||
const MyWidget = WidgetAdapter.extend({
|
const MyWidget = WidgetAdapter.extend({
|
||||||
custom_events: _.extend({}, Widget.custom_events, {
|
custom_events: Object.assign({}, Widget.custom_events, {
|
||||||
some_event: function (ev) {
|
some_event: function (ev) {
|
||||||
assert.step(ev.data.value);
|
assert.step(ev.data.value);
|
||||||
}
|
}
|
||||||
@@ -1474,7 +1474,7 @@
|
|||||||
class WidgetComponent extends LegacyComponent {}
|
class WidgetComponent extends LegacyComponent {}
|
||||||
WidgetComponent.template = xml`<div>Component</div>`;
|
WidgetComponent.template = xml`<div>Component</div>`;
|
||||||
const MyWidget = WidgetAdapter.extend({
|
const MyWidget = WidgetAdapter.extend({
|
||||||
custom_events: _.extend({}, Widget.custom_events, {
|
custom_events: Object.assign({}, Widget.custom_events, {
|
||||||
some_event: function (ev) {
|
some_event: function (ev) {
|
||||||
assert.strictEqual(this, ev.data.widget);
|
assert.strictEqual(this, ev.data.widget);
|
||||||
assert.step(ev.data.value);
|
assert.step(ev.data.value);
|
||||||
|
|||||||
@@ -79,7 +79,7 @@ const table = [
|
|||||||
fixture: {
|
fixture: {
|
||||||
before() {
|
before() {
|
||||||
this.WORD_REPLACEMENT = window.QWeb2.WORD_REPLACEMENT;
|
this.WORD_REPLACEMENT = window.QWeb2.WORD_REPLACEMENT;
|
||||||
window.QWeb2.WORD_REPLACEMENT = _.extend(
|
window.QWeb2.WORD_REPLACEMENT = Object.assign(
|
||||||
{not: '!', None: 'undefined'},
|
{not: '!', None: 'undefined'},
|
||||||
this.WORD_REPLACEMENT
|
this.WORD_REPLACEMENT
|
||||||
)
|
)
|
||||||
|
|||||||
@@ -98,7 +98,7 @@
|
|||||||
return this._super.apply(this, arguments);
|
return this._super.apply(this, arguments);
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
const params = _.extend(this.params, {
|
const params = Object.assign(this.params, {
|
||||||
context: { active_field: 2 },
|
context: { active_field: 2 },
|
||||||
groupedBy: ['product_id'],
|
groupedBy: ['product_id'],
|
||||||
fieldNames: ['foo'],
|
fieldNames: ['foo'],
|
||||||
@@ -825,7 +825,7 @@
|
|||||||
|
|
||||||
var rpcCount = 0;
|
var rpcCount = 0;
|
||||||
var fields = this.data.partner.fields;
|
var fields = this.data.partner.fields;
|
||||||
fields.other_product_id = _.extend({}, fields.product_id);
|
fields.other_product_id = Object.assign({}, fields.product_id);
|
||||||
fields.product_id.default = 37;
|
fields.product_id.default = 37;
|
||||||
fields.other_product_id.default = 41;
|
fields.other_product_id.default = 41;
|
||||||
|
|
||||||
@@ -1995,7 +1995,7 @@
|
|||||||
});
|
});
|
||||||
|
|
||||||
// load a new record (default_get)
|
// load a new record (default_get)
|
||||||
var params = _.extend(this.params, {
|
var params = Object.assign(this.params, {
|
||||||
res_id: undefined,
|
res_id: undefined,
|
||||||
type: 'record',
|
type: 'record',
|
||||||
fieldNames: ['foo'],
|
fieldNames: ['foo'],
|
||||||
@@ -2195,7 +2195,7 @@
|
|||||||
string: 'foobool2',
|
string: 'foobool2',
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
_.extend(this.data.partner.fields, newFields);
|
Object.assign(this.data.partner.fields, newFields);
|
||||||
|
|
||||||
this.data.partner.fields.foobool.onChange = true;
|
this.data.partner.fields.foobool.onChange = true;
|
||||||
this.data.partner.onchanges.foobool = function (obj) {
|
this.data.partner.onchanges.foobool = function (obj) {
|
||||||
|
|||||||
@@ -91,7 +91,7 @@ QUnit.module("Fields", (hooks) => {
|
|||||||
|
|
||||||
await click(target, ".o_form_button_save");
|
await click(target, ".o_form_button_save");
|
||||||
|
|
||||||
var newRecord = _.last(serverData.models.partner.records);
|
var newRecord = serverData.models.partner.records.at(-1);
|
||||||
assert.strictEqual(newRecord.product_id, 37, "should have saved record with correct value");
|
assert.strictEqual(newRecord.product_id, 37, "should have saved record with correct value");
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -122,7 +122,7 @@ QUnit.module("Fields", (hooks) => {
|
|||||||
|
|
||||||
await click(target.querySelector(".o_form_button_save"));
|
await click(target.querySelector(".o_form_button_save"));
|
||||||
|
|
||||||
var newRecord = _.last(serverData.models.partner.records);
|
var newRecord = serverData.models.partner.records.at(-1);
|
||||||
assert.strictEqual(
|
assert.strictEqual(
|
||||||
newRecord.color,
|
newRecord.color,
|
||||||
"black",
|
"black",
|
||||||
|
|||||||
@@ -817,7 +817,7 @@ QUnit.module("Fields", (hooks) => {
|
|||||||
</form>`,
|
</form>`,
|
||||||
mockRPC(route, args) {
|
mockRPC(route, args) {
|
||||||
if (args.method !== "get_views") {
|
if (args.method !== "get_views") {
|
||||||
assert.step(_.last(route.split("/")));
|
assert.step(route.split("/").at(-1));
|
||||||
}
|
}
|
||||||
if (args.method === "write") {
|
if (args.method === "write") {
|
||||||
assert.deepEqual(args.args[1].timmy, [
|
assert.deepEqual(args.args[1].timmy, [
|
||||||
@@ -1424,7 +1424,7 @@ QUnit.module("Fields", (hooks) => {
|
|||||||
resId: 1,
|
resId: 1,
|
||||||
mockRPC(route, args) {
|
mockRPC(route, args) {
|
||||||
if (args.method !== "get_views") {
|
if (args.method !== "get_views") {
|
||||||
assert.step(_.last(route.split("/")) + " on " + args.model);
|
assert.step(route.split("/").at(-1) + " on " + args.model);
|
||||||
}
|
}
|
||||||
if (args.model === "turtle") {
|
if (args.model === "turtle") {
|
||||||
assert.step(JSON.stringify(args.args[0])); // the read ids
|
assert.step(JSON.stringify(args.args[0])); // the read ids
|
||||||
|
|||||||
@@ -3467,7 +3467,7 @@ QUnit.module("Views", (hooks) => {
|
|||||||
"should have created a partner"
|
"should have created a partner"
|
||||||
);
|
);
|
||||||
assert.strictEqual(
|
assert.strictEqual(
|
||||||
_.last(serverData.models.partner.records).name,
|
serverData.models.partner.records.at(-1).name,
|
||||||
"new partner",
|
"new partner",
|
||||||
"should have correct name"
|
"should have correct name"
|
||||||
);
|
);
|
||||||
|
|||||||
@@ -9752,7 +9752,7 @@ QUnit.module("Views", (hooks) => {
|
|||||||
// create records to have the search more button
|
// create records to have the search more button
|
||||||
const newRecs = [];
|
const newRecs = [];
|
||||||
for (let i = 0; i < 8; i++) {
|
for (let i = 0; i < 8; i++) {
|
||||||
const newRec = _.extend({}, rec);
|
const newRec = Object.assign({}, rec);
|
||||||
newRec.id = 1 + i;
|
newRec.id = 1 + i;
|
||||||
newRec.cornichon = "extra fin";
|
newRec.cornichon = "extra fin";
|
||||||
newRecs.push(newRec);
|
newRecs.push(newRec);
|
||||||
|
|||||||
@@ -518,7 +518,7 @@ var ViewEditor = Widget.extend({
|
|||||||
|
|
||||||
function _processViews(views) {
|
function _processViews(views) {
|
||||||
// Only keep the active views and index them by ID.
|
// Only keep the active views and index them by ID.
|
||||||
_.extend(this.views, _.indexBy(_.filter(views, function (view) {
|
Object.assign(this.views, _.indexBy(_.filter(views, function (view) {
|
||||||
return view.active;
|
return view.active;
|
||||||
}), 'id'));
|
}), 'id'));
|
||||||
|
|
||||||
@@ -566,7 +566,7 @@ var ViewEditor = Widget.extend({
|
|||||||
var resources = type === 'scss' ? this.scss : this.js;
|
var resources = type === 'scss' ? this.scss : this.js;
|
||||||
_.each(data, function (bundleInfos) {
|
_.each(data, function (bundleInfos) {
|
||||||
_.each(bundleInfos[1], function (info) { info.bundle = bundleInfos[0]; });
|
_.each(bundleInfos[1], function (info) { info.bundle = bundleInfos[0]; });
|
||||||
_.extend(resources, _.indexBy(bundleInfos[1], 'url'));
|
Object.assign(resources, _.indexBy(bundleInfos[1], 'url'));
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -807,7 +807,7 @@ var SnippetEditor = Widget.extend({
|
|||||||
val.$el.children(),
|
val.$el.children(),
|
||||||
val.base_target ? this.$target.find(val.base_target).eq(0) : this.$target,
|
val.base_target ? this.$target.find(val.base_target).eq(0) : this.$target,
|
||||||
this.$el,
|
this.$el,
|
||||||
_.extend({
|
Object.assign({
|
||||||
optionName: optionName,
|
optionName: optionName,
|
||||||
snippetName: this.getName(),
|
snippetName: this.getName(),
|
||||||
}, val.data),
|
}, val.data),
|
||||||
@@ -2804,7 +2804,7 @@ var SnippetsMenu = Widget.extend({
|
|||||||
'$el': $style,
|
'$el': $style,
|
||||||
'drop-near': $style.data('drop-near') && self._computeSelectorFunctions($style.data('drop-near'), '', false, noCheck, true, excludeParent),
|
'drop-near': $style.data('drop-near') && self._computeSelectorFunctions($style.data('drop-near'), '', false, noCheck, true, excludeParent),
|
||||||
'drop-in': $style.data('drop-in') && self._computeSelectorFunctions($style.data('drop-in'), '', false, noCheck),
|
'drop-in': $style.data('drop-in') && self._computeSelectorFunctions($style.data('drop-in'), '', false, noCheck),
|
||||||
'data': _.extend({string: $style.attr('string')}, $style.data()),
|
'data': Object.assign({string: $style.attr('string')}, $style.data()),
|
||||||
};
|
};
|
||||||
self.templateOptions.push(option);
|
self.templateOptions.push(option);
|
||||||
selectors.push(option.selector);
|
selectors.push(option.selector);
|
||||||
|
|||||||
@@ -402,7 +402,7 @@ const UserValueWidget = Widget.extend({
|
|||||||
* @returns {Object}
|
* @returns {Object}
|
||||||
*/
|
*/
|
||||||
getMethodsParams: function (methodName) {
|
getMethodsParams: function (methodName) {
|
||||||
const params = _.extend({}, this._methodsParams);
|
const params = Object.assign({}, this._methodsParams);
|
||||||
if (methodName) {
|
if (methodName) {
|
||||||
params.possibleValues = params.optionsPossibleValues[methodName] || [];
|
params.possibleValues = params.optionsPossibleValues[methodName] || [];
|
||||||
params.activeValue = this.getActiveValue(methodName);
|
params.activeValue = this.getActiveValue(methodName);
|
||||||
@@ -472,7 +472,7 @@ const UserValueWidget = Widget.extend({
|
|||||||
*/
|
*/
|
||||||
loadMethodsData: function (validMethodNames, extraParams) {
|
loadMethodsData: function (validMethodNames, extraParams) {
|
||||||
this._methodsNames = [];
|
this._methodsNames = [];
|
||||||
this._methodsParams = _.extend({}, extraParams);
|
this._methodsParams = Object.assign({}, extraParams);
|
||||||
this._methodsParams.optionsPossibleValues = {};
|
this._methodsParams.optionsPossibleValues = {};
|
||||||
this._dependencies = [];
|
this._dependencies = [];
|
||||||
this._triggerWidgetsNames = [];
|
this._triggerWidgetsNames = [];
|
||||||
@@ -495,7 +495,7 @@ const UserValueWidget = Widget.extend({
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
this._userValueWidgets.forEach(widget => {
|
this._userValueWidgets.forEach(widget => {
|
||||||
const inheritedParams = _.extend({}, this._methodsParams);
|
const inheritedParams = Object.assign({}, this._methodsParams);
|
||||||
inheritedParams.optionsPossibleValues = null;
|
inheritedParams.optionsPossibleValues = null;
|
||||||
widget.loadMethodsData(validMethodNames, inheritedParams);
|
widget.loadMethodsData(validMethodNames, inheritedParams);
|
||||||
const subMethodsNames = widget.getMethodsNames();
|
const subMethodsNames = widget.getMethodsNames();
|
||||||
@@ -1388,7 +1388,7 @@ const MultiUserValueWidget = UserValueWidget.extend({
|
|||||||
|
|
||||||
const ColorpickerUserValueWidget = SelectUserValueWidget.extend({
|
const ColorpickerUserValueWidget = SelectUserValueWidget.extend({
|
||||||
className: (SelectUserValueWidget.prototype.className || '') + ' o_we_so_color_palette',
|
className: (SelectUserValueWidget.prototype.className || '') + ' o_we_so_color_palette',
|
||||||
custom_events: _.extend({}, SelectUserValueWidget.prototype.custom_events, {
|
custom_events: Object.assign({}, SelectUserValueWidget.prototype.custom_events, {
|
||||||
'custom_color_picked': '_onCustomColorPicked',
|
'custom_color_picked': '_onCustomColorPicked',
|
||||||
'color_picked': '_onColorPicked',
|
'color_picked': '_onColorPicked',
|
||||||
'color_hover': '_onColorHovered',
|
'color_hover': '_onColorHovered',
|
||||||
@@ -1458,7 +1458,7 @@ const ColorpickerUserValueWidget = SelectUserValueWidget.extend({
|
|||||||
* @override
|
* @override
|
||||||
*/
|
*/
|
||||||
getMethodsParams: function () {
|
getMethodsParams: function () {
|
||||||
return _.extend(this._super(...arguments), {
|
return Object.assign(this._super(...arguments), {
|
||||||
colorNames: this.colorPalette.getColorNames(),
|
colorNames: this.colorPalette.getColorNames(),
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
@@ -1883,7 +1883,7 @@ const DatetimePickerUserValueWidget = InputUserValueWidget.extend({
|
|||||||
* @override
|
* @override
|
||||||
*/
|
*/
|
||||||
getMethodsParams: function () {
|
getMethodsParams: function () {
|
||||||
return _.extend(this._super(...arguments), {
|
return Object.assign(this._super(...arguments), {
|
||||||
format: this.defaultFormat,
|
format: this.defaultFormat,
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
@@ -2011,7 +2011,7 @@ const ListUserValueWidget = UserValueWidget.extend({
|
|||||||
* @override
|
* @override
|
||||||
*/
|
*/
|
||||||
getMethodsParams() {
|
getMethodsParams() {
|
||||||
return _.extend(this._super(...arguments), {
|
return Object.assign(this._super(...arguments), {
|
||||||
records: this.records,
|
records: this.records,
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -18,7 +18,7 @@ var WysiwygDialog = Dialog.extend({
|
|||||||
if (config.device.isMobile) {
|
if (config.device.isMobile) {
|
||||||
options.fullscreen = true;
|
options.fullscreen = true;
|
||||||
}
|
}
|
||||||
this._super(parent, _.extend({}, {
|
this._super(parent, Object.assign({}, {
|
||||||
buttons: [{
|
buttons: [{
|
||||||
text: this.options.save_text || _t("Save"),
|
text: this.options.save_text || _t("Save"),
|
||||||
classes: 'btn-primary',
|
classes: 'btn-primary',
|
||||||
|
|||||||
@@ -15,7 +15,7 @@ var AltDialog = Dialog.extend({
|
|||||||
*/
|
*/
|
||||||
init: function (parent, options, media) {
|
init: function (parent, options, media) {
|
||||||
options = options || {};
|
options = options || {};
|
||||||
this._super(parent, _.extend({}, {
|
this._super(parent, Object.assign({}, {
|
||||||
title: _t("Change media description and tooltip")
|
title: _t("Change media description and tooltip")
|
||||||
}, options));
|
}, options));
|
||||||
|
|
||||||
|
|||||||
@@ -49,7 +49,7 @@ const ColorPaletteWidget = Widget.extend({
|
|||||||
this._super.apply(this, arguments);
|
this._super.apply(this, arguments);
|
||||||
const editableDocument = options.editable ? options.editable.ownerDocument : document;
|
const editableDocument = options.editable ? options.editable.ownerDocument : document;
|
||||||
this.style = editableDocument.defaultView.getComputedStyle(editableDocument.documentElement);
|
this.style = editableDocument.defaultView.getComputedStyle(editableDocument.documentElement);
|
||||||
this.options = _.extend({
|
this.options = Object.assign({
|
||||||
selectedColor: false,
|
selectedColor: false,
|
||||||
resetButton: true,
|
resetButton: true,
|
||||||
excluded: [],
|
excluded: [],
|
||||||
|
|||||||
@@ -26,7 +26,7 @@ const Link = Widget.extend({
|
|||||||
*/
|
*/
|
||||||
init: function (parent, options, editable, data, $button, link) {
|
init: function (parent, options, editable, data, $button, link) {
|
||||||
this.options = options || {};
|
this.options = options || {};
|
||||||
this._super(parent, _.extend({
|
this._super(parent, Object.assign({
|
||||||
title: _t("Link to"),
|
title: _t("Link to"),
|
||||||
}, this.options));
|
}, this.options));
|
||||||
|
|
||||||
|
|||||||
@@ -7,7 +7,7 @@ import Link from "wysiwyg.widgets.Link";
|
|||||||
// This widget is there only to extend Link and be instantiated by LinkDialog.
|
// This widget is there only to extend Link and be instantiated by LinkDialog.
|
||||||
const _DialogLinkWidget = Link.extend({
|
const _DialogLinkWidget = Link.extend({
|
||||||
template: 'wysiwyg.widgets.link',
|
template: 'wysiwyg.widgets.link',
|
||||||
events: _.extend({}, Link.prototype.events || {}, {
|
events: Object.assign({}, Link.prototype.events || {}, {
|
||||||
'change [name="link_style_color"]': '_onTypeChange',
|
'change [name="link_style_color"]': '_onTypeChange',
|
||||||
}),
|
}),
|
||||||
|
|
||||||
|
|||||||
@@ -16,7 +16,7 @@ import {
|
|||||||
*/
|
*/
|
||||||
const LinkTools = Link.extend({
|
const LinkTools = Link.extend({
|
||||||
template: 'wysiwyg.widgets.linkTools',
|
template: 'wysiwyg.widgets.linkTools',
|
||||||
events: _.extend({}, Link.prototype.events, {
|
events: Object.assign({}, Link.prototype.events, {
|
||||||
'click we-select we-button': '_onPickSelectOption',
|
'click we-select we-button': '_onPickSelectOption',
|
||||||
'click we-checkbox': '_onClickCheckbox',
|
'click we-checkbox': '_onClickCheckbox',
|
||||||
'change .link-custom-color-border input': '_onChangeCustomBorderWidth',
|
'change .link-custom-color-border input': '_onChangeCustomBorderWidth',
|
||||||
|
|||||||
@@ -295,7 +295,7 @@ async function createWysiwyg(params) {
|
|||||||
var parent = new Widget();
|
var parent = new Widget();
|
||||||
await testUtils.mock.addMockEnvironment(parent, params);
|
await testUtils.mock.addMockEnvironment(parent, params);
|
||||||
|
|
||||||
var wysiwygOptions = _.extend({}, params.wysiwygOptions, {
|
var wysiwygOptions = Object.assign({}, params.wysiwygOptions, {
|
||||||
recordInfo: {
|
recordInfo: {
|
||||||
context: {},
|
context: {},
|
||||||
res_model: 'module.test',
|
res_model: 'module.test',
|
||||||
|
|||||||
@@ -79,7 +79,7 @@ publicWidget.Widget.include({
|
|||||||
this.editableMode = this.options.editableMode || false;
|
this.editableMode = this.options.editableMode || false;
|
||||||
var extraEvents = this.editableMode ? this.edit_events : this.read_events;
|
var extraEvents = this.editableMode ? this.edit_events : this.read_events;
|
||||||
if (extraEvents) {
|
if (extraEvents) {
|
||||||
this.events = _.extend({}, this.events || {}, extraEvents);
|
this.events = Object.assign({}, this.events || {}, extraEvents);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -10,12 +10,12 @@ import "web.zoomodoo";
|
|||||||
|
|
||||||
export const WebsiteRoot = publicRootData.PublicRoot.extend(KeyboardNavigationMixin, {
|
export const WebsiteRoot = publicRootData.PublicRoot.extend(KeyboardNavigationMixin, {
|
||||||
// TODO remove KeyboardNavigationMixin in master
|
// TODO remove KeyboardNavigationMixin in master
|
||||||
events: _.extend({}, KeyboardNavigationMixin.events, publicRootData.PublicRoot.prototype.events || {}, {
|
events: Object.assign({}, KeyboardNavigationMixin.events, publicRootData.PublicRoot.prototype.events || {}, {
|
||||||
'click .js_change_lang': '_onLangChangeClick',
|
'click .js_change_lang': '_onLangChangeClick',
|
||||||
'click .js_publish_management .js_publish_btn': '_onPublishBtnClick',
|
'click .js_publish_management .js_publish_btn': '_onPublishBtnClick',
|
||||||
'shown.bs.modal': '_onModalShown',
|
'shown.bs.modal': '_onModalShown',
|
||||||
}),
|
}),
|
||||||
custom_events: _.extend({}, publicRootData.PublicRoot.prototype.custom_events || {}, {
|
custom_events: Object.assign({}, publicRootData.PublicRoot.prototype.custom_events || {}, {
|
||||||
'gmap_api_request': '_onGMapAPIRequest',
|
'gmap_api_request': '_onGMapAPIRequest',
|
||||||
'gmap_api_key_request': '_onGMapAPIKeyRequest',
|
'gmap_api_key_request': '_onGMapAPIKeyRequest',
|
||||||
'ready_to_clean_for_save': '_onWidgetsStopRequest',
|
'ready_to_clean_for_save': '_onWidgetsStopRequest',
|
||||||
@@ -62,7 +62,7 @@ export const WebsiteRoot = publicRootData.PublicRoot.extend(KeyboardNavigationMi
|
|||||||
*/
|
*/
|
||||||
_getContext: function (context) {
|
_getContext: function (context) {
|
||||||
var html = document.documentElement;
|
var html = document.documentElement;
|
||||||
return _.extend({
|
return Object.assign({
|
||||||
'website_id': html.getAttribute('data-website-id') | 0,
|
'website_id': html.getAttribute('data-website-id') | 0,
|
||||||
}, this._super.apply(this, arguments));
|
}, this._super.apply(this, arguments));
|
||||||
},
|
},
|
||||||
@@ -71,7 +71,7 @@ export const WebsiteRoot = publicRootData.PublicRoot.extend(KeyboardNavigationMi
|
|||||||
*/
|
*/
|
||||||
_getExtraContext: function (context) {
|
_getExtraContext: function (context) {
|
||||||
var html = document.documentElement;
|
var html = document.documentElement;
|
||||||
return _.extend({
|
return Object.assign({
|
||||||
'editable': !!(html.dataset.editable || $('[data-oe-model]').length), // temporary hack, this should be done in python
|
'editable': !!(html.dataset.editable || $('[data-oe-model]').length), // temporary hack, this should be done in python
|
||||||
'translatable': !!html.dataset.translatable,
|
'translatable': !!html.dataset.translatable,
|
||||||
'edit_translations': !!html.dataset.edit_translations,
|
'edit_translations': !!html.dataset.edit_translations,
|
||||||
|
|||||||
@@ -11,7 +11,7 @@ const getTraversedNodes = OdooEditorLib.getTraversedNodes;
|
|||||||
const FontFamilyPickerUserValueWidget = wSnippetOptions.FontFamilyPickerUserValueWidget;
|
const FontFamilyPickerUserValueWidget = wSnippetOptions.FontFamilyPickerUserValueWidget;
|
||||||
|
|
||||||
const wSnippetMenu = weSnippetEditor.SnippetsMenu.extend({
|
const wSnippetMenu = weSnippetEditor.SnippetsMenu.extend({
|
||||||
events: _.extend({}, weSnippetEditor.SnippetsMenu.prototype.events, {
|
events: Object.assign({}, weSnippetEditor.SnippetsMenu.prototype.events, {
|
||||||
'click .o_we_customize_theme_btn': '_onThemeTabClick',
|
'click .o_we_customize_theme_btn': '_onThemeTabClick',
|
||||||
'click .o_we_animate_text': '_onAnimateTextClick',
|
'click .o_we_animate_text': '_onAnimateTextClick',
|
||||||
'click .o_we_highlight_animated_text': '_onHighlightAnimatedTextClick',
|
'click .o_we_highlight_animated_text': '_onHighlightAnimatedTextClick',
|
||||||
@@ -21,7 +21,7 @@ const wSnippetMenu = weSnippetEditor.SnippetsMenu.extend({
|
|||||||
'gmap_api_key_request': '_onGMapAPIKeyRequest',
|
'gmap_api_key_request': '_onGMapAPIKeyRequest',
|
||||||
'reload_bundles': '_onReloadBundles',
|
'reload_bundles': '_onReloadBundles',
|
||||||
}),
|
}),
|
||||||
tabs: _.extend({}, weSnippetEditor.SnippetsMenu.prototype.tabs, {
|
tabs: Object.assign({}, weSnippetEditor.SnippetsMenu.prototype.tabs, {
|
||||||
THEME: 'theme',
|
THEME: 'theme',
|
||||||
}),
|
}),
|
||||||
optionsTabStructure: [
|
optionsTabStructure: [
|
||||||
|
|||||||
@@ -39,10 +39,10 @@ options.UserValueWidget.include({
|
|||||||
});
|
});
|
||||||
|
|
||||||
const UrlPickerUserValueWidget = InputUserValueWidget.extend({
|
const UrlPickerUserValueWidget = InputUserValueWidget.extend({
|
||||||
custom_events: _.extend({}, InputUserValueWidget.prototype.custom_events || {}, {
|
custom_events: Object.assign({}, InputUserValueWidget.prototype.custom_events || {}, {
|
||||||
'website_url_chosen': '_onWebsiteURLChosen',
|
'website_url_chosen': '_onWebsiteURLChosen',
|
||||||
}),
|
}),
|
||||||
events: _.extend({}, InputUserValueWidget.prototype.events || {}, {
|
events: Object.assign({}, InputUserValueWidget.prototype.events || {}, {
|
||||||
'click .o_we_redirect_to': '_onRedirectTo',
|
'click .o_we_redirect_to': '_onRedirectTo',
|
||||||
}),
|
}),
|
||||||
|
|
||||||
@@ -99,7 +99,7 @@ const UrlPickerUserValueWidget = InputUserValueWidget.extend({
|
|||||||
});
|
});
|
||||||
|
|
||||||
const FontFamilyPickerUserValueWidget = SelectUserValueWidget.extend({
|
const FontFamilyPickerUserValueWidget = SelectUserValueWidget.extend({
|
||||||
events: _.extend({}, SelectUserValueWidget.prototype.events || {}, {
|
events: Object.assign({}, SelectUserValueWidget.prototype.events || {}, {
|
||||||
'click .o_we_add_google_font_btn': '_onAddGoogleFontClick',
|
'click .o_we_add_google_font_btn': '_onAddGoogleFontClick',
|
||||||
'click .o_we_delete_google_font_btn': '_onDeleteGoogleFontClick',
|
'click .o_we_delete_google_font_btn': '_onDeleteGoogleFontClick',
|
||||||
}),
|
}),
|
||||||
@@ -540,7 +540,7 @@ options.userValueWidgetsRegistry['we-gpspicker'] = GPSPicker;
|
|||||||
//::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
|
//::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
|
||||||
|
|
||||||
options.Class.include({
|
options.Class.include({
|
||||||
custom_events: _.extend({}, options.Class.prototype.custom_events || {}, {
|
custom_events: Object.assign({}, options.Class.prototype.custom_events || {}, {
|
||||||
'google_fonts_custo_request': '_onGoogleFontsCustoRequest',
|
'google_fonts_custo_request': '_onGoogleFontsCustoRequest',
|
||||||
}),
|
}),
|
||||||
specialCheckAndReloadMethodsNames: ['customizeWebsiteViews', 'customizeWebsiteVariable', 'customizeWebsiteColor'],
|
specialCheckAndReloadMethodsNames: ['customizeWebsiteViews', 'customizeWebsiteVariable', 'customizeWebsiteColor'],
|
||||||
|
|||||||
@@ -4,7 +4,7 @@ import weWidgets from "wysiwyg.widgets";
|
|||||||
import wUtils from "website.utils";
|
import wUtils from "website.utils";
|
||||||
|
|
||||||
weWidgets.LinkTools.include({
|
weWidgets.LinkTools.include({
|
||||||
custom_events: _.extend({}, weWidgets.LinkTools.prototype.custom_events || {}, {
|
custom_events: Object.assign({}, weWidgets.LinkTools.prototype.custom_events || {}, {
|
||||||
website_url_chosen: '_onAutocompleteClose',
|
website_url_chosen: '_onAutocompleteClose',
|
||||||
}),
|
}),
|
||||||
LINK_DEBOUNCE: 1000,
|
LINK_DEBOUNCE: 1000,
|
||||||
|
|||||||
@@ -177,7 +177,7 @@ function prompt(options, _qweb) {
|
|||||||
if (_.isUndefined(_qweb)) {
|
if (_.isUndefined(_qweb)) {
|
||||||
_qweb = 'website.prompt';
|
_qweb = 'website.prompt';
|
||||||
}
|
}
|
||||||
options = _.extend({
|
options = Object.assign({
|
||||||
window_title: '',
|
window_title: '',
|
||||||
field_name: '',
|
field_name: '',
|
||||||
'default': '', // dict notation for IE<9
|
'default': '', // dict notation for IE<9
|
||||||
|
|||||||
@@ -22,7 +22,7 @@ weWidgets.LinkPopoverWidget.include({
|
|||||||
});
|
});
|
||||||
|
|
||||||
const NavbarLinkPopoverWidget = weWidgets.LinkPopoverWidget.extend({
|
const NavbarLinkPopoverWidget = weWidgets.LinkPopoverWidget.extend({
|
||||||
events: _.extend({}, weWidgets.LinkPopoverWidget.prototype.events, {
|
events: Object.assign({}, weWidgets.LinkPopoverWidget.prototype.events, {
|
||||||
'click .js_edit_menu': '_onEditMenuClick',
|
'click .js_edit_menu': '_onEditMenuClick',
|
||||||
}),
|
}),
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -8,10 +8,10 @@ import weUtils from "web_editor.utils";
|
|||||||
var _t = core._t;
|
var _t = core._t;
|
||||||
|
|
||||||
options.registry.InnerChart = options.Class.extend({
|
options.registry.InnerChart = options.Class.extend({
|
||||||
custom_events: _.extend({}, options.Class.prototype.custom_events, {
|
custom_events: Object.assign({}, options.Class.prototype.custom_events, {
|
||||||
'get_custom_colors': '_onGetCustomColors',
|
'get_custom_colors': '_onGetCustomColors',
|
||||||
}),
|
}),
|
||||||
events: _.extend({}, options.Class.prototype.events, {
|
events: Object.assign({}, options.Class.prototype.events, {
|
||||||
'click we-button.add_column': '_onAddColumnClick',
|
'click we-button.add_column': '_onAddColumnClick',
|
||||||
'click we-button.add_row': '_onAddRowClick',
|
'click we-button.add_row': '_onAddRowClick',
|
||||||
'click we-button.o_we_matrix_remove_col': '_onRemoveColumnClick',
|
'click we-button.o_we_matrix_remove_col': '_onRemoveColumnClick',
|
||||||
|
|||||||
@@ -6,7 +6,7 @@ import options from "web_editor.snippets.options";
|
|||||||
const qweb = core.qweb;
|
const qweb = core.qweb;
|
||||||
|
|
||||||
options.registry.countdown = options.Class.extend({
|
options.registry.countdown = options.Class.extend({
|
||||||
events: _.extend({}, options.Class.prototype.events || {}, {
|
events: Object.assign({}, options.Class.prototype.events || {}, {
|
||||||
'click .toggle-edit-message': '_onToggleEndMessageClick',
|
'click .toggle-edit-message': '_onToggleEndMessageClick',
|
||||||
}),
|
}),
|
||||||
|
|
||||||
|
|||||||
@@ -92,7 +92,7 @@ options.registry.gallery = options.Class.extend({
|
|||||||
addImages: function (previewMode) {
|
addImages: function (previewMode) {
|
||||||
const $images = this.$('img');
|
const $images = this.$('img');
|
||||||
var $container = this.$('> .container, > .container-fluid, > .o_container_small');
|
var $container = this.$('> .container, > .container-fluid, > .o_container_small');
|
||||||
const lastImage = _.last(this._getImages());
|
const lastImage = this._getImages().at(-1);
|
||||||
let index = lastImage ? this._getIndex(lastImage) : -1;
|
let index = lastImage ? this._getIndex(lastImage) : -1;
|
||||||
const dialog = new ComponentWrapper(this, MediaDialogWrapper, {
|
const dialog = new ComponentWrapper(this, MediaDialogWrapper, {
|
||||||
multiImages: true,
|
multiImages: true,
|
||||||
|
|||||||
@@ -284,7 +284,7 @@ const FieldEditor = FormEditor.extend({
|
|||||||
});
|
});
|
||||||
|
|
||||||
options.registry.WebsiteFormEditor = FormEditor.extend({
|
options.registry.WebsiteFormEditor = FormEditor.extend({
|
||||||
events: _.extend({}, options.Class.prototype.events || {}, {
|
events: Object.assign({}, options.Class.prototype.events || {}, {
|
||||||
'click .toggle-edit-message': '_onToggleEndMessageClick',
|
'click .toggle-edit-message': '_onToggleEndMessageClick',
|
||||||
}),
|
}),
|
||||||
|
|
||||||
|
|||||||
@@ -82,7 +82,7 @@ publicWidget.registry.crmPartnerAssign = publicWidget.Widget.extend({
|
|||||||
args: [[leadID], {
|
args: [[leadID], {
|
||||||
stage_id: stageID,
|
stage_id: stageID,
|
||||||
}],
|
}],
|
||||||
context: _.extend({website_partner_assign: 1}),
|
context: Object.assign({website_partner_assign: 1}),
|
||||||
}).then(function () {
|
}).then(function () {
|
||||||
window.location.reload();
|
window.location.reload();
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -5,7 +5,7 @@ import publicWidget from "web.public.widget";
|
|||||||
import {Markup} from "web.utils";
|
import {Markup} from "web.utils";
|
||||||
|
|
||||||
var ExhibitorConnectClosedDialog = Dialog.extend({
|
var ExhibitorConnectClosedDialog = Dialog.extend({
|
||||||
events: _.extend({}, Dialog.prototype.events, {
|
events: Object.assign({}, Dialog.prototype.events, {
|
||||||
'click .o_wesponsor_js_connect_modal_contry': '_onClickCountryFlag',
|
'click .o_wesponsor_js_connect_modal_contry': '_onClickCountryFlag',
|
||||||
}),
|
}),
|
||||||
template: 'exhibitor.connect.closed.modal',
|
template: 'exhibitor.connect.closed.modal',
|
||||||
|
|||||||
@@ -7,7 +7,7 @@ import ReplaySuggestionWidget from "website_event_track_live.website_event_track
|
|||||||
|
|
||||||
publicWidget.registry.websiteEventTrackLive = publicWidget.Widget.extend({
|
publicWidget.registry.websiteEventTrackLive = publicWidget.Widget.extend({
|
||||||
selector: '.o_wevent_event_track_live',
|
selector: '.o_wevent_event_track_live',
|
||||||
custom_events: _.extend({}, publicWidget.Widget.prototype.custom_events, {
|
custom_events: Object.assign({}, publicWidget.Widget.prototype.custom_events, {
|
||||||
'video-ended': '_onVideoEnded'
|
'video-ended': '_onVideoEnded'
|
||||||
}),
|
}),
|
||||||
|
|
||||||
|
|||||||
+1
-1
@@ -3,7 +3,7 @@
|
|||||||
import WebsiteEventTrackSuggestion from "website_event_track_live.website_event_track_suggestion";
|
import WebsiteEventTrackSuggestion from "website_event_track_live.website_event_track_suggestion";
|
||||||
|
|
||||||
var WebsiteEventTrackSuggestionLiveQuiz = WebsiteEventTrackSuggestion.include({
|
var WebsiteEventTrackSuggestionLiveQuiz = WebsiteEventTrackSuggestion.include({
|
||||||
events: _.extend({}, WebsiteEventTrackSuggestion.prototype.events, {
|
events: Object.assign({}, WebsiteEventTrackSuggestion.prototype.events, {
|
||||||
'click .owevent_track_suggestion_quiz': '_onQuizClick'
|
'click .owevent_track_suggestion_quiz': '_onQuizClick'
|
||||||
}),
|
}),
|
||||||
|
|
||||||
|
|||||||
@@ -224,7 +224,7 @@ var Quiz = publicWidget.Widget.extend({
|
|||||||
if (data.error) {
|
if (data.error) {
|
||||||
self._alertShow(data.error);
|
self._alertShow(data.error);
|
||||||
} else {
|
} else {
|
||||||
self.quiz = _.extend(self.quiz, data);
|
self.quiz = Object.assign(self.quiz, data);
|
||||||
self.quiz.quizPointsGained = data.quiz_points;
|
self.quiz.quizPointsGained = data.quiz_points;
|
||||||
if (data.quiz_completed) {
|
if (data.quiz_completed) {
|
||||||
self._disableAnswers();
|
self._disableAnswers();
|
||||||
|
|||||||
@@ -70,9 +70,7 @@ var SelectBox = publicWidget.Widget.extend({
|
|||||||
* @param {String} query
|
* @param {String} query
|
||||||
*/
|
*/
|
||||||
_objectExists: function (query) {
|
_objectExists: function (query) {
|
||||||
return _.find(this.objects, function (val) {
|
return this.objects.find(val => val.text.toLowerCase() === query.toLowerCase()) !== undefined;
|
||||||
return val.text.toLowerCase() === query.toLowerCase();
|
|
||||||
}) !== undefined;
|
|
||||||
},
|
},
|
||||||
/**
|
/**
|
||||||
* @private
|
* @private
|
||||||
|
|||||||
@@ -4,7 +4,7 @@ import core, { _t } from 'web.core';
|
|||||||
import checkoutForm from 'payment.checkout_form';
|
import checkoutForm from 'payment.checkout_form';
|
||||||
|
|
||||||
checkoutForm.include({
|
checkoutForm.include({
|
||||||
events: _.extend({}, checkoutForm.prototype.events || {}, {
|
events: Object.assign({}, checkoutForm.prototype.events || {}, {
|
||||||
'change .o_wpayment_fee_impact': '_onFeeParameterChange',
|
'change .o_wpayment_fee_impact': '_onFeeParameterChange',
|
||||||
}),
|
}),
|
||||||
|
|
||||||
|
|||||||
@@ -304,7 +304,7 @@ options.registry.WebsiteSaleGridLayout = options.Class.extend({
|
|||||||
});
|
});
|
||||||
|
|
||||||
options.registry.WebsiteSaleProductsItem = options.Class.extend({
|
options.registry.WebsiteSaleProductsItem = options.Class.extend({
|
||||||
events: _.extend({}, options.Class.prototype.events || {}, {
|
events: Object.assign({}, options.Class.prototype.events || {}, {
|
||||||
'mouseenter .o_wsale_soptions_menu_sizes table': '_onTableMouseEnter',
|
'mouseenter .o_wsale_soptions_menu_sizes table': '_onTableMouseEnter',
|
||||||
'mouseleave .o_wsale_soptions_menu_sizes table': '_onTableMouseLeave',
|
'mouseleave .o_wsale_soptions_menu_sizes table': '_onTableMouseLeave',
|
||||||
'mouseover .o_wsale_soptions_menu_sizes td': '_onTableItemMouseEnter',
|
'mouseover .o_wsale_soptions_menu_sizes td': '_onTableItemMouseEnter',
|
||||||
|
|||||||
@@ -15,7 +15,7 @@ import { ProductImageViewerWrapper } from "@website_sale/js/components/website_s
|
|||||||
|
|
||||||
publicWidget.registry.WebsiteSale = publicWidget.Widget.extend(VariantMixin, cartHandlerMixin, {
|
publicWidget.registry.WebsiteSale = publicWidget.Widget.extend(VariantMixin, cartHandlerMixin, {
|
||||||
selector: '.oe_website_sale',
|
selector: '.oe_website_sale',
|
||||||
events: _.extend({}, VariantMixin.events || {}, {
|
events: Object.assign({}, VariantMixin.events || {}, {
|
||||||
'change form .js_product:first input[name="add_qty"]': '_onChangeAddQuantity',
|
'change form .js_product:first input[name="add_qty"]': '_onChangeAddQuantity',
|
||||||
'mouseup .js_publish': '_onMouseupPublish',
|
'mouseup .js_publish': '_onMouseupPublish',
|
||||||
'touchend .js_publish': '_onMouseupPublish',
|
'touchend .js_publish': '_onMouseupPublish',
|
||||||
|
|||||||
@@ -25,7 +25,7 @@ const Many2oneDefaultMessageWidget = Many2oneUserValueWidget.extend({
|
|||||||
options.userValueWidgetsRegistry['we-many2one-default-message'] = Many2oneDefaultMessageWidget;
|
options.userValueWidgetsRegistry['we-many2one-default-message'] = Many2oneDefaultMessageWidget;
|
||||||
|
|
||||||
options.registry.AddToCart = options.Class.extend({
|
options.registry.AddToCart = options.Class.extend({
|
||||||
events: _.extend({}, options.Class.prototype.events || {}, {
|
events: Object.assign({}, options.Class.prototype.events || {}, {
|
||||||
'click .reset-variant-picker': '_onClickResetVariantPicker',
|
'click .reset-variant-picker': '_onClickResetVariantPicker',
|
||||||
'click .reset-product-picker': '_onClickResetProductPicker',
|
'click .reset-product-picker': '_onClickResetProductPicker',
|
||||||
}),
|
}),
|
||||||
|
|||||||
@@ -4,7 +4,7 @@ import publicWidget from 'web.public.widget';
|
|||||||
import 'website_sale_comparison.comparison';
|
import 'website_sale_comparison.comparison';
|
||||||
|
|
||||||
publicWidget.registry.ProductComparison.include({
|
publicWidget.registry.ProductComparison.include({
|
||||||
events: _.extend({}, publicWidget.registry.ProductComparison.prototype.events, {
|
events: Object.assign({}, publicWidget.registry.ProductComparison.prototype.events, {
|
||||||
'click .wishlist-section .o_add_to_compare': '_onClickCompare',
|
'click .wishlist-section .o_add_to_compare': '_onClickCompare',
|
||||||
}),
|
}),
|
||||||
|
|
||||||
|
|||||||
@@ -18,7 +18,7 @@ function corsIgnoredErrorHandler(env, error) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
WebsiteSaleDeliveryWidget.include({
|
WebsiteSaleDeliveryWidget.include({
|
||||||
events: _.extend({
|
events: Object.assign({
|
||||||
"click #btn_confirm_relay": "_onClickBtnConfirmRelay",
|
"click #btn_confirm_relay": "_onClickBtnConfirmRelay",
|
||||||
}, WebsiteSaleDeliveryWidget.prototype.events),
|
}, WebsiteSaleDeliveryWidget.prototype.events),
|
||||||
|
|
||||||
|
|||||||
@@ -4,7 +4,7 @@ import {websiteSlidesQuizNoFullscreen} from "@website_slides/js/slides_course_qu
|
|||||||
|
|
||||||
websiteSlidesQuizNoFullscreen.include({
|
websiteSlidesQuizNoFullscreen.include({
|
||||||
_extractChannelData: function (slideData) {
|
_extractChannelData: function (slideData) {
|
||||||
return _.extend({}, this._super.apply(this, arguments), {
|
return Object.assign({}, this._super.apply(this, arguments), {
|
||||||
productId: slideData.productId,
|
productId: slideData.productId,
|
||||||
enroll: slideData.enroll,
|
enroll: slideData.enroll,
|
||||||
currencyName: slideData.currencyName,
|
currencyName: slideData.currencyName,
|
||||||
|
|||||||
@@ -22,7 +22,7 @@
|
|||||||
*/
|
*/
|
||||||
var findSlide = function (slideList, matcher) {
|
var findSlide = function (slideList, matcher) {
|
||||||
var slideMatch = _.matcher(matcher);
|
var slideMatch = _.matcher(matcher);
|
||||||
return _.find(slideList, slideMatch);
|
return slideList.find(slide => slideMatch(slide));
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -494,10 +494,10 @@
|
|||||||
* This widget is rendered sever side, and attached to the existing DOM.
|
* This widget is rendered sever side, and attached to the existing DOM.
|
||||||
*/
|
*/
|
||||||
var Fullscreen = SlideCoursePage.extend({
|
var Fullscreen = SlideCoursePage.extend({
|
||||||
events: _.extend({}, SlideCoursePage.prototype.events, {
|
events: Object.assign({}, SlideCoursePage.prototype.events, {
|
||||||
'click .o_wslides_fs_toggle_sidebar': '_onClickToggleSidebar',
|
'click .o_wslides_fs_toggle_sidebar': '_onClickToggleSidebar',
|
||||||
}),
|
}),
|
||||||
custom_events: _.extend({}, SlideCoursePage.prototype.custom_events, {
|
custom_events: Object.assign({}, SlideCoursePage.prototype.custom_events, {
|
||||||
'change_slide': '_onChangeSlideRequest',
|
'change_slide': '_onChangeSlideRequest',
|
||||||
'slide_go_next': '_onSlideGoToNext',
|
'slide_go_next': '_onSlideGoToNext',
|
||||||
}),
|
}),
|
||||||
|
|||||||
@@ -690,7 +690,7 @@
|
|||||||
|
|
||||||
publicWidget.registry.websiteSlidesQuizNoFullscreen = SlideCoursePage.extend({
|
publicWidget.registry.websiteSlidesQuizNoFullscreen = SlideCoursePage.extend({
|
||||||
selector: '.o_wslides_lesson_main', // selector of complete page, as we need slide content and aside content table
|
selector: '.o_wslides_lesson_main', // selector of complete page, as we need slide content and aside content table
|
||||||
custom_events: _.extend({}, SlideCoursePage.prototype.custom_events, {
|
custom_events: Object.assign({}, SlideCoursePage.prototype.custom_events, {
|
||||||
slide_go_next: '_onQuizNextSlide',
|
slide_go_next: '_onQuizNextSlide',
|
||||||
}),
|
}),
|
||||||
|
|
||||||
|
|||||||
@@ -6,7 +6,7 @@ import publicWidget from 'web.public.widget';
|
|||||||
|
|
||||||
var TagCourseDialog = Dialog.extend({
|
var TagCourseDialog = Dialog.extend({
|
||||||
template: 'website.slides.tag.add',
|
template: 'website.slides.tag.add',
|
||||||
events: _.extend({}, Dialog.prototype.events, {
|
events: Object.assign({}, Dialog.prototype.events, {
|
||||||
'change input#tag_id' : '_onChangeTag',
|
'change input#tag_id' : '_onChangeTag',
|
||||||
}),
|
}),
|
||||||
|
|
||||||
|
|||||||
@@ -8,7 +8,7 @@ import wUtils from 'website.utils';
|
|||||||
|
|
||||||
var SlideUploadDialog = Dialog.extend({
|
var SlideUploadDialog = Dialog.extend({
|
||||||
template: 'website.slide.upload.modal',
|
template: 'website.slide.upload.modal',
|
||||||
events: _.extend({}, Dialog.prototype.events, {
|
events: Object.assign({}, Dialog.prototype.events, {
|
||||||
'click .o_wslides_js_upload_install_button': '_onClickInstallModule',
|
'click .o_wslides_js_upload_install_button': '_onClickInstallModule',
|
||||||
'click .o_wslides_select_category': '_onClickSlideCategoryIcon',
|
'click .o_wslides_select_category': '_onClickSlideCategoryIcon',
|
||||||
'change input#upload': '_onChangeSlideUpload',
|
'change input#upload': '_onChangeSlideUpload',
|
||||||
@@ -156,7 +156,7 @@ var SlideUploadDialog = Dialog.extend({
|
|||||||
} else {
|
} else {
|
||||||
sourceType = this.$('input[name="source_type"]:checked').data('value');
|
sourceType = this.$('input[name="source_type"]:checked').data('value');
|
||||||
}
|
}
|
||||||
var values = _.extend({
|
var values = Object.assign({
|
||||||
'channel_id': this.channelID,
|
'channel_id': this.channelID,
|
||||||
'description': this._formGetFieldValue('description'),
|
'description': this._formGetFieldValue('description'),
|
||||||
'document_google_url': this._formGetFieldValue('document_google_url'),
|
'document_google_url': this._formGetFieldValue('document_google_url'),
|
||||||
@@ -171,17 +171,17 @@ var SlideUploadDialog = Dialog.extend({
|
|||||||
|
|
||||||
var canvas = this.$('#data_canvas')[0];
|
var canvas = this.$('#data_canvas')[0];
|
||||||
if (this.file.type === 'application/pdf') {
|
if (this.file.type === 'application/pdf') {
|
||||||
_.extend(values, {
|
Object.assign(values, {
|
||||||
'image_1920': canvas.toDataURL().split(',')[1],
|
'image_1920': canvas.toDataURL().split(',')[1],
|
||||||
'slide_category': 'document',
|
'slide_category': 'document',
|
||||||
'binary_content': this.file.data
|
'binary_content': this.file.data
|
||||||
});
|
});
|
||||||
} else if (values['slide_category'] === 'article') {
|
} else if (values['slide_category'] === 'article') {
|
||||||
_.extend(values, {
|
Object.assign(values, {
|
||||||
'image_1920': this.file.type === 'image/svg+xml' ? await this._svgToPng() : this.file.data,
|
'image_1920': this.file.type === 'image/svg+xml' ? await this._svgToPng() : this.file.data,
|
||||||
});
|
});
|
||||||
} else if (/^image\/.*/.test(this.file.type)) {
|
} else if (/^image\/.*/.test(this.file.type)) {
|
||||||
_.extend(values, {
|
Object.assign(values, {
|
||||||
'slide_category': 'infographic',
|
'slide_category': 'infographic',
|
||||||
'binary_content': this.file.type === 'image/svg+xml' ? await this._svgToPNG() : this.file.data,
|
'binary_content': this.file.type === 'image/svg+xml' ? await this._svgToPNG() : this.file.data,
|
||||||
});
|
});
|
||||||
@@ -656,7 +656,7 @@ var SlideUploadDialog = Dialog.extend({
|
|||||||
.text(_.str.sprintf(_t('Failed to install "%s".'), this.modulesToInstallStatus.name));
|
.text(_.str.sprintf(_t('Failed to install "%s".'), this.modulesToInstallStatus.name));
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
this.modulesToInstallStatus = _.extend({}, _.find(this.modulesToInstall, function (item) { return item.id === moduleId; }));
|
this.modulesToInstallStatus = Object.assign({}, this.modulesToInstall.find( function (item) { return item.id === moduleId; }));
|
||||||
this.set('state', '_import');
|
this.set('state', '_import');
|
||||||
this.$('#o_wslides_install_module_text')
|
this.$('#o_wslides_install_module_text')
|
||||||
.text(_.str.sprintf(_t('Do you want to install the "%s" app?'), this.modulesToInstallStatus.name));
|
.text(_.str.sprintf(_t('Do you want to install the "%s" app?'), this.modulesToInstallStatus.name));
|
||||||
|
|||||||
@@ -8,7 +8,7 @@ import SlidesUpload from "@website_slides/js/slides_upload";
|
|||||||
* Management of the new 'certification' slide_category
|
* Management of the new 'certification' slide_category
|
||||||
*/
|
*/
|
||||||
SlidesUpload.SlideUploadDialog.include({
|
SlidesUpload.SlideUploadDialog.include({
|
||||||
events: _.extend({}, SlidesUpload.SlideUploadDialog.prototype.events || {}, {
|
events: Object.assign({}, SlidesUpload.SlideUploadDialog.prototype.events || {}, {
|
||||||
'change input#certification_id': '_onChangeCertification'
|
'change input#certification_id': '_onChangeCertification'
|
||||||
}),
|
}),
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user