Hi all,
I want to disable select and input fields if they contain any data.
how can I achieve this in Odoo 17?
Odoo is the world's easiest all-in-one management software.
It includes hundreds of business apps:
- CRM
- e-Commerce
- Contabilidad
- Inventario
- PoS
- Project
- MRP
Se marcó esta pregunta
using js file you can achieve this
odoo.define('my_module.disable_fields', function (require) {
"use strict";
var FormController = require('web.FormController');
FormController.include({
renderButtons: function () {
this._super.apply(this, arguments);
var self = this;
var $name_field = this.$el.find('input[name="name"]');
var $select_field = this.$el.find('select[name="select_field"]');
if ($name_field.val()) {
$name_field.prop('disabled', true);
}
if ($select_field.val()) {
$select_field.prop('disabled', true);
}
},
});
});
hope this gone help you
Hello Vikas Maharana
Hope you are doing well.
- This is example of code .
/ @odoo-module /
import publicWidget from "@web/legacy/js/public/public_widget";
publicWidget.registry.EquipmentCall = publicWidget.Widget.extend({
events: {
'keyup .oe_vm_ddlgnc_comment': '_keyUpgncomment',
init() {
this._super(...arguments);
this.rpc = this.bindService("rpc");
},
var publicWidget = require('web.public.widget');
_keyUpgncomment: function(ev) {
if ($('.oe_vm_ddlgnc_comment').val){
$(".oe_vm_ddlgnc_comment").attr("disabled", true);
} else {
$(".oe_vm_ddlgnc_score_slct").attr("disabled", true);
}
},
I Hope this information proves helpful to you.
Thanks & Regards,
Email: odoo@aktivsoftware.com
Skype: kalpeshmaheshwari
¿Le interesa esta conversación? ¡Participe en ella!
Cree una cuenta para poder utilizar funciones exclusivas e interactuar con la comunidad.
RegistrarsePublicaciones relacionadas | Respuestas | Vistas | Actividad | |
---|---|---|---|---|
|
1
jul 24
|
27 | ||
|
0
jul 24
|
1178 | ||
|
0
jun 24
|
1017 | ||
|
1
may 24
|
1248 | ||
How can i inherit this template?
Resuelto
|
|
1
sept 23
|
1726 |