quality changes in asset
This commit is contained in:
parent
fa2bfa31c8
commit
2a496a6658
|
|
@ -14,6 +14,9 @@ frappe.ui.form.on('Asset', {
|
|||
if (should_show_calculation_button(frm)) {
|
||||
add_calculation_button(frm);
|
||||
}
|
||||
|
||||
// Применяем ограничения для quality_groups при загрузке формы
|
||||
update_quality_groups_options(frm);
|
||||
},
|
||||
|
||||
land: function(frm) {
|
||||
|
|
@ -73,6 +76,7 @@ frappe.ui.form.on('Asset', {
|
|||
},
|
||||
|
||||
agricultural_land_purpose: function(frm) {
|
||||
update_quality_groups_options(frm);
|
||||
toggle_calculation_button(frm);
|
||||
},
|
||||
|
||||
|
|
@ -187,6 +191,35 @@ frappe.ui.form.on('Asset', {
|
|||
}
|
||||
});
|
||||
|
||||
// ===== ФУНКЦИЯ ДЛЯ УПРАВЛЕНИЯ ОПЦИЯМИ QUALITY GROUPS =====
|
||||
|
||||
function update_quality_groups_options(frm) {
|
||||
const agricultural_land_purpose = frm.doc.agricultural_land_purpose;
|
||||
|
||||
if (!agricultural_land_purpose) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (agricultural_land_purpose === 'Biçənək, örüş və otlaqlar') {
|
||||
// Ограничиваем только значением "I"
|
||||
frm.set_df_property('quality_groups', 'options', '\nI');
|
||||
|
||||
// Если выбрано что-то другое, автоматически устанавливаем "I"
|
||||
if (frm.doc.quality_groups && frm.doc.quality_groups !== 'I') {
|
||||
frm.set_value('quality_groups', 'I');
|
||||
}
|
||||
// Если ничего не выбрано, тоже устанавливаем "I"
|
||||
if (!frm.doc.quality_groups) {
|
||||
frm.set_value('quality_groups', 'I');
|
||||
}
|
||||
} else if (agricultural_land_purpose === 'Əkin, dinc və çoxillik əkmələr') {
|
||||
// Показываем все опции
|
||||
frm.set_df_property('quality_groups', 'options', '\nI\nII\nIII\nIV\nV');
|
||||
}
|
||||
|
||||
frm.refresh_field('quality_groups');
|
||||
}
|
||||
|
||||
// ===== DYNAMIC TAX VALIDITY FIELDS WITH FRAPPE CONTROLS =====
|
||||
|
||||
function render_tax_validity_fields(frm, type) {
|
||||
|
|
|
|||
Loading…
Reference in New Issue