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
- Buchhaltung
- Lager
- PoS
- Projekte
- MRP
Diese Frage wurde gekennzeichnet
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
Diskutieren Sie gerne? Treten Sie bei, statt nur zu lesen!
Erstellen Sie heute ein Konto, um exklusive Funktionen zu nutzen und mit unserer tollen Community zu interagieren!
Registrieren| Verknüpfte Beiträge | Antworten | Ansichten | Aktivität | |
|---|---|---|---|---|
|
|
1
Juli 24
|
27 | ||
|
|
0
Juli 24
|
2262 | ||
|
|
0
Juni 24
|
1990 | ||
|
|
1
Mai 24
|
2147 | ||
|
|
1
Sept. 23
|
2787 |