Selaa lähdekoodia

update gilang add folder

gilangmy 3 vuotta sitten
vanhempi
commit
e955025719

BIN
klinik/__pycache__/__init__.cpython-37.pyc Näytä tiedosto


BIN
klinik/models/__pycache__/__init__.cpython-37.pyc Näytä tiedosto


BIN
klinik/models/__pycache__/klinik.cpython-37.pyc Näytä tiedosto


+ 13
- 1
klinik/models/klinik.py Näytä tiedosto

@@ -14,6 +14,18 @@ class KlinikPasien(models.Model):
14 14
 class KlinikDokter(models.Model):
15 15
     _name = "klinik.dokter"
16 16
 
17
-    name = fields.Char()
17
+    name = fields.Char(string='Nama Dokter')
18
+    spesialis = fields.Many2one("klinik.spesialis", string='Spesialis Dokter')
19
+    alamat = fields.Char(string='Alamat')
20
+    jenis_kelamin = fields.Selection([
21
+        ('pria','Laki laki'),
22
+        ('wanita','Wanita'),
23
+    ])
24
+
25
+class KlinikSpesialis(models.Model):
26
+    _name = "klinik.spesialis"
27
+
28
+    spesialis = fields.Char(string='Spesialis Dokter')
29
+    name = fields.Char(string='Nama Dokter')
18 30
 
19 31
         

+ 3
- 1
klinik/security/ir.model.access.csv Näytä tiedosto

@@ -1,2 +1,4 @@
1 1
 id,name,model_id:id,group_id:id,perm_read,perm_write,perm_create,perm_unlink
2
-access_pasien_user,access.pasien.user,model_klinik_pasien,,1,1,1,1
2
+access_pasien_user,access.pasien.user,model_klinik_pasien,,1,1,1,1
3
+access_dokter_user,access.dokter.user,model_klinik_dokter,,1,1,1,1
4
+access_spesialis_user,access.spesialis.user,model_klinik_spesialis,,1,1,1,1

+ 100
- 0
klinik/views/klinik_view.xml Näytä tiedosto

@@ -46,4 +46,104 @@
46 46
             name="Pasien" parent="klinik_menu_root" 
47 47
             action="klinik_pasien_action"/>
48 48
 	</data>
49
+
50
+<!-- Dokter -->
51
+	<data>
52
+		<record id="dokter_view_form" model="ir.ui.view">
53
+			<field name="name">dokter_view_form</field>
54
+			<field name="model">klinik.dokter</field>
55
+			<field name="arch" type="xml">
56
+				<form>
57
+					<sheet>
58
+						<group>
59
+							<group>
60
+								<field name="name"/>
61
+								<field name="spesialis"/>
62
+								<field name="alamat"/>
63
+								<field name="jenis_kelamin"/>
64
+							</group>
65
+						</group>
66
+						
67
+					</sheet>
68
+				</form>
69
+			</field>
70
+		</record>
71
+
72
+		<record id="dokter_view_tree" model="ir.ui.view">
73
+			<field name="name">dokter_view_tree</field>
74
+			<field name="model">klinik.dokter</field>
75
+			<field name="arch" type="xml">
76
+				<tree>
77
+					<field name="name"/>
78
+					<field name="spesialis"/>
79
+					<field name="alamat"/>
80
+					<field name="jenis_kelamin"/>
81
+				</tree>
82
+			</field>
83
+		</record>
84
+
85
+		<record model="ir.actions.act_window" id="klinik_dokter_action">
86
+            <field name="name">Dokter</field>
87
+            <field name="res_model">klinik.dokter</field>
88
+            <field name="view_mode">tree,form</field>
89
+        </record>
90
+
91
+
92
+		<menuitem
93
+            id="klinik_menu_root"
94
+            name="Klinik"/>
95
+
96
+        <menuitem
97
+            id="klinik_menu_dokter"
98
+            name="Dokter" parent="klinik_menu_root" 
99
+            action="klinik_dokter_action"/>
100
+	</data>
101
+
102
+<!-- Spesialis -->
103
+	<data>
104
+		<record id="spesialis_view_form" model="ir.ui.view">
105
+			<field name="name">spesialis_view_form</field>
106
+			<field name="model">klinik.spesialis</field>
107
+			<field name="arch" type="xml">
108
+				<form>
109
+					<sheet>
110
+						<group>
111
+							<group>
112
+								<field name="spesialis"/>
113
+								<field name="name"/>
114
+							</group>
115
+						</group>
116
+						
117
+					</sheet>
118
+				</form>
119
+			</field>
120
+		</record>
121
+
122
+		<record id="spesialis_view_tree" model="ir.ui.view">
123
+			<field name="name">spesialis_view_tree</field>
124
+			<field name="model">klinik.spesialis</field>
125
+			<field name="arch" type="xml">
126
+				<tree>
127
+					<field name="spesialis"/>
128
+					<field name="name"/>
129
+				</tree>
130
+			</field>
131
+		</record>
132
+
133
+		<record model="ir.actions.act_window" id="klinik_spesialis_action">
134
+            <field name="name">Spesialis</field>
135
+            <field name="res_model">klinik.spesialis</field>
136
+            <field name="view_mode">tree,form</field>
137
+        </record>
138
+
139
+
140
+		<menuitem
141
+            id="klinik_menu_root"
142
+            name="Klinik"/>
143
+
144
+        <menuitem
145
+            id="klinik_menu_spesialis"
146
+            name="Spesialis" parent="klinik_menu_root" 
147
+            action="klinik_spesialis_action"/>
148
+	</data>
49 149
 </odoo>

+ 2
- 0
pukesmas/ms_puskesmas/__init__.py Näytä tiedosto

@@ -0,0 +1,2 @@
1
+import models
2
+import wizard

+ 35
- 0
pukesmas/ms_puskesmas/__manifest__.py Näytä tiedosto

