Skip to content

Commit

Permalink
feat(Statement of Fees and Payments): link Organization (LAN-844)
Browse files Browse the repository at this point in the history
  • Loading branch information
barredterra committed Sep 3, 2024
1 parent 5cd1ab9 commit afc29c1
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 13 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
"customer_name",
"column_break_ur9om",
"year_of_settlement",
"organization",
"section_break_ksfci",
"billing_address",
"billing_address_display",
Expand Down Expand Up @@ -142,11 +143,19 @@
"fieldtype": "Small Text",
"label": "Billing Address Display",
"read_only": 1
},
{
"fetch_from": "customer.organization",
"fieldname": "organization",
"fieldtype": "Link",
"label": "Organization",
"options": "Organization",
"read_only": 1
}
],
"is_submittable": 1,
"links": [],
"modified": "2024-09-03 20:26:47.382849",
"modified": "2024-09-03 20:32:40.153494",
"modified_by": "Administrator",
"module": "LANDA Sales",
"name": "Statement of Fees and Payments",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,18 +16,21 @@ def before_save(self):
self.calculate_totals()

def validate(self):
if (
existing := frappe.db.exists(
"Statement of Fees and Payments",
{
"customer": self.customer,
"company": self.company,
"year_of_settlement": self.year_of_settlement,
"docstatus": ("!=", DocStatus.cancelled()),
"name": ("!=", self.name),
},
)
and self.docstatus != DocStatus.cancelled()
if self.docstatus == DocStatus.cancelled():
return

if not self.organization:
frappe.throw(_("This Statement of Fees and Payments must be linked to an Organization"))

if existing := frappe.db.exists(
"Statement of Fees and Payments",
{
"customer": self.customer,
"company": self.company,
"year_of_settlement": self.year_of_settlement,
"docstatus": ("!=", DocStatus.cancelled()),
"name": ("!=", self.name),
},
):
frappe.throw(
_(
Expand Down
1 change: 1 addition & 0 deletions landa/translations/de.csv
Original file line number Diff line number Diff line change
Expand Up @@ -105,3 +105,4 @@ Sum of Sales,Rechnungssumme,
Sum of Payments,Zahlungssumme,
Statement of Fees and Payments,Beitragsabrechnung,
A Statement of Fees and Payments for the same customer and year already exists: {0},Es existiert bereits eine Beitragsabrechnung für denselben Verein und dasselbe Jahr: {0},
This Statement of Fees and Payments must be linked to an Organization,Diese Beitragsabrechnung muss mit einem Verein verknüpft sein,

0 comments on commit afc29c1

Please sign in to comment.