I added a button in Odoo 17 settings, when I click that button I need to perform a function in js , how?
Odoo is the world's easiest all-in-one management software.
It includes hundreds of business apps:
- CRM
- e-Commerce
- Kirjanpito
- Varastointi
- PoS
- Project
- MRP
Tämä kysymys on merkitty
Hi,
In XML file you can define the button. For example:
<button name="button" t-on-click="buttonOnclick" string="Button Name"/>
And in JavaScript file in your module. define your JavaScript function:
async buttonOnclick() {
console.log('Button Clicked')
}
Hope it helps
Is there a way to receive the event in odoo 17?
This is my button on my xml file:
And this my my js file with my odoo.define:
odoo.define('sale_order_punch.geoloc', [], async function buttonOnclickPartner() { console.log('Button clicked');
});
This works, but i would like to do something similar to this code of odoo 15 in odoo 17:
odoo.define('sale_order_punch.geoloc', function (require){
"use strict";
var fromController = require('web.FormController');
var fromRender = require('web.FormRenderer');
var FormView = require('web.FormView');
var rpc = require('web.rpc');
fromController.include({
_onButtonClicked: function (event) {
console.log(event.data.record);
}
});
});
Nautitko keskustelusta? Älä vain lue, vaan osallistu!
Luo tili jo tänään nauttiaksesi yksinoikeusominaisuuksista ja osallistuaksesi mahtavaan yhteisöömme!
RekisteröidyAiheeseen liittyviä artikkeleita | Vastaukset | Näkymät | Toimenpide | |
---|---|---|---|---|
|
2
huhtik. 24
|
1092 | ||
|
3
maalisk. 24
|
4324 | ||
|
2
huhtik. 24
|
3252 | ||
|
0
maalisk. 24
|
858 | ||
|
1
jouluk. 24
|
1053 |