@@ -0,0 +1,35 @@
1
+{
2
+    "name"          : "Tutorial Odoo Indonesia",
3
+    "version"       : "1.0",
4
+    "author"        : "Miftahussalam",
5
+    "website"       : "http://miftahussalam.com",
6
+    "category"      : "New Module",
7
+    "summary"       : "Belajar Membuat Addons",
8
+    "description"   : """
9
+        Belajar membuat addons di odoo 10 menggunakan studi kasus puskesmas
10
+    """,
11
+    "depends"       : [
12
+        "product",
13
+        "account",
14
+        "ms_base",
15
+    ],
16
+    "data"          : [
17
+        "views/res_partner.xml",
18
+        "views/ms_poli.xml",
19
+        "views/ms_pendaftaran.xml",
20
+        "views/ms_pemeriksaan.xml",
21
+        "views/product_template.xml",
22
+        "views/account_invoice.xml",
23
+        "wizard/ms_reason_cancel_wizard.xml",
24
+        "report/report_resepobat.xml",
25
+        "security/ir.model.access.csv",
26
+    ],
27
+    "demo"          : [],
28
+    "test"          : [],
29
+    "images"        : [],
30
+    "qweb"          : [],
31
+    "css"           : [],
32
+    "application"   : True,
33
+    "installable"   : True,
34
+    "auto_install"  : False,
35
+}

+ 4
- 0
pukesmas/ms_puskesmas/models/__init__.py Näytä tiedosto

@@ -0,0 +1,4 @@
1
+import res_partner
2
+import ms_poli
3
+import ms_pendaftaran
4
+import ms_pemeriksaan

+ 99
- 0
pukesmas/ms_puskesmas/models/ms_pemeriksaan.py Näytä tiedosto

@@ -0,0 +1,99 @@
1
+from odoo import api, fields, models
2
+from datetime import datetime
3
+
4
+class ms_pemeriksaan(models.Model):
5
+    _name = "ms.pemeriksaan"
6
+    _description = "Pemeriksaan"
7
+    _order = "name desc"
8
+    
9
+    @api.one
10
+    @api.depends('pasien_id')
11
+    def _get_usia(self):
12
+        usia = False
13
+        if self.pasien_id :
14
+            usia = datetime.now().year - datetime.strptime(self.pasien_id.tgl_lahir , '%Y-%m-%d').year
15
+        self.usia = usia
16
+
17
+    name = fields.Char(string='Pemeriksaan', default='/')
18
+    state = fields.Selection([
19
+         ('draft','Draft'),
20
+         ('confirm','Confirmed'),
21
+         ('cancel','Cancelled')
22
+    ], string='State', default='draft')
23
+    pendaftaran_id = fields.Many2one('ms.pendaftaran', 'Pendaftaran')
24
+    tanggal = fields.Datetime(string='Tanggal', default=fields.Datetime.now())
25
+    pasien_id = fields.Many2one(related='pendaftaran_id.pasien_id', string='Pasien')
26
+    jenis_kelamin = fields.Selection(related='pendaftaran_id.pasien_id.jenis_kelamin', string='Jenis Kelamin')
27
+    usia = fields.Integer(compute='_get_usia', string='Usia')
28
+    poli_id = fields.Many2one(related='pendaftaran_id.poli_id', string='Poli')
29
+    dokter_id = fields.Many2one('res.partner', string='Dokter')
30
+    keluhan = fields.Text(string='Keluhan')
31
+    hasil = fields.Text(string='Hasil Pemeriksaan')
32
+    tindakan = fields.Text(string='Tindakan Pengobatan')
33
+    resep_line = fields.One2many('ms.resep.obat', 'pemeriksaan_id', 'Resep Obat')
34
+    
35
+    @api.model
36
+    def create(self, vals):
37
+        vals['name'] = self.env['ir.sequence'].get_sequence('Pemeriksaan','ms.pemeriksaan','PMR/%(y)s/',5)
38
+        return super(ms_pemeriksaan, self).create(vals)
39
+    
40
+    @api.multi
41
+    def action_confirm(self):
42
+        for me_id in self :
43
+            if me_id.state == 'draft':
44
+                inv_line_vals = []
45
+                for line in me_id.resep_line :
46
+                    inv_line_vals.append((0,0,{
47
+                        'product_id': line.product_id.id,
48
+                        'name': line.product_id.name_get()[0][1],
49
+                        'quantity': line.qty,
50
+                        'price_unit': line.product_id.lst_price,
51
+                        'account_id': me_id.pasien_id.property_account_payable_id.id,
52
+                    }))
53
+                self.env['account.invoice'].create({
54
+                    'partner_id': me_id.pasien_id.id,
55
+                    'invoice_line_ids': inv_line_vals,
56
+                })
57
+                me_id.write({'state':'confirm'})
58
+    
59
+    @api.multi
60
+    def action_cancel(self):
61
+        view_id = self.env.ref('ms_puskesmas.view_ms_reason_cancel_wizard')
62
+        return {
63
+            'name': 'Reason Cancel',
64
+            'type': 'ir.actions.act_window',
65
+            'view_type': 'form',
66
+            'view_mode': 'form',
67
+            'res_model': 'ms.reason.cancel.wizard',
68
+            'views': [(view_id.id, 'form')],
69
+            'view_id': view_id.id,
70
+            'target': 'new',
71
+        }
72
+    
73
+    @api.multi
74
+    def unlink(self):
75
+        for me_id in self :
76
+            if me_id.state != 'draft' :
77
+                raise Warning("Tidak bisa menghapus data pendaftaran yang bukan draft !")
78
+        return super(ms_pemeriksaan, self).unlink()
79
+    
80
+class ms_resep_obat(models.Model):
81
+    _name = "ms.resep.obat"
82
+    _description = "Resep Obat"
83
+    _rec_name = "product_id"
84
+    
85
+    pemeriksaan_id = fields.Many2one('ms.pemeriksaan', 'Pemeriksaan')
86
+    product_id = fields.Many2one('product.product', 'Obat', required="1")
87
+    aturan_minum = fields.Char('Aturan Minum')
88
+    waktu_minum = fields.Selection([
89
+         ('sebelum','Sebelum'),
90
+         ('sesudah','Sesudah'),
91
+    ], 'Sebelum/Sesudah Makan', default='sesudah')
92
+    qty = fields.Float('Quantity')
93
+    satuan_id = fields.Many2one('product.uom', 'Satuan')
94
+    
95
+    @api.onchange('product_id')
96
+    def change_product(self):
97
+        if self.product_id :
98
+            self.satuan_id = self.product_id.uom_id.id
99
+    

+ 71
- 0
pukesmas/ms_puskesmas/models/ms_pendaftaran.py Näytä tiedosto

