콘텐츠로 건너뛰기
메뉴
커뮤니티에 참여하려면 회원 가입을 하시기 바랍니다.
신고된 질문입니다

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 




아바타
취소
관련 게시물 답글 화면 활동
1
3월 24
36
3
11월 23
2018
0
2월 23
1440
0
9월 16
4712
0
9월 15
5488