跳至內容
選單
此問題已被標幟
1 回覆
4871 瀏覽次數

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
    },
});

});

頭像
捨棄
最佳答案

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

頭像
捨棄
相關帖文 回覆 瀏覽次數 活動
1
12月 21
2432
2
9月 20
8601
0
5月 19
10278
1
5月 25
8192
1
11月 24
4850