@@ -0,0 +1,71 @@
1
+from odoo import api, fields, models
2
+from odoo.exceptions import Warning
3
+import unicodedata
4
+
5
+class ms_pendaftaran(models.Model):
6
+    _name = "ms.pendaftaran"
7
+    _description = "Pendaftaran"
8
+    _order = "name desc"
9
+    
10
+    name = fields.Char(string='Pendaftaran', default='/')
11
+    state = fields.Selection([
12
+         ('draft','Draft'),
13
+         ('confirm','Confirmed'),
14
+         ('cancel','Cancelled')
15
+    ], string='State', default='draft')
16
+    pasien_id = fields.Many2one('res.partner', domain=[('pasien','=',True)], string='Pasien')
17
+    poli_id = fields.Many2one('ms.poli', string='Poli yang Dituju')
18
+    tanggal = fields.Datetime(string='Tanggal', default=fields.Datetime.now())
19
+    note = fields.Html(string='Note')
20
+    
21
+    @api.model
22
+    def create(self, vals):
23
+        vals['name'] = self.env['ir.sequence'].get_sequence('Pendaftaran','ms.pendaftaran','DFT/%(y)s/',5)
24
+        return super(ms_pendaftaran, self).create(vals)
25
+    
26
+    @api.multi
27
+    def name_get(self):
28
+        result = []
29
+        for me_id in self :
30
+            result.append((me_id.id, "%s - %s" % (me_id.name, me_id.pasien_id.name)))
31
+        return result
32
+    
33
+    @api.model
34
+    def name_search(self, name, args=None, operator='ilike', limit=100):
35
+        args = args or []
36
+        if name :
37
+            recs = self.search([
38
+                '|',
39
+                ('pasien_id.name', operator, name),
40
+                ('name', operator, name),
41
+            ] + args, limit=limit)
42
+        else :
43
+            recs = self.search([] + args, limit=limit)
44
+        return recs.name_get()
45
+    
46
+    @api.multi
47
+    def action_confirm(self):
48
+        for me_id in self :
49
+            if me_id.state == 'draft':
50
+                self.env['ms.pemeriksaan'].create({'pendaftaran_id':me_id.id})
51
+                me_id.write({'state':'confirm'})
52
+    
53
+    @api.multi
54
+    def action_cancel(self):
55
+        for me_id in self :
56
+            pemeriksaan_ids = self.env['ms.pemeriksaan'].search([
57
+                ('pendaftaran_id','=',me_id.id),
58
+                ('state','!=','cancel')
59
+            ])
60
+            if pemeriksaan_ids :
61
+                pemeriksaan_names = [unicodedata.normalize('NFKD', pemeriksaan.name).encode('ascii','ignore') for pemeriksaan in pemeriksaan_ids]
62
+                raise Warning("Silahkan cancel pemeriksaan %s terlebih dahulu !"%pemeriksaan_names)
63
+            me_id.write({'state':'cancel'})
64
+    
65
+    @api.multi
66
+    def unlink(self):
67
+        for me_id in self :
68
+            if me_id.state != 'draft' :
69
+                raise Warning("Tidak bisa menghapus data pendaftaran yang bukan draft !")
70
+        return super(ms_pendaftaran, self).unlink()
71
+    

+ 33
- 0
pukesmas/ms_puskesmas/models/ms_poli.py Näytä tiedosto

@@ -0,0 +1,33 @@
1
+from odoo import fields, api, models
2
+
3
+class ms_poli(models.Model):
4
+    _name = "ms.poli"
5
+    _description = "Poli"
6
+    
7
+    name = fields.Char('Nama Poli', required=True)
8
+    kode = fields.Char('Kode Poli', required=True, copy=False)
9
+    
10
+    _sql_constraints = [
11
+        ('unique_kode', 'unique(kode)', 'Kode Poli duplicate, mohon cek kembali !'),
12
+    ]
13
+    
14
+    @api.multi
15
+    def name_get(self):
16
+        result = []
17
+        for me in self :
18
+            result.append((me.id, "%s - %s" % (me.kode, me.name)))
19
+        return result
20
+    
21
+    @api.model
22
+    def name_search(self, name, args=None, operator='ilike', limit=100):
23
+        args = args or []
24
+        if name :
25
+            recs = self.search([
26
+                '|',
27
+                ('kode', operator, name),
28
+                ('name', operator, name),
29
+            ] + args, limit=limit)
30
+        else :
31
+            recs = self.search([] + args, limit=limit)
32
+        return recs.name_get()
33
+    

+ 68
- 0
pukesmas/ms_puskesmas/models/res_partner.py Näytä tiedosto

@@ -0,0 +1,68 @@
1
+from odoo import api, fields, models
2
+
3
+class res_partner(models.Model):
4
+    _inherit = "res.partner"
5
+    
6
+    dokter = fields.Boolean(string='Dokter')
7
+    pasien = fields.Boolean(string='Pasien')
8
+    kode = fields.Char(string='Kode', default='/')
9
+    name = fields.Char(string='Nama')
10
+    pekerjaan = fields.Selection([
11
+        ('pelajar_mhs','Pelajar/Mahasiswa'),
12
+        ('pegawai_negeri','Pegawai Negeri'),
13
+        ('abri','ABRI'),
14
+        ('swasta','Swasta'),
15
+        ('lain','Lain-Lain'),
16
+    ], string='Pekerjaan')
17
+    nama_pekerjaan = fields.Char('Nama Pekerjaan')
18
+    jenis_kelamin = fields.Selection([('laki','Laki-Laki'),('perempuan','Perempuan')], string='Jenis Kelamin')
19
+    tgl_lahir = fields.Date('Tanggal Lahir')
20
+    gol_darah = fields.Selection([
21
+        ('a','A'),
22
+        ('b','B'),
23
+        ('ab','AB'),
24
+        ('o','O'),
25
+    ], string='Golongan Darah')
26
+    status = fields.Selection([
27
+        ('lajang','Lajang'),
28
+        ('menikah','Menikah'),
29
+        ('duda','Duda'),
30
+        ('janda','Janda'),
31
+    ], string='Status')
32
+    history_pasien = fields.One2many('ms.pemeriksaan', 'pasien_id', 'History Pasien')
33
+    history_dokter = fields.One2many('ms.pemeriksaan', 'dokter_id', 'History Dokter')
34
+    
35
+    _sql_constraints = [
36
+        ('unique_kode', 'unique(kode,name)', 'Kombinasi kode dan nama sudah ada, mohon cek kembali !'),
37
+    ]
38
+    
39
+    @api.model
40
+    def create(self, vals):
41
+        if vals.get('pasien', False):
42
+            vals['kode'] = self.env['ir.sequence'].get_sequence('Kode Pasien','res.partner','PSN')
43
+        elif vals.get('dokter', False) and ('kode' not in vals or vals.get('kode', False) == '/'):
44
+            vals['kode'] = self.env['ir.sequence'].get_sequence('Kode Dokter','res.partner','DKT')
45
+        return super(res_partner, self).create(vals)
46
+    
47
+    @api.multi
48
+    def name_get(self):
49
+        result = []
50
+        for me_id in self :
51
+            if me_id.kode and me_id.kode != '/' :
52
+                result.append((me_id.id, "%s - %s" % (me_id.kode, me_id.name)))
53
+            else :
54
+                result.append((me_id.id, me_id.name))
55
+        return result
56
+    
57
+    @api.model
58
+    def name_search(self, name, args=None, operator='ilike', limit=100):
59
+        args = args or []
60
+        if name :
61
+            recs = self.search([
62
+                '|',
63
+                ('kode', operator, name),
64
+                ('name', operator, name),
65
+            ] + args, limit=limit)
66
+        else :
67
+            recs = self.search([] + args, limit=limit)
68
+        return recs.name_get()

