Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(FnF): don't fetch outstanding statements on every save #797

Merged
merged 4 commits into from
Aug 23, 2023
Merged
Changes from all commits
Commits
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
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,11 @@


class FullandFinalStatement(Document):
def validate(self):
def before_insert(self):
self.get_outstanding_statements()
ruchamahabal marked this conversation as resolved.
Show resolved Hide resolved

def validate(self):
self.get_assets_statements()
if self.docstatus == 1:
self.validate_settlement("payables")
self.validate_settlement("receivables")
Expand All @@ -34,15 +37,17 @@ def get_outstanding_statements(self):
if not len(self.get("receivables", [])):
components = self.get_receivable_component()
self.create_component_row(components, "receivables")

if not len(self.get("assets_allocated", [])):
for data in self.get_assets_movement():
self.append("assets_allocated", data)
self.get_assets_statements()
else:
frappe.throw(
_("Set Relieving Date for Employee: {0}").format(get_link_to_form("Employee", self.employee))
)

def get_assets_statements(self):
if not len(self.get("assets_allocated", [])):
for data in self.get_assets_movement():
self.append("assets_allocated", data)

def create_component_row(self, components, component_type):
for component in components:
self.append(
Expand Down
Loading