added eqm codes to items and etaxes items

This commit is contained in:
Ali 2025-09-22 20:55:53 +04:00
parent 2622450084
commit 852b1ffe46
3 changed files with 122 additions and 7 deletions

View File

@ -52,6 +52,46 @@ def get_tax_exempt_articles(doctype, txt, searchfield, start, page_len, filters)
return result
@frappe.whitelist()
def get_land_tax_articles(doctype, txt, searchfield, start, page_len, filters):
"""Возвращает список налоговых статей для земельных участков"""
# Ключевые части названий для поиска земельных участков
allowed_patterns = [
'Vergi Məcəlləsinin 207.3-cü maddəsinə əsasən',
'Vergi Məcəlləsinin 207.4-cü maddəsinə əsasən',
'Vergi Məcəlləsinin 207.5-ci maddəsinə əsasən',
'Vergi Məcəlləsinin 207.6-cı maddəsinə əsasən',
'Vergi Məcəlləsinin 207.7-ci maddəsinə əsasən',
'Vergi Məcəlləsinin 207.8-ci maddəsinə əsasən',
'Vergi Məcəlləsinin 207.9-cu maddəsinə əsasən',
'Vergi Məcəlləsinin 207.10-cu maddəsinə əsasən',
'Vergi Məcəlləsinin 207.11-ci maddəsinə əsasən',
'Vergi məcəlləsinin 207.12-ci maddəsinə əsasən',
'Vergi Məcəlləsinin 227.1-ci maddəsinə əsasən'
]
# Строим условие для поиска
conditions = []
for pattern in allowed_patterns:
conditions.append(f"name LIKE '%{pattern}%'")
# Добавляем поисковый текст если есть
where_clause = f"({' OR '.join(conditions)})"
if txt:
where_clause += f" AND name LIKE '%{txt}%'"
# Выполняем запрос
result = frappe.db.sql(f"""
SELECT name
FROM `tabTax Article`
WHERE {where_clause}
ORDER BY name
LIMIT {start}, {page_len}
""")
return result
# ===============================
# СЕЛЬСКОХОЗЯЙСТВЕННЫЕ ЗЕМЛИ
# ===============================

View File