+ 89
- 0
pukesmas/ms_puskesmas/report/report_resepobat.xml Näytä tiedosto

@@ -0,0 +1,89 @@
1
+<odoo>
2
+    <data>
3
+
4
+        <template id="report_resepobat_document">
5
+            <t t-call="report.external_layout">
6
+                <t t-set="o" t-value="o.with_context({})"/>
7
+                <div class="page">
8
+                    <div class="oe_structure"/>
9
+
10
+                    <h1 class="text-center">Resep Obat</h1>
11
+
12
+                    <div class="row mt32 mb32">
13
+                        <div t-if="o.name" class="col-xs-3">
14
+                            <strong>Nomor :</strong>
15
+                            <p t-field="o.name"/>
16
+                        </div>
17
+                        <div t-if="o.pasien_id" class="col-xs-3">
18
+                            <strong>Pasien :</strong>
19
+                            <p t-field="o.pasien_id.name"/>
20
+                        </div>
21
+                        <div t-if="o.tanggal" class="col-xs-3">
22
+                            <strong>Tanggal :</strong>
23
+                            <p t-field="o.tanggal"/>
24
+                        </div>
25
+                    </div>
26
+
27
+                    <table class="table table-condensed">
28
+                        <thead>
29
+                            <tr>
30
+                                <th><strong>Obat</strong></th>
31
+                                <th><strong>Aturan Minum</strong></th>
32
+                                <th><strong>Sebelum/Sesudah Makan</strong></th>
33
+                                <th><strong>Quantity</strong></th>
34
+                                <th><strong>Satuan</strong></th>
35
+                            </tr>
36
+                        </thead>
37
+                        <tbody>
38
+                            <tr t-foreach="o.resep_line" t-as="l">
39
+                                <td>
40
+                                    <span t-field="l.product_id.name"/>
41
+                                </td>
42
+                                <td>
43
+                                    <span t-field="l.aturan_minum"/>
44
+                                </td>
45
+                                <td>
46
+                                    <span t-field="l.waktu_minum"/>
47
+                                </td>
48
+                                <td>
49
+                                    <span t-field="l.qty"/>
50
+                                </td>
51
+                                <td>
52
+                                    <span t-field="l.satuan_id.name"/>
53
+                                </td>
54
+                            </tr>
55
+                        </tbody>
56
+                    </table>
57
+
58
+                    <div class="oe_structure"/>
59
+                    
60
+                    <div class="row" name="ttd" style="padding-top:20px;">
61
+                        <div class="col-xs-4" style="text-align:center">
62
+                            <div style="padding-bottom:60px;">Tertanda,</div>
63
+                            <div>   ( <span t-field="user.name"/> )</div>
64
+                        </div>
65
+                    </div>
66
+                    
67
+                </div>
68
+            </t>
69
+        </template>
70
+
71
+        <template id="report_resepobat">
72
+            <t t-call="report.html_container">
73
+                <t t-foreach="docs" t-as="o">
74
+                    <t t-call="ms_puskesmas.report_resepobat_document"/>
75
+                </t>
76
+            </t>
77
+        </template>
78
+
79
+        <report 
80
+            string="Resep Obat" 
81
+            id="cpl_action_report_resepobat" 
82
+            model="ms.pemeriksaan" 
83
+            report_type="qweb-pdf"
84
+            name="ms_puskesmas.report_resepobat" 
85
+            file="ms_puskesmas.report_resepobat" 
86
+        />
87
+
88
+    </data>
89
+</odoo>

+ 5
- 0
pukesmas/ms_puskesmas/security/ir.model.access.csv Näytä tiedosto

@@ -0,0 +1,5 @@
1
+id,name,model_id:id,group_id:id,perm_read,perm_write,perm_create,perm_unlink
2
+access_ms_poli_all,ms_poli all,model_ms_poli,,1,1,1,1
3
+access_ms_pendaftaran_all,ms_pendaftaran all,model_ms_pendaftaran,,1,1,1,1
4
+access_ms_pemeriksaan_all,ms_pemeriksaan all,model_ms_pemeriksaan,,1,1,1,1
5
+access_ms_resep_obat_all,ms_resep_obat all,model_ms_resep_obat,,1,1,1,1

+ 7
- 0
pukesmas/ms_puskesmas/views/account_invoice.xml Näytä tiedosto

@@ -0,0 +1,7 @@
1
+<odoo>
2
+    <data>
3
+        
4
+        <menuitem action="account.action_invoice_tree1" id="ms_pembayaran_menu" name="Pembayaran" parent="ms_base.ms_transaksi_submenu" sequence="30"/>
5
+        
6
+    </data>
7
+</odoo>

+ 132
- 0
pukesmas/ms_puskesmas/views/ms_pemeriksaan.xml Näytä tiedosto

