updated vat allocation previous month work
This commit is contained in:
parent
9b8f9abf66
commit
7097d61c6e
|
|
@ -163,7 +163,7 @@
|
|||
"index_web_pages_for_search": 1,
|
||||
"is_submittable": 1,
|
||||
"links": [],
|
||||
"modified": "2025-10-07 14:10:17.385408",
|
||||
"modified": "2026-01-15 15:22:24.103624",
|
||||
"modified_by": "Administrator",
|
||||
"module": "Taxes Az",
|
||||
"name": "VAT allocation",
|
||||
|
|
@ -171,6 +171,7 @@
|
|||
"owner": "Administrator",
|
||||
"permissions": [
|
||||
{
|
||||
"cancel": 1,
|
||||
"create": 1,
|
||||
"delete": 1,
|
||||
"email": 1,
|
||||
|
|
@ -180,10 +181,12 @@
|
|||
"report": 1,
|
||||
"role": "System Manager",
|
||||
"share": 1,
|
||||
"submit": 1,
|
||||
"write": 1
|
||||
}
|
||||
],
|
||||
"row_format": "Dynamic",
|
||||
"sort_field": "creation",
|
||||
"sort_order": "DESC",
|
||||
"states": []
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -407,8 +407,13 @@ def get_sales_invoice_items_previous_months(year, month, customers=None, min_amo
|
|||
if customers and len(customers) > 0:
|
||||
customer_list = [c.get('customer') for c in customers if c.get('customer')]
|
||||
|
||||
# Find all previous VAT Allocation documents
|
||||
# We need to find documents where (year < current_year) OR (year == current_year AND month < current_month)
|
||||
# Chain Logic Implementation:
|
||||
# Get ONLY the immediately previous VAT Allocation document (LIMIT 1).
|
||||
# The query below (lines 434-445) fetches from BOTH child tables:
|
||||
# - sales_invoice_table (last month's current items, if unpaid)
|
||||
# - sales_invoice_previous_table (older months' items, if unpaid)
|
||||
# This creates a "chain" where each month inherits the complete unpaid state
|
||||
# from the previous month, preventing double-counting.
|
||||
vat_allocations = frappe.db.sql("""
|
||||
SELECT name, year, month
|
||||
FROM `tabVAT allocation`
|
||||
|
|
@ -418,6 +423,7 @@ def get_sales_invoice_items_previous_months(year, month, customers=None, min_amo
|
|||
OR (year = %(year)s AND month < %(month)s)
|
||||
)
|
||||
ORDER BY year DESC, month DESC
|
||||
LIMIT 1
|
||||
""", {
|
||||
'year': year,
|
||||
'month': month_number
|
||||
|
|
|
|||
File diff suppressed because it is too large
Load Diff
Loading…
Reference in New Issue