when I try to inherit website_sale.payment into my js file I get undefined instead of website_sale.payment object
example:
var wsp = require('website_sale.payment');
console.log(wsp);Odoo is the world's easiest all-in-one management software.
It includes hundreds of business apps:
when I try to inherit website_sale.payment into my js file I get undefined instead of website_sale.payment object
example:
var wsp = require('website_sale.payment');
console.log(wsp);In order to inherit a JS module in Odoo, it has to return the module declared and in this case you can't because the website_sale.payment is not returning anything, anyhow, you have another option,
https://github.com/odoo/odoo/blob/13.0/addons/website_sale/static/src/js/website_sale_payment.js
in the line 6 of the file in the link above you can see that there is a new widget in the widget registry called WebsiteSalePayment, since this is what you want to modify you need to access to this widget and the way to do it is:
var publicWidget = require('web.public.widget');publicWidget.registry.WebsiteSalePayment.include({start: function () {
/**your code here
**/
return this._super.apply(this, arguments);
},
});
| 相关帖文 | 回复 | 查看 | 活动 | |
|---|---|---|---|---|
|
|
0
7月 25
|
868 | ||
|
|
1
7月 25
|
6048 | ||
|
|
0
7月 25
|
1732 | ||
|
|
0
6月 25
|
1710 | ||
|
|
1
6月 25
|
1545 |
See this: https://www.youtube.com/watch?v=GGKd7aCp-pM&list=PLqRRLx0cl0hpSfSgbUNxokOuCqs-hh5LM&index=2