@@ -0,0 +1,132 @@
1
+<odoo>
2
+    <data>
3
+        
4
+        <record model="ir.ui.view" id="ms_pemeriksaan_tree_view">
5
+            <field name="name">ms.pemeriksaan.tree</field>
6
+            <field name="model">ms.pemeriksaan</field>
7
+            <field name="arch" type="xml">
8
+                <tree string="Pemeriksaan">
9
+                    <field name="name"/>
10
+                    <field name="pendaftaran_id"/>
11
+                    <field name="pasien_id"/>
12
+                    <field name="jenis_kelamin"/>
13
+                    <field name="usia"/>
14
+                    <field name="poli_id"/>
15
+                    <field name="dokter_id"/>
16
+                    <field name="state"/>
17
+                </tree>
18
+             </field>
19
+        </record>
20
+        
21
+        <record id="view_ms_pemeriksaan_search" model="ir.ui.view">
22
+            <field name="name">ms.pemeriksaan.search</field>
23
+            <field name="model">ms.pemeriksaan</field>
24
+            <field name="arch" type="xml">
25
+                <search string="Search Pemeriksaan">
26
+                    <field name="name"/>
27
+                    <field name="pendaftaran_id"/>
28
+                    <field name="pasien_id"/>
29
+                    <field name="jenis_kelamin"/>
30
+                    <field name="usia"/>
31
+                    <field name="poli_id"/>
32
+                    <field name="dokter_id"/>
33
+                    <field name="state"/>
34
+                    <filter string="Draft" name="draft" domain="[('state','=','draft')]"/>
35
+                    <filter string="Confirm" name="confirm" domain="[('state','=','confirm')]"/>
36
+                    <group expand="0" string="Group By">
37
+                        <filter name="group_pasien" string="Pasien" domain="[]" context="{'group_by':'pasien_id'}"/>
38
+                        <filter name="group_jenis_kelamin" string="Jenis" domain="[]" context="{'group_by':'jenis_kelamin'}"/>
39
+                        <filter name="group_poli" string="Poli" domain="[]" context="{'group_by':'poli_id'}"/>
40
+                        <filter name="group_dokter" string="Poli" domain="[]" context="{'group_by':'dokter_id'}"/>
41
+                    </group>
42
+                </search>
43
+            </field>
44
+        </record>
45
+        
46
+        <record model="ir.ui.view" id="ms_pemeriksaan_form_view">
47
+            <field name="name">ms.pemeriksaan.form</field>
48
+            <field name="model">ms.pemeriksaan</field>
49
+            <field name="arch" type="xml">
50
+                
51
+                <form string="Pemeriksaan">
52
+                    <header>
53
+                        <button name="action_confirm" string="Confirm" type="object" class="oe_highlight" attrs="{'invisible': [('state','!=','draft')]}"/>
54
+                        <button name="action_cancel" string="Cancel" type="object" attrs="{'invisible': [('state','=','cancel')]}"/>
55
+                        <field name="state" widget="statusbar" statusbar_visible="draft,confirm"/>
56
+                    </header>
57
+                    <sheet>
58
+                        <div class="oe_title">
59
+                            <h1>
60
+                                <field name="name" class="oe_inline" readonly="1"/>
61
+                            </h1>
62
+                        </div>
63
+                        <group col="4">
64
+                            <field name="pendaftaran_id" domain="[('state','in',['confirm'])]" attrs="{'readonly': [('state','!=','draft')]}" required="1" options="{'no_open': True, 'no_create': True}"/>
65
+                            <field name="tanggal" attrs="{'readonly': [('state','!=','draft')]}" required="1"/>
66
+                            <field name="pasien_id" domain="[('pasien','=',True)]" attrs="{'readonly': [('state','!=','draft')]}" required="1" options="{'no_open': True, 'no_create': True}"/>
67
+                            <field name="jenis_kelamin" attrs="{'readonly': [('state','!=','draft')]}" required="1"/>
68
+                            <field name="usia" attrs="{'readonly': [('state','!=','draft')]}" required="1"/>
69
+                            <field name="poli_id" attrs="{'readonly': [('state','!=','draft')]}" required="1" options="{'no_open': True, 'no_create': True}"/>
70
+                            <field name="dokter_id" domain="[('dokter','=',True)]" attrs="{'readonly': [('state','!=','draft')]}" required="1" options="{'no_open': True, 'no_create': True}"/>
71
+                            <field name="keluhan" attrs="{'readonly': [('state','!=','draft')]}" required="1"/>
72
+                            <field name="hasil" attrs="{'readonly': [('state','!=','draft')]}" required="1"/>
73
+                            <field name="tindakan" attrs="{'readonly': [('state','!=','draft')]}" required="1"/>
74
+                        </group>
75
+                        <notebook>
76
+                            <page string="Resep Obat">
77
+                                <field name="resep_line" attrs="{'readonly': [('state','!=','draft')]}">
78
+                                    <tree string="Resep Obat" editable="bottom">
79
+                                        <field name="product_id" options="{'no_open': True, 'no_create': True}"/>
80
+                                        <field name="aturan_minum"/>
81
+                                        <field name="waktu_minum"/>
82
+                                        <field name="qty"/>
83
+                                        <field name="satuan_id" options="{'no_open': True, 'no_create': True}"/>
84
+                                    </tree>
85
+                                </field>
86
+                            </page>
87
+                            <page string="Audit Trail">
88
+                                <group>
89
+                                    <group>
90
+                                        <field name="create_uid" readonly="1"/>
91
+                                        <field name="create_date" readonly="1"/>
92
+                                    </group>
93
+                                    <group>
94
+                                        <field name="write_uid" readonly="1"/>
95
+                                        <field name="write_date" readonly="1"/>
96
+                                    </group>
97
+                                </group>
98
+                            </page>
99
+                        </notebook>
100
+                    </sheet>
101
+                </form>
102
+                
103
+            </field>
104
+        </record>
105
+        
106
+        <record model="ir.actions.act_window" id="ms_pemeriksaan_action">
107
+            <field name="name">Pemeriksaan</field>
108
+            <field name="res_model">ms.pemeriksaan</field>
109
+            <field name="view_type">form</field>
110
+            <field name="view_mode">tree,form</field>
111
+            <field name="context">{}</field>
112
+            <field name="domain">[]</field>
113
+        </record>
114
+        
115
+        <record id="ms_pemeriksaan_action_tree" model="ir.actions.act_window.view">
116
+            <field eval="1" name="sequence"/>
117
+            <field name="view_mode">tree</field>
118
+            <field name="view_id" ref="ms_pemeriksaan_tree_view"/>
119
+            <field name="act_window_id" ref="ms_pemeriksaan_action"/>
120
+        </record>
121
+        
122
+        <record id="ms_pemeriksaan_action_form" model="ir.actions.act_window.view">
123
+            <field eval="2" name="sequence"/>
124
+            <field name="view_mode">form</field>
125
+            <field name="view_id" ref="ms_pemeriksaan_form_view"/>
126
+            <field name="act_window_id" ref="ms_pemeriksaan_action"/>
127
+        </record>
128
+        
129
+        <menuitem action="ms_pemeriksaan_action" id="ms_pemeriksaan_menu" parent="ms_base.ms_transaksi_submenu" sequence="20"/>
130
+        
131
+    </data>
132
+</odoo>

