fixed bugs
This commit is contained in:
parent
c4b02cf35a
commit
96a61ac671
|
|
@ -160,10 +160,15 @@ frappe.ui.form.on('Asset', {
|
|||
}
|
||||
|
||||
if (frm.doc.custom_asset_type === "Vergidən azad olunan əsas vəsaitlər") {
|
||||
const required_fields = [
|
||||
['tax_exempt_tax_article', 'Tax Article'],
|
||||
['tax_exempt_settlements', 'Settlements']
|
||||
];
|
||||
const required_fields = [];
|
||||
|
||||
// tax_exempt_settlements обязателен только для Land
|
||||
if (frm.doc.land) {
|
||||
required_fields.push(['tax_exempt_settlements', 'Settlements']);
|
||||
}
|
||||
|
||||
// tax_exempt_tax_article обязателен всегда
|
||||
required_fields.push(['tax_exempt_tax_article', 'Tax Article']);
|
||||
|
||||
for (let [field, label] of required_fields) {
|
||||
if (!frm.doc[field]) {
|
||||
|
|
@ -870,14 +875,21 @@ function setup_tax_exempt_fields(frm) {
|
|||
frm.set_df_property(fieldname, 'hidden', 0);
|
||||
});
|
||||
|
||||
const required_tax_exempt_fields = [
|
||||
'tax_exempt_tax_article',
|
||||
'tax_exempt_settlements'
|
||||
];
|
||||
// Скрываем tax_exempt_settlements для Property, так же как для Taxable Assets
|
||||
if (frm.doc.property) {
|
||||
frm.set_df_property('tax_exempt_settlements', 'hidden', 1);
|
||||
frm.set_df_property('tax_exempt_settlements', 'reqd', 0);
|
||||
|
||||
required_tax_exempt_fields.forEach(fieldname => {
|
||||
frm.set_df_property(fieldname, 'reqd', 1);
|
||||
});
|
||||
// Только tax_exempt_tax_article обязателен для Property
|
||||
frm.set_df_property('tax_exempt_tax_article', 'reqd', 1);
|
||||
} else {
|
||||
// Для Land оба поля обязательны
|
||||
frm.set_df_property('tax_exempt_settlements', 'reqd', 1);
|
||||
frm.set_df_property('tax_exempt_tax_article', 'reqd', 1);
|
||||
|
||||
frm.set_df_property('tax_exempt_settlements', 'description',
|
||||
'Select the settlement type');
|
||||
}
|
||||
|
||||
frm.set_query('tax_exempt_tax_article', function() {
|
||||
return {
|
||||
|
|
@ -887,8 +899,6 @@ function setup_tax_exempt_fields(frm) {
|
|||
|
||||
frm.set_df_property('tax_exempt_tax_article', 'description',
|
||||
'Select the applicable tax article for tax exempt assets');
|
||||
frm.set_df_property('tax_exempt_settlements', 'description',
|
||||
'Select the settlement type');
|
||||
}
|
||||
|
||||
function setup_taxable_fields(frm) {
|
||||
|
|
|
|||
Loading…
Reference in New Issue