@ -94,12 +94,31 @@ def create_custom_fields():
reqd=0
),
# Column Break для размещения справа
dict(
fieldname='agricultural_column_break',
fieldtype='Column Break',
insert_after='agricultural_land_purpose',
depends_on='eval:doc.custom_asset_type == "Kənd təsərrüfatı təyinatlı torpaq sahələri"'
),
# Tax Article for Agricultural Land
dict(
fieldname='agricultural_tax_article',
label='Tax Article',
fieldtype='Link',
options='Tax Article',
insert_after='agricultural_column_break',
depends_on='eval:doc.custom_asset_type == "Kənd təsərrüfatı təyinatlı torpaq sahələri"',
reqd=0
),
# === INDUSTRIAL/COMMERCIAL LAND SECTION ===
dict(
fieldname='industrial_land_section',
label='Industrial/Commercial Land Information',
fieldtype='Section Break',
insert_after='agricultural_land_purpose',
insert_after='agricultural_tax_article',
collapsible=1,
depends_on='eval:doc.custom_asset_type == "Sənaye, tikinti, nəqliyyat, rabitə, ticarət-məişət xidməti və digər xüsusi təyinatlı torpaq sahələri"'
),
@ -140,12 +159,31 @@ def create_custom_fields():
depends_on='eval:doc.custom_asset_type == "Sənaye, tikinti, nəqliyyat, rabitə, ticarət-məişət xidməti və digər xüsusi təyinatlı torpaq sahələri"'
),
# Column Break для размещения справа
dict(
fieldname='industrial_column_break',
fieldtype='Column Break',
insert_after='mining_note',
depends_on='eval:doc.custom_asset_type == "Sənaye, tikinti, nəqliyyat, rabitə, ticarət-məişət xidməti və digər xüsusi təyinatlı torpaq sahələri"'
),
# Tax Article for Industrial Land
dict(
fieldname='industrial_tax_article',
label='Tax Article',
fieldtype='Link',
options='Tax Article',
insert_after='industrial_column_break',
depends_on='eval:doc.custom_asset_type == "Sənaye, tikinti, nəqliyyat, rabitə, ticarət-məişət xidməti və digər xüsusi təyinatlı torpaq sahələri"',
reqd=0
),
# === TAX EXEMPT ASSETS SECTION ===
dict(
fieldname='tax_exempt_assets_section',
label='Tax Exempt Assets Information',
fieldtype='Section Break',
insert_after='mining_note',
insert_after='industrial_tax_article',
collapsible=1,
depends_on='eval:doc.custom_asset_type == "Vergidən azad olunan əsas vəsaitlər"'
),
@ -524,6 +562,15 @@ def create_custom_fields():
in_list_view=0,
in_standard_filter=0
),
dict(
fieldname='eqm_code',
label='EQM Code',
fieldtype='Link',
options='EQM Codes',
insert_after='product_group_code',
in_list_view=0,
in_standard_filter=0
),
# Product Category field
dict(
fieldname='product_category',

View File

@ -206,7 +206,9 @@ function hide_all_conditional_fields(frm) {
'cadastral_district_name',
'cadastral_district_code',
'quality_groups',
'agricultural_land_purpose'
'agricultural_land_purpose',
'agricultural_column_break',
'agricultural_tax_article'
];
const industrial_fields = [
@ -214,7 +216,9 @@ function hide_all_conditional_fields(frm) {
'territorial_unit_name',
'territorial_unit_code',
'industrial_land_purpose',
'mining_note'
'mining_note',
'industrial_column_break',
'industrial_tax_article'
];
const tax_exempt_fields = [
@ -273,7 +277,9 @@ function setup_agricultural_fields(frm) {
'cadastral_district_name',
'cadastral_district_code',
'quality_groups',
'agricultural_land_purpose'
'agricultural_land_purpose',
'agricultural_column_break',
'agricultural_tax_article'
];
agricultural_fields.forEach(fieldname => {
@ -291,11 +297,20 @@ function setup_agricultural_fields(frm) {
frm.set_df_property(fieldname, 'reqd', 1);
});
// Используем кастомный метод для земельных участков
frm.set_query('agricultural_tax_article', function() {
return {
query: "jey_erp.asset.get_land_tax_articles"
};
});
// Set descriptions
frm.set_df_property('agricultural_purpose', 'description',
'Select the purpose for agricultural land taxation');
frm.set_df_property('cadastral_district_name', 'description',
'Select the cadastral valuation district');
frm.set_df_property('agricultural_tax_article', 'description',
'Select the applicable tax article for land');
}
function setup_industrial_fields(frm) {
@ -304,7 +319,9 @@ function setup_industrial_fields(frm) {
'territorial_unit_name',
'territorial_unit_code',
'industrial_land_purpose',
'mining_note'
'mining_note',
'industrial_column_break',
'industrial_tax_article'
];
industrial_fields.forEach(fieldname => {
@ -320,6 +337,13 @@ function setup_industrial_fields(frm) {
frm.set_df_property(fieldname, 'reqd', 1);
});
// Используем кастомный метод для земельных участков
frm.set_query('industrial_tax_article', function() {
return {
query: "jey_erp.asset.get_land_tax_articles"
};
});
// Set descriptions
frm.set_df_property('territorial_unit_name', 'description',
'Select the appropriate territorial unit');
@ -327,6 +351,8 @@ function setup_industrial_fields(frm) {
'Specify the purpose of the industrial/commercial land plot');
frm.set_df_property('mining_note', 'description',
'Check if this relates to mining operations');
frm.set_df_property('industrial_tax_article', 'description',
'Select the applicable tax article for land');
}
function setup_tax_exempt_fields(frm) {
@ -349,7 +375,7 @@ function setup_tax_exempt_fields(frm) {
frm.set_df_property(fieldname, 'reqd', 1);
});
// Используем кастомный метод из asset.py
// Используем кастомный метод из asset.py для tax exempt
frm.set_query('tax_exempt_tax_article', function() {
return {
query: "jey_erp.asset.get_tax_exempt_articles"
@ -397,10 +423,12 @@ function clear_dependent_fields(frm) {
'cadastral_district_code',
'quality_groups',
'agricultural_land_purpose',
'agricultural_tax_article',
'territorial_unit_name',
'territorial_unit_code',
'industrial_land_purpose',
'mining_note',
'industrial_tax_article',
'tax_exempt_tax_article',
'tax_exempt_settlements',
'taxable_settlements',