+ 110
- 0
pukesmas/ms_puskesmas/views/ms_pendaftaran.xml Näytä tiedosto

@@ -0,0 +1,110 @@
1
+<odoo>
2
+    <data>
3
+        
4
+        <record model="ir.ui.view" id="ms_pendaftaran_tree_view">
5
+            <field name="name">ms.pendaftaran.tree</field>
6
+            <field name="model">ms.pendaftaran</field>
7
+            <field name="arch" type="xml">
8
+                <tree string="Pendaftaran">
9
+                    <field name="name"/>
10
+                    <field name="tanggal"/>
11
+                    <field name="pasien_id"/>
12
+                    <field name="poli_id"/>
13
+                    <field name="state"/>
14
+                </tree>
15
+             </field>
16
+        </record>
17
+        
18
+        <record id="view_ms_pendaftaran_search" model="ir.ui.view">
19
+            <field name="name">ms.pendaftaran.search</field>
20
+            <field name="model">ms.pendaftaran</field>
21
+            <field name="arch" type="xml">
22
+                <search string="Search Pendaftaran">
23
+                    <field name="name"/>
24
+                    <field name="pasien_id"/>
25
+                    <field name="poli_id"/>
26
+                    <field name="state"/>
27
+                    <filter string="Draft" name="draft" domain="[('state','=','draft')]"/>
28
+                    <filter string="Confirm" name="confirm" domain="[('state','=','confirm')]"/>
29
+                    <group expand="0">
30
+                        <filter name="group_pasien" string="Pasien" domain="[]" context="{'group_by':'pasien_id'}"/>
31
+                        <filter name="group_poli" string="Poli" domain="[]" context="{'group_by':'poli_id'}"/>
32
+                    </group>
33
+                </search>
34
+            </field>
35
+        </record>
36
+        
37
+        <record model="ir.ui.view" id="ms_pendaftaran_form_view">
38
+            <field name="name">ms.pendaftaran.form</field>
39
+            <field name="model">ms.pendaftaran</field>
40
+            <field name="arch" type="xml">
41
+                
42
+                <form string="Pendaftaran">
43
+                    <header>
44
+                        <button name="action_confirm" string="Confirm" type="object" class="oe_highlight" attrs="{'invisible': [('state','!=','draft')]}"/>
45
+                        <button name="action_cancel" string="Cancel" type="object" attrs="{'invisible': [('state','=','cancel')]}"/>
46
+                        <field name="state" widget="statusbar" statusbar_visible="draft,confirm"/>
47
+                    </header>
48
+                    <sheet>
49
+                        <div class="oe_title">
50
+                            <h1>
51
+                                <field name="name" class="oe_inline" readonly="1"/>
52
+                            </h1>
53
+                        </div>
54
+                        <group col="4">
55
+                            <field name="pasien_id" attrs="{'readonly': [('state','!=','draft')]}" required="1" options="{'no_open': True, 'no_create': True}"/>
56
+                            <field name="poli_id" attrs="{'readonly': [('state','!=','draft')]}" required="1" options="{'no_open': True, 'no_create': True}"/>
57
+                            <field name="tanggal" attrs="{'readonly': [('state','!=','draft')]}" required="1"/>
58
+                        </group>
59
+                        <notebook>
60
+                            <page string="Note">
61
+                                <group>
62
+                                    <field name="note" nolabel="1" class="oe_inline" placeholder="Note"/>
63
+                                </group>
64
+                            </page>
65
+                            <page string="Audit Trail">
66
+                                <group>
67
+                                    <group>
68
+                                        <field name="create_uid" readonly="1"/>
69
+                                        <field name="create_date" readonly="1"/>
70
+                                    </group>
71
+                                    <group>
72
+                                        <field name="write_uid" readonly="1"/>
73
+                                        <field name="write_date" readonly="1"/>
74
+                                    </group>
75
+                                </group>
76
+                            </page>
77
+                        </notebook>
78
+                    </sheet>
79
+                </form>
80
+                
81
+            </field>
82
+        </record>
83
+        
84
+        <record model="ir.actions.act_window" id="ms_pendaftaran_action">
85
+            <field name="name">Pendaftaran</field>
86
+            <field name="res_model">ms.pendaftaran</field>
87
+            <field name="view_type">form</field>
88
+            <field name="view_mode">tree,form</field>
89
+            <field name="context">{}</field>
90
+            <field name="domain">[]</field>
91
+        </record>
92
+        
93
+        <record id="ms_pendaftaran_action_tree" model="ir.actions.act_window.view">
94
+            <field eval="1" name="sequence"/>
95
+            <field name="view_mode">tree</field>
96
+            <field name="view_id" ref="ms_pendaftaran_tree_view"/>
97
+            <field name="act_window_id" ref="ms_pendaftaran_action"/>
98
+        </record>
99
+        
100
+        <record id="ms_pendaftaran_action_form" model="ir.actions.act_window.view">
101
+            <field eval="2" name="sequence"/>
102
+            <field name="view_mode">form</field>
103
+            <field name="view_id" ref="ms_pendaftaran_form_view"/>
104
+            <field name="act_window_id" ref="ms_pendaftaran_action"/>
105
+        </record>
106
+        
107
+        <menuitem action="ms_pendaftaran_action" id="ms_pendaftaran_menu" parent="ms_base.ms_transaksi_submenu" sequence="10"/>
108
+        
109
+    </data>
110
+</odoo>

+ 45
- 0
pukesmas/ms_puskesmas/views/ms_poli.xml Näytä tiedosto

