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") {
|
if (frm.doc.custom_asset_type === "Vergidən azad olunan əsas vəsaitlər") {
|
||||||
const required_fields = [
|
const required_fields = [];
|
||||||
['tax_exempt_tax_article', 'Tax Article'],
|
|
||||||
['tax_exempt_settlements', 'Settlements']
|
// 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) {
|
for (let [field, label] of required_fields) {
|
||||||
if (!frm.doc[field]) {
|
if (!frm.doc[field]) {
|
||||||
|
|
@ -870,14 +875,21 @@ function setup_tax_exempt_fields(frm) {
|
||||||
frm.set_df_property(fieldname, 'hidden', 0);
|
frm.set_df_property(fieldname, 'hidden', 0);
|
||||||
});
|
});
|
||||||
|
|
||||||
const required_tax_exempt_fields = [
|
// Скрываем tax_exempt_settlements для Property, так же как для Taxable Assets
|
||||||
'tax_exempt_tax_article',
|
if (frm.doc.property) {
|
||||||
'tax_exempt_settlements'
|
frm.set_df_property('tax_exempt_settlements', 'hidden', 1);
|
||||||
];
|
frm.set_df_property('tax_exempt_settlements', 'reqd', 0);
|
||||||
|
|
||||||
required_tax_exempt_fields.forEach(fieldname => {
|
// Только tax_exempt_tax_article обязателен для Property
|
||||||
frm.set_df_property(fieldname, 'reqd', 1);
|
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() {
|
frm.set_query('tax_exempt_tax_article', function() {
|
||||||
return {
|
return {
|
||||||
|
|
@ -887,8 +899,6 @@ function setup_tax_exempt_fields(frm) {
|
||||||
|
|
||||||
frm.set_df_property('tax_exempt_tax_article', 'description',
|
frm.set_df_property('tax_exempt_tax_article', 'description',
|
||||||
'Select the applicable tax article for tax exempt assets');
|
'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) {
|
function setup_taxable_fields(frm) {
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue