feat(vat-allocation-report): split each tax article into amount + ödəniş columns
Per-article column now shows invoice amount; a paired Ödəniş column shows allocated_amount from VAT allocation sales invoice. Row filter widened to include unpaid lines (amount > 0 OR allocated_amount > 0). Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
parent
ae162adc0c
commit
cd74b2ba85
|
|
@ -40,9 +40,10 @@ def get_data(filters):
|
|||
'posting_date': item['posting_date']
|
||||
}
|
||||
|
||||
# Инициализируем все колонки нулями
|
||||
# Инициализируем все колонки нулями (amount + ödəniş)
|
||||
for field_key in tax_articles_mapping.values():
|
||||
allocations_data[allocation_name][field_key] = 0
|
||||
allocations_data[allocation_name][f"{field_key}_odenis"] = 0
|
||||
|
||||
# Получаем полное название статьи по сокращенному name
|
||||
tax_article_name = item['tax_article']
|
||||
|
|
@ -52,7 +53,8 @@ def get_data(filters):
|
|||
# Проверяем есть ли маппинг для полного названия
|
||||
if full_article_name in tax_articles_mapping:
|
||||
field_key = tax_articles_mapping[full_article_name]
|
||||
allocations_data[allocation_name][field_key] += flt(item['allocated_amount'])
|
||||
allocations_data[allocation_name][field_key] += flt(item['amount'])
|
||||
allocations_data[allocation_name][f"{field_key}_odenis"] += flt(item['allocated_amount'])
|
||||
|
||||
# Конвертируем в список и сортируем
|
||||
data = list(allocations_data.values())
|
||||
|
|
@ -95,8 +97,8 @@ def get_vat_allocation_items(filters):
|
|||
# Только submitted документы
|
||||
conditions.append("va.docstatus = 1")
|
||||
|
||||
# Только строки с allocated_amount > 0
|
||||
conditions.append("vasi.allocated_amount > 0")
|
||||
# Только строки с amount > 0 или allocated_amount > 0
|
||||
conditions.append("(vasi.amount > 0 OR vasi.allocated_amount > 0)")
|
||||
|
||||
# Только строки с tax_article
|
||||
conditions.append("vasi.tax_article IS NOT NULL AND vasi.tax_article != ''")
|
||||
|
|
@ -111,6 +113,7 @@ def get_vat_allocation_items(filters):
|
|||
STR_TO_DATE(CONCAT('01 ', va.month, ' ', va.year), '%%d %%M %%Y') as posting_date,
|
||||
vasi.customer,
|
||||
vasi.tax_article,
|
||||
vasi.amount,
|
||||
vasi.allocated_amount
|
||||
FROM
|
||||
`tabVAT allocation` va
|
||||
|
|
@ -298,7 +301,8 @@ def get_columns():
|
|||
# Получаем маппинг полей к названиям
|
||||
field_to_label = get_field_to_label_mapping()
|
||||
|
||||
# Создаем колонки для каждого поля в правильном порядке
|
||||
# Создаем колонки для каждого поля в правильном порядке.
|
||||
# Для каждой статьи: сумма (amount) и сразу следом ödəniş (allocated_amount).
|
||||
for field_key in sorted(field_to_label.keys()):
|
||||
label = field_to_label[field_key]
|
||||
columns.append({
|
||||
|
|
@ -307,5 +311,11 @@ def get_columns():
|
|||
"fieldtype": "Currency",
|
||||
"width": 120
|
||||
})
|
||||
columns.append({
|
||||
"label": f"{label} Ödəniş",
|
||||
"fieldname": f"{field_key}_odenis",
|
||||
"fieldtype": "Currency",
|
||||
"width": 120
|
||||
})
|
||||
|
||||
return columns
|
||||
|
|
|
|||
Loading…
Reference in New Issue