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
- Accounting
- Inventory
- PoS
- Project
- MRP
This question has been flagged
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
Enjoying the discussion? Don't just read, join in!
Create an account today to enjoy exclusive features and engage with our awesome community!
Sign upRelated Posts | Replies | Views | Activity | |
---|---|---|---|---|
|
1
Jul 24
|
27 | ||
|
0
Jul 24
|
1173 | ||
|
0
Jun 24
|
990 | ||
|
1
May 24
|
1234 | ||
|
1
Sep 23
|
1724 |