Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
18 commits
Select commit Hold shift + click to select a range
a0f2c85
fix: resolve lease status before the active-lease limit check
av-dev2 Aug 27, 2026
38ff88b
fix: store the real parent DocType on invoice schedule rows
av-dev2 Aug 27, 2026
46b08de
fix: guard the final invoice flush and surface batch failures
av-dev2 Aug 27, 2026
9d630de
fix: run the lease query through the query builder
av-dev2 Aug 27, 2026
f1c20db
fix: skip the label row when computing withholding tax
av-dev2 Aug 27, 2026
5e9487e
fix: repair the Service Type filter syntax
av-dev2 Aug 27, 2026
3831534
fix: read item_name from Sales Invoice Item
av-dev2 Aug 27, 2026
81681d9
fix: give Daily Checklist a usable naming series
av-dev2 Aug 27, 2026
22b4c48
fix: give Outsourcing Attendance a usable naming series
av-dev2 Aug 27, 2026
ffef2da
fix: give Security Attendance a usable naming series
av-dev2 Aug 27, 2026
f8284be
fix: name the tree dialog field after the Property autoname field
av-dev2 Aug 27, 2026
552f6eb
fix: format the stock shortage message with placeholders
av-dev2 Aug 27, 2026
21a442c
fix: parameterise the Rent Invoices Details queries
av-dev2 Aug 27, 2026
e42f8e6
fix: parameterise the Rent Invoices Details USD queries
av-dev2 Aug 27, 2026
84855e4
fix: parameterise the Invoice Details rate lookup
av-dev2 Aug 27, 2026
e71f45e
fix: parameterise the Utility Invoices rate lookup
av-dev2 Aug 27, 2026
a5a1b93
Merge remote-tracking branch 'upstream/version-16-hotfix' into pr77-fix
av-dev2 Sep 3, 2026
c535571
Merge branch 'version-16-hotfix' into fix/report-sql-injection
av-dev2 Sep 3, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion propms/auto_custom.py
Original file line number Diff line number Diff line change
Expand Up @@ -428,7 +428,7 @@ def makeInvoiceSchedule(
doctype="Lease Invoice Schedule",
parent=name,
parentfield="lease_invoice_schedule",
parenttype="lease",
parenttype="Lease",
date_to_invoice=date_to_invoice,
schedule_start_date=date,
lease_item=item,
Expand Down
6 changes: 5 additions & 1 deletion propms/lease_invoice.py
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,8 @@ def makeInvoice(
doc.submit()

return doc
except frappe.ValidationError:
raise
except Exception as e:
app_error_log(frappe.session.user, str(e))

Expand Down Expand Up @@ -147,7 +149,6 @@ def leaseInvoiceAutoCreate():
"invoice_number",
"sales_order_number",
"parent",
"parent",
"invoice_item_group",
"lease_item",
"paid_by",
Expand Down Expand Up @@ -260,6 +261,8 @@ def leaseInvoiceAutoCreate():
prev_currency = invoice_item.currency
row_num += 1 # increment by 1
# Create the last invoice
if not invoice_item:
return
res = makeInvoice(
invoice_item.date_to_invoice,
invoice_item.paid_by,
Expand All @@ -285,6 +288,7 @@ def leaseInvoiceAutoCreate():
frappe.msgprint(_("Lease Invoice generated with number: {0}").format(res.name))

except Exception as e:
frappe.log_error(frappe.get_traceback(), "Lease Invoice Auto Create failed")
app_error_log(frappe.session.user, str(e))


Expand Down
6 changes: 3 additions & 3 deletions propms/lease_invoice_schedule.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ def make_lease_invoice_schedule():
# Only check start_date, ignore end_date for inclusion
)
)
lease_names = [row[0] for row in frappe.db.sql(query.get_sql())]
lease_names = [row[0] for row in query.run()]

for lease_name in lease_names:
try:
Expand Down Expand Up @@ -145,8 +145,8 @@ def make_lease_invoice_schedule():
# Move to first day of next period
invoice_date = add_days(invoice_period_end, 1)

frappe.msgprint(_(f"Completed invoice schedule for Lease: {lease.name}"))
frappe.msgprint(_("Completed invoice schedule for Lease: {0}").format(lease.name))

except Exception as e:
frappe.msgprint(_(f"Error in {lease_name}. Check app error log."))
frappe.msgprint(_("Error in {0}. Check app error log.").format(lease_name))
app_error_log(frappe.session.user, f"{lease_name}: {str(e)}")
Original file line number Diff line number Diff line change
Expand Up @@ -221,15 +221,16 @@
"collapsible": 0,
"columns": 0,
"fieldname": "naming_series",
"fieldtype": "Data",
"fieldtype": "Select",
"hidden": 0,
"ignore_user_permissions": 0,
"ignore_xss_filter": 0,
"in_filter": 0,
"in_global_search": 0,
"in_list_view": 0,
"in_standard_filter": 0,
"label": "naming_series",
"label": "Naming Series",
"options": "DC-.YYYY.-",
"length": 0,
"no_copy": 0,
"permlevel": 0,
Expand All @@ -239,9 +240,9 @@
"read_only": 0,
"remember_last_selected_value": 0,
"report_hide": 0,
"reqd": 0,
"reqd": 1,
"search_index": 0,
"set_only_once": 0,
"set_only_once": 1,
"translatable": 0,
"unique": 0
}
Expand All @@ -257,7 +258,7 @@
"issingle": 0,
"istable": 0,
"max_attachments": 0,
"modified": "2018-12-24 19:42:26.306039",
"modified": "2026-08-27 12:00:00.000000",
"modified_by": "Administrator",
"module": "Property Management Solution",
"name": "Daily Checklist",
Expand Down
26 changes: 24 additions & 2 deletions propms/property_management_solution/doctype/lease/lease.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ def on_submit(self):
app_error_log(frappe.session.user, str(e))

