Siirry sisältöön
Menu
Sinun on rekisteröidyttävä, jotta voit olla vuorovaikutuksessa yhteisön kanssa.
Tämä kysymys on merkitty
1 Vastaa
4878 Näkymät

I'm trying to extend the sale .ProductConfiguratorMixin JS module, at /sale/static/src/js/product_configurator_mixin.js; I've tried via the two ways provided in the answers linked below to no avail.

Below is the code I've got right now; it's not executing, since the print doesn't appear in the console nor the extended function in a console.trace() i called.


odoo.define('mymodule.ProductConfiguratorMixin', function (require) {
'use strict';

var Widget = require('web.Widget');
var ProductConfiguratorMixin = require('sale.ProductConfiguratorMixin');

return Widget.include(ProductConfiguratorMixin, {
    _getCombinationInfo: function (ev) {
    console.log('THIS SHOULD GET PRINTED');
    the rest of the function, unaltered
    },
});

});

Avatar
Hylkää
Paras vastaus

Hi,

The ProductConfiguratorMixin is not a widget, it is simply a js object

odoo.define("model_name.file_name", function (require) {
"use strict";

const ProductConfiguratorMixin = require('sale.ProductConfiguratorMixin');

Object.assign(ProductConfiguratorMixin, {
_getCombinationInfo: function(){
ProductConfiguratorMixin._getCombinationInfo(); // if you want the default code
// Your code here
}
})

});

Regards

Avatar
Hylkää
Aiheeseen liittyviä artikkeleita Vastaukset Näkymät Toimenpide
1
jouluk. 21
2432
2
syysk. 20
8601
0
toukok. 19
10279
1
toukok. 25
8193
1
marrask. 24
4853