Skip to Content
เมนู
คุณต้องลงทะเบียนเพื่อโต้ตอบกับคอมมูนิตี้
คำถามนี้ถูกตั้งค่าสถานะ
813 มุมมอง

class HmsPrescription(models.Model):

 _inherit = "prescription.order"


def get_history_patient(self):

cr = self.env.cr

filter = " "


if self.patient_id:

filter += "po.patient_id = " + str(self.id)

if self.prescription_date:

filter += "po.prescription_date = " + str(self.prescription_date)


sql = ("""

SELECT

ha.name,

po.prescription_date,

rp.birthday,

DATE_PART('year', AGE(po.prescription_date, rp.birthday)) AS age_years,

DATE_PART('month', AGE(po.prescription_date, rp.birthday)) AS age_months,

po.keluhan,

po.hasil_pemeriksaan,

po.tindakan_pengobatan

FROM prescription_order po

inner join hms_appointment ha on po.appointment_id = ha.id

INNER JOIN res_partner rp ON po.patient_id = rp.id

INNER JOIN hms_patient hp ON po.patient_id = hp.id

WHERE """ + filter + """;

""")

cr.execute(sql)

data = cr.dictfetchall()


self.env['prescription.order.history'].create(data)

this my query and this bottom code is xpath to view a new tab with a table /tree 




อวตาร
ละทิ้ง
Related Posts ตอบกลับ มุมมอง กิจกรรม
1
มี.ค. 24
36
Students and Faculty Query in pgAdmin แก้ไขแล้ว
3
พ.ย. 23
1985
0
ก.พ. 23
1400
0
ก.ย. 16
4682
0
ก.ย. 15
5469