def validate(self):
self.set_lease_status()
self.validate_days_to_invoice_in_advance()
try:
properties = self.get_all_properties()
Expand Down Expand Up @@ -119,7 +120,28 @@ def validate(self):
raise
except Exception as e:
app_error_log(frappe.session.user, str(e))
self.set_lease_status()

def validate_days_to_invoice_in_advance(self):
"""Prevent changing 'Days to Invoice in Advance' once invoices have been generated."""
if not self.is_new() and self.has_value_changed("days_to_invoice_in_advance"):
has_generated_invoices = any(
row.invoice_number or row.sales_order_number for row in (self.lease_invoice_schedule or [])
)
if not has_generated_invoices:
has_generated_invoices = frappe.db.exists(
"Lease Invoice Schedule",
{
"parent": self.name,
"invoice_number": ["is", "set"],
},
)
if has_generated_invoices:
frappe.throw(
_(
"Cannot change 'Days to Invoice in Advance' after invoices have been generated for this Lease."
),
title=_("Field Read Only"),
)

def validate_days_to_invoice_in_advance(self):
"""Prevent changing 'Days to Invoice in Advance' once invoices have been generated."""
Expand Down Expand Up @@ -153,7 +175,7 @@ def set_lease_status(self):
All other statuses are considered manual and are not overwritten.
"""

if self.lease_status not in get_system_controlled_statuses():
if self.lease_status and self.lease_status not in get_system_controlled_statuses():
return

status = get_status_for_lease(self)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -154,27 +154,28 @@
"collapsible": 0,
"columns": 0,
"fieldname": "naming_series",
"fieldtype": "Data",
"hidden": 1,
"fieldtype": "Select",
"hidden": 0,
"ignore_user_permissions": 0,
"ignore_xss_filter": 0,
"in_filter": 0,
"in_global_search": 0,
"in_list_view": 0,
"in_standard_filter": 0,
"label": "naming_series",
"label": "Naming Series",
"options": "OA-.YYYY.-",
"length": 0,
"no_copy": 0,
"permlevel": 0,
"precision": "",
"print_hide": 1,
"print_hide_if_no_value": 0,
"read_only": 1,
"read_only": 0,
"remember_last_selected_value": 0,
"report_hide": 0,
"reqd": 0,
"reqd": 1,
"search_index": 0,
"set_only_once": 0,
"set_only_once": 1,
"translatable": 0,
"unique": 0
},
Expand Down Expand Up @@ -222,7 +223,7 @@
"issingle": 0,
"istable": 0,
"max_attachments": 0,
"modified": "2019-01-16 15:54:32.839686",
"modified": "2026-08-27 12:00:00.000000",
"modified_by": "Administrator",
"module": "Property Management Solution",
"name": "Outsourcing Attendance",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ frappe.treeview_settings["Property"] = {
],

fields: [
{ fieldtype: "Data", fieldname: "property_name", label: __("New Property Name"), reqd: true },
{ fieldtype: "Data", fieldname: "name1", label: __("New Property Name"), reqd: true },
{
fieldtype: "Check",
fieldname: "is_group",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,15 +43,18 @@
},
{
"fieldname": "naming_series",
"fieldtype": "Data",
"label": "naming_series",
"fieldtype": "Select",
"hidden": 0,
"label": "Naming Series",
"options": "SA-.YYYY.-",
"print_hide": 1,
"read_only": 1
"reqd": 1,
"set_only_once": 1
}
],
"icon": "octicon octicon-clippy",
"is_submittable": 1,
"modified": "2019-12-05 16:49:29.347921",
"modified": "2026-08-27 12:00:00.000000",
"modified_by": "Administrator",
"module": "Property Management Solution",
"name": "Security Attendance",
Expand Down Expand Up @@ -99,4 +102,4 @@
"sort_field": "modified",
"sort_order": "DESC",
"track_changes": 1
}
}
Loading
Loading