added new totals to vat allocation
This commit is contained in:
parent
c5fe07a20d
commit
9815fbee02
|
|
@ -1,6 +1,5 @@
|
||||||
{
|
{
|
||||||
"actions": [],
|
"actions": [],
|
||||||
"autoname": "format:VAT-{year}-{month}",
|
|
||||||
"creation": "2025-09-29 19:03:22.767217",
|
"creation": "2025-09-29 19:03:22.767217",
|
||||||
"doctype": "DocType",
|
"doctype": "DocType",
|
||||||
"engine": "InnoDB",
|
"engine": "InnoDB",
|
||||||
|
|
@ -240,7 +239,6 @@
|
||||||
"modified_by": "Administrator",
|
"modified_by": "Administrator",
|
||||||
"module": "Taxes Az",
|
"module": "Taxes Az",
|
||||||
"name": "VAT allocation",
|
"name": "VAT allocation",
|
||||||
"naming_rule": "Expression",
|
|
||||||
"owner": "Administrator",
|
"owner": "Administrator",
|
||||||
"permissions": [
|
"permissions": [
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -8,6 +8,27 @@ import json
|
||||||
ROUNDING_TOLERANCE = Decimal('0.01')
|
ROUNDING_TOLERANCE = Decimal('0.01')
|
||||||
|
|
||||||
class VATallocation(Document):
|
class VATallocation(Document):
|
||||||
|
def autoname(self):
|
||||||
|
"""
|
||||||
|
Generate unique name for the document
|
||||||
|
- For submitted documents or first draft: VAT-{year}-{month}
|
||||||
|
- For additional drafts: VAT-{year}-{month}-{counter}
|
||||||
|
"""
|
||||||
|
if not self.year or not self.month:
|
||||||
|
frappe.throw(_("Year and Month are required"))
|
||||||
|
|
||||||
|
base_name = f"VAT-{self.year}-{self.month}"
|
||||||
|
|
||||||
|
# Check if base name already exists
|
||||||
|
if frappe.db.exists('VAT allocation', base_name):
|
||||||
|
# Add counter for additional drafts
|
||||||
|
counter = 1
|
||||||
|
while frappe.db.exists('VAT allocation', f"{base_name}-{counter}"):
|
||||||
|
counter += 1
|
||||||
|
self.name = f"{base_name}-{counter}"
|
||||||
|
else:
|
||||||
|
self.name = base_name
|
||||||
|
|
||||||
def validate(self):
|
def validate(self):
|
||||||
# Check if document with same year and month already exists
|
# Check if document with same year and month already exists
|
||||||
self.validate_unique_year_month()
|
self.validate_unique_year_month()
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue