Skip to Content
เมนู
คุณต้องลงทะเบียนเพื่อโต้ตอบกับคอมมูนิตี้
คำถามนี้ถูกตั้งค่าสถานะ
1 ตอบกลับ
4889 มุมมอง

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

อวตาร
ละทิ้ง
Related Posts ตอบกลับ มุมมอง กิจกรรม
1
ธ.ค. 21
2432
2
ก.ย. 20
8602
0
พ.ค. 19
10281
how to read field values using js แก้ไขแล้ว
1
พ.ค. 25
8200
1
พ.ย. 24
4861