@@ -0,0 +1,45 @@
1
+<odoo>
2
+    <data>
3
+        
4
+        <record model="ir.ui.view" id="ms_poli_tree_view">
5
+            <field name="name">ms.poli.tree</field>
6
+            <field name="model">ms.poli</field>
7
+            <field name="arch" type="xml">
8
+                <tree string="Poli" editable="top">
9
+                    <field name="kode"/>
10
+                    <field name="name"/>
11
+                </tree>
12
+             </field>
13
+        </record>
14
+        
15
+        <record id="view_ms_poli_search" model="ir.ui.view">
16
+            <field name="name">ms.poli.search</field>
17
+            <field name="model">ms.poli</field>
18
+            <field name="arch" type="xml">
19
+                <search string="Search Poli">
20
+                    <field name="name"/>
21
+                    <field name="kode"/>
22
+                </search>
23
+            </field>
24
+        </record>
25
+        
26
+        <record model="ir.actions.act_window" id="ms_poli_action">
27
+            <field name="name">Poli</field>
28
+            <field name="res_model">ms.poli</field>
29
+            <field name="view_type">form</field>
30
+            <field name="view_mode">tree,form</field>
31
+            <field name="context">{}</field>
32
+            <field name="domain">[]</field>
33
+        </record>
34
+        
35
+        <record id="ms_poli_action_tree" model="ir.actions.act_window.view">
36
+            <field eval="1" name="sequence"/>
37
+            <field name="view_mode">tree</field>
38
+            <field name="view_id" ref="ms_poli_tree_view"/>
39
+            <field name="act_window_id" ref="ms_poli_action"/>
40
+        </record>
41
+        
42
+        <menuitem action="ms_poli_action" id="ms_poli_menu" parent="ms_base.ms_data_master_submenu" sequence="30"/>
43
+        
44
+    </data>
45
+</odoo>

+ 7
- 0
pukesmas/ms_puskesmas/views/product_template.xml Näytä tiedosto

@@ -0,0 +1,7 @@
1
+<odoo>
2
+    <data>
3
+        
4
+        <menuitem action="product.product_template_action" id="ms_obat_menu" name="Obat" parent="ms_base.ms_data_master_submenu" sequence="40"/>
5
+        
6
+    </data>
7
+</odoo>

+ 187
- 0
pukesmas/ms_puskesmas/views/res_partner.xml Näytä tiedosto

@@ -0,0 +1,187 @@
1
+<?xml version="1.0" encoding="utf-8"?>
2
+<odoo>
3
+    <data>
4
+		
5
+		<record model="ir.ui.view" id="ms_dokter_tree_view">
6
+		    <field name="name">ms.dokter.tree</field>
7
+		    <field name="model">res.partner</field>
8
+		    <field name="arch" type="xml">
9
+		        <tree string="Dokter">
10
+		        	<field name="kode"/>
11
+		            <field name="name"/>
12
+		            <field name="mobile" string="No HP/Telp"/>
13
+		        </tree>
14
+		     </field>
15
+		</record>
16
+		
17
+		<record id="view_ms_dokter_search" model="ir.ui.view">
18
+            <field name="name">ms.dokter.search</field>
19
+            <field name="model">res.partner</field>
20
+            <field name="arch" type="xml">
21
+                <search string="Search Dokter">
22
+		            <field name="kode"/>
23
+		            <field name="name"/>
24
+		            <field name="mobile" string="No HP/Telp"/>
25
+                    <filter name="group_nama" string="Nama" domain="[]" context="{'group_by':'name'}"/>
26
+                </search>
27
+            </field>
28
+        </record>
29
+        
30
+		<record model="ir.ui.view" id="ms_dokter_form_view">
31
+		    <field name="name">ms.dokter.form</field>
32
+		    <field name="model">res.partner</field>
33
+		    <field name="arch" type="xml">
34
+		    	
35
+		    	<form string="Dokter">
36
+		    		<sheet>
37
+		    			<group col="4">
38
+	                    	<field name="kode" string="Kode Dokter" required="1"/>
39
+		    				<field name="name" string="Nama" required="1"/>
40
+		    				<field name="street" string="Alamat" required="1"/>
41
+		            		<field name="mobile" string="No HP/Telp"/>
42
+		            		<field name="dokter" invisible="1"/>
43
+	                    </group>
44
+						<notebook>
45
+                            <page string="History Dokter">
46
+                                <field name="history_dokter" readonly="1" attrs="{'invisible': [('dokter','!=',True)]}"/>
47
+                            </page>
48
+							<page string="Note">
49
+								<group>
50
+									<field name="comment" nolabel="1" class="oe_inline" placeholder="Note"/>
51
+								</group>
52
+							</page>
53
+						</notebook>
54
+		    		</sheet>
55
+		    	</form>
56
+		    	
57
+			</field>
58
+		</record>
59
+		
60
+		<record model="ir.actions.act_window" id="ms_dokter_action">
61
+            <field name="name">Dokter</field>
62
+            <field name="res_model">res.partner</field>
63
+            <field name="view_type">form</field>
64
+            <field name="view_mode">tree,form</field>
65
+            <field name="context">{'default_dokter':True}</field>
66
+            <field name="domain">[('dokter','=',True)]</field>
67
+            <field name="search_view_id" ref="view_ms_dokter_search"/>
68
+        </record>
69
+        
70
+        <record id="ms_dokter_action_tree" model="ir.actions.act_window.view">
71
+            <field eval="1" name="sequence"/>
72
+            <field name="view_mode">tree</field>
73
+            <field name="view_id" ref="ms_dokter_tree_view"/>
74
+            <field name="act_window_id" ref="ms_dokter_action"/>
75
+        </record>
76
+        
77
+        <record id="ms_dokter_action_form" model="ir.actions.act_window.view">
78
+            <field eval="2" name="sequence"/>
79
+            <field name="view_mode">form</field>
80
+            <field name="view_id" ref="ms_dokter_form_view"/>
81
+            <field name="act_window_id" ref="ms_dokter_action"/>
82
+        </record>
83
+        
84
+        <menuitem action="ms_dokter_action" id="ms_dokter_menu" parent="ms_base.ms_data_master_submenu" sequence="10"/>
85
+
86
+
87
+        <!-- Form Pasien -->
88
+
89
+        <record model="ir.ui.view" id="ms_pasien_tree_view">
90
+            <field name="name">ms.pasien.tree</field>
91
+            <field name="model">res.partner</field>
92
+            <field name="arch" type="xml">
93
+                <tree string="Pasien">
94
+                    <field name="kode"/>
95
+                    <field name="name"/>
96
+                    <field name="pekerjaan"/>
97
+                    <field name="jenis_kelamin"/>
98
+                    <field name="gol_darah"/>
99
+                </tree>
100
+             </field>
101
+        </record>
102
+        
103
+        <record id="view_ms_pasien_search" model="ir.ui.view">
104
+            <field name="name">ms.pasien.search</field>
105
+            <field name="model">res.partner</field>
106
+            <field name="arch" type="xml">
107
+                <search string="Search Pasien">
108
+                    <field name="kode"/>
109
+                    <field name="name"/>
110
+                    <field name="pekerjaan"/>
111
+                    <field name="jenis_kelamin"/>
112
+                    <field name="gol_darah"/>
113
+                    <filter name="group_pekerjaan" string="Pekerjaan" domain="[]" context="{'group_by':'pekerjaan'}"/>
114
+                    <filter name="group_jenis_kelamin" string="Jenis Kelamin" domain="[]" context="{'group_by':'jenis_kelamin'}"/>
115
+                    <filter name="group_gol_darah" string="Golongan Darah" domain="[]" context="{'group_by':'gol_darah'}"/>
116
+                </search>
117
+            </field>
118
+        </record>
119
+        
120
+        <record model="ir.ui.view" id="ms_pasien_form_view">
121
+            <field name="name">ms.pasien.form</field>
122
+            <field name="model">res.partner</field>
123
+            <field name="arch" type="xml">
124
+                
125
+                <form string="Pasien">
126
+                    <sheet>
127
+                        <div class="oe_title">
128
+                            <h1>
129
+                                <field name="kode" class="oe_inline" readonly="1"/>
130
+                            </h1>
131
+                        </div>
132
+                        <group col="4">
133
+                            <field name="name" string="Nama" required="1"/>
134
+                            <field name="jenis_kelamin" required="1"/>
135
+                            <field name="tgl_lahir" required="1"/>
136
+                            <field name="status" required="1"/>
137
+                            <field name="gol_darah"/>
138
+                            <field name="mobile" string="No HP/Telp"/>
139
+                            <field name="street" string="Alamat" required="1"/>
140
+                            <field name="pekerjaan" required="1"/>
141
+                            <field name="nama_pekerjaan" attrs="{'required': [('pekerjaan','=','lain')], 'invisible': [('pekerjaan','!=','lain')]}"/>
142
+                            <field name="pasien" invisible="1"/>
143
+                        </group>
144
+                        <notebook>
145
+                            <page string="History Pasien">
146
+                                <field name="history_pasien" readonly="1" attrs="{'invisible': [('pasien','!=',True)]}"/>
147
+                            </page>
148
+                            <page name="note" string="Note">
149
+                                <group>
150
+                                    <field name="comment" nolabel="1" class="oe_inline" placeholder="Note"/>
151
+                                </group>
152
+                            </page>
153
+                        </notebook>
154
+                    </sheet>
155
+                </form>
156
+                
157
+            </field>
158
+        </record>
159
+        
160
+        <record model="ir.actions.act_window" id="ms_pasien_action">
161
+            <field name="name">Pasien</field>
162
+            <field name="res_model">res.partner</field>
163
+            <field name="view_type">form</field>
164
+            <field name="view_mode">tree,form</field>
165
+            <field name="context">{'default_pasien':True}</field>
166
+            <field name="domain">[('pasien','=',True)]</field>
167
+            <field name="search_view_id" ref="view_ms_pasien_search"/>
168
+        </record>
169
+        
170
+        <record id="ms_pasien_action_tree" model="ir.actions.act_window.view">
171
+            <field eval="1" name="sequence"/>
172
+            <field name="view_mode">tree</field>
173
+            <field name="view_id" ref="ms_pasien_tree_view"/>
174
+            <field name="act_window_id" ref="ms_pasien_action"/>
175
+        </record>
176
+        
177
+        <record id="ms_pasien_action_form" model="ir.actions.act_window.view">
178
+            <field eval="2" name="sequence"/>
179
+            <field name="view_mode">form</field>
180
+            <field name="view_id" ref="ms_pasien_form_view"/>
181
+            <field name="act_window_id" ref="ms_pasien_action"/>
182
+        </record>
183
+        
184
+        <menuitem action="ms_pasien_action" id="ms_pasien_menu" parent="ms_base.ms_data_master_submenu" sequence="20"/>
185
+    	
186
+    </data>
187
+</odoo>

