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
- Boekhouding
- Voorraad
- PoS
- Project
- MRP
Deze vraag is gerapporteerd
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
Geniet je van het gesprek? Blijf niet alleen lezen, doe ook mee!
Maak vandaag nog een account aan om te profiteren van exclusieve functies en deel uit te maken van onze geweldige community!
Aanmelden| Gerelateerde posts | Antwoorden | Weergaven | Activiteit | |
|---|---|---|---|---|
|
|
1
jul. 24
|
27 | ||
|
|
0
jul. 24
|
2262 | ||
|
|
0
jun. 24
|
1991 | ||
|
|
1
mei 24
|
2147 | ||
|
How can i inherit this template?
Opgelost
|
|
1
sep. 23
|
2788 |