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(Diagnostic Report): update sales_invoice_status on Sales Invoice Payment (backport #399) #400

Merged
Merged
Show file tree
Hide file tree
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 @@ -97,7 +97,8 @@
"fieldtype": "Link",
"hidden": 1,
"label": "Sample Collection",
"options": "Sample Collection"
"options": "Sample Collection",
"search_index": 1
},
{
"fieldname": "amended_from",
Expand All @@ -118,6 +119,7 @@
{
"fieldname": "sales_invoice_status",
"fieldtype": "Data",
"is_virtual": 1,
"label": "Sales Invoice Status",
"read_only": 1
},
Expand Down Expand Up @@ -169,7 +171,7 @@
],
"index_web_pages_for_search": 1,
"links": [],
"modified": "2023-10-16 17:53:14.702170",
"modified": "2024-02-19 18:41:30.142285",
"modified_by": "Administrator",
"module": "Healthcare",
"name": "Diagnostic Report",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,9 +30,11 @@ def set_title(self):

def set_reference_details(self):
if self.ref_doctype == "Sales Invoice" and self.docname:
self.sales_invoice_status, self.reference_posting_date = frappe.db.get_value(
"Sales Invoice", self.docname, ["status", "posting_date"]
)
self.reference_posting_date = frappe.db.get_value("Sales Invoice", self.docname, "posting_date")

@property
def sales_invoice_status(self):
return frappe.db.get_value(self.ref_doctype, self.docname, "status")


def diagnostic_report_print(diagnostic_report):
Expand Down
17 changes: 9 additions & 8 deletions healthcare/healthcare/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -1183,14 +1183,15 @@ def create_sample_collection(doc, patient):


def insert_diagnostic_report(doc, patient, sample_collection=None):
diagnostic_report = frappe.new_doc("Diagnostic Report")
diagnostic_report.company = doc.company
diagnostic_report.patient = patient
diagnostic_report.ref_doctype = doc.doctype
diagnostic_report.docname = doc.name
diagnostic_report.practitioner = doc.ref_practitioner
diagnostic_report.sample_collection = sample_collection
diagnostic_report.save(ignore_permissions=True)
if not frappe.db.exists("Diagnostic Report", {"docname": doc.name}):
diagnostic_report = frappe.new_doc("Diagnostic Report")
diagnostic_report.company = doc.company
diagnostic_report.patient = patient
diagnostic_report.ref_doctype = doc.doctype
diagnostic_report.docname = doc.name
diagnostic_report.practitioner = doc.ref_practitioner
diagnostic_report.sample_collection = sample_collection
diagnostic_report.save(ignore_permissions=True)


def insert_observation_and_sample_collection(doc, patient, grp, sample_collection, child=None):
Expand Down
Loading