Skip to content

Commit

Permalink
fix(Diagnostic Report): update sales_invoice_status on Sales Invoice …
Browse files Browse the repository at this point in the history
…payment updation
  • Loading branch information
akashkrishna619 committed Feb 28, 2024
1 parent c8429f2 commit 224e0f2
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 13 deletions.
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

0 comments on commit 224e0f2

Please sign in to comment.