+ 1
- 0
pukesmas/ms_puskesmas/wizard/__init__.py Näytä tiedosto

@@ -0,0 +1 @@
1
+import ms_reason_cancel_wizard

+ 16
- 0
pukesmas/ms_puskesmas/wizard/ms_reason_cancel_wizard.py Näytä tiedosto

@@ -0,0 +1,16 @@
1
+from odoo import fields, api, models
2
+
3
+class ms_reason_cancel_wizard(models.TransientModel):
4
+    _name = "ms.reason.cancel.wizard"
5
+    _description = "Reason Cancel"
6
+    
7
+    name = fields.Text(string="Reason", required=True)
8
+    
9
+    @api.one
10
+    def action_cancel(self):
11
+        active_ids = self._context.get('active_ids')
12
+        if not active_ids :
13
+            return False
14
+        pemeriksaan_id = self.env['ms.pemeriksaan'].browse(active_ids[:1])
15
+        pemeriksaan_id.pendaftaran_id.note += self.name
16
+        pemeriksaan_id.state = 'cancel'

+ 25
- 0
pukesmas/ms_puskesmas/wizard/ms_reason_cancel_wizard.xml Näytä tiedosto

@@ -0,0 +1,25 @@
1
+<odoo>
2
+    <data>
3
+    
4
+    <record id="view_ms_reason_cancel_wizard" model="ir.ui.view">
5
+        <field name="name">Reason Cancel</field>
6
+        <field name="model">ms.reason.cancel.wizard</field>
7
+        <field name="type">form</field>
8
+        <field name="arch" type="xml">
9
+            
10
+            <form string="Reason Cancel">
11
+                <group>
12
+                    <field name="name"/>
13
+                </group>
14
+                <footer>
15
+                    <button name="action_cancel" string="Cancel" type="object" class="oe_highlight"/>
16
+                    <label string="or"/>
17
+                    <button string="Batal Cancel" class="oe_link" special="cancel"/>
18
+                </footer>
19
+            </form>
20
+            
21
+        </field>
22
+    </record>
23
+    
24
+    </data>
25
+</odoo>

Loading…
Peruuta
Tallenna