diff options
| author | Mqdd <ahmadmiqdad27@gmail.com> | 2026-03-05 15:18:50 +0700 |
|---|---|---|
| committer | Mqdd <ahmadmiqdad27@gmail.com> | 2026-03-05 15:18:50 +0700 |
| commit | e3385d7f17ec3817b562cc1d9045b633ead00487 (patch) | |
| tree | 7c61c1e1f87a4d78f86e4724c830d5e379029901 | |
| parent | 633087b3d49f880a9fbc90aac6b1275f224f2083 (diff) | |
<Miqdad> done. TODO line
| -rw-r--r-- | indoteknik_custom/models/upah_harian_office.py | 20 | ||||
| -rw-r--r-- | indoteknik_custom/views/upah_harian_office_views.xml | 42 |
2 files changed, 53 insertions, 9 deletions
diff --git a/indoteknik_custom/models/upah_harian_office.py b/indoteknik_custom/models/upah_harian_office.py index 7db56cdd..9666a304 100644 --- a/indoteknik_custom/models/upah_harian_office.py +++ b/indoteknik_custom/models/upah_harian_office.py @@ -6,8 +6,8 @@ class UpahHarianOffice(models.Model): _description = 'Upah Harian' _inherit = ['mail.thread', 'mail.activity.mixin'] - name = fields.Char() - pemohon = fields.Many2one('res.users', String='Pemohon', required=True) + name = fields.Char(readonly=True) + pemohon = fields.Many2one('res.users', String='Pemohon', required=True, domain = ([('active', '=', True), ('share', '=', False)])) tanggal = fields.Date('Tanggal Pengajuan', required=True) upah_harian = fields.Float('Upah Harian') notes = fields.Text('Notes') @@ -29,6 +29,18 @@ class UpahHarianOffice(models.Model): ], string='Departement Type', tracking=3, required=True) is_ganti_jam = fields.Boolean('Ganti Jam?', default="False") total_upah = fields.Float('Total Upah Harian', compute='_compute_total_upah') + attachment_file_image = fields.Binary(string='Attachment Image', attachment_filename='attachment_filename_image') + attachment_file_pdf = fields.Binary(string='Attachment PDF', attachment_filename='attachment_filename_pdf') + attachment_filename_image = fields.Char(string='Filename Image') + attachment_filename_pdf = fields.Char(string='Filename PDF') + + + @api.onchange('attachment_type') + def _onchange_attachment_type(self): + self.attachment_file_image = False + self.attachment_filename_image = False + self.attachment_file_pdf = False + self.attachment_filename_pdf = False @api.model def create(self, vals): @@ -73,10 +85,10 @@ class UpahHarianOfficeLine(models.Model): hari = fields.Char('Hari') jam_masuk = fields.Float('Jam Masuk', required=True) jam_keluar = fields.Float('Jam Keluar', required=True) - tanggal_line = fields.Datetime('Tanggal', required=True) + tanggal_line = fields.Date('Tanggal', required=True) kegiatan = fields.Char('Kegiatan', required=True) - jam = fields.Float('Jam', required=True) total_jam_kerja = fields.Float('Total Jam Kerja', compute='_compute_total_jam_kerja') + is_ganti_jam = fields.Boolean('Ganti Jam Kerja', default = False) def _compute_total_jam_kerja(self): for line in self: diff --git a/indoteknik_custom/views/upah_harian_office_views.xml b/indoteknik_custom/views/upah_harian_office_views.xml index 1ec681d1..9a0c3a2f 100644 --- a/indoteknik_custom/views/upah_harian_office_views.xml +++ b/indoteknik_custom/views/upah_harian_office_views.xml @@ -11,7 +11,6 @@ <field name="pemohon"/> <field name="tanggal"/> <field name="state"/> - </tree> </field> </record> @@ -22,7 +21,6 @@ <field name="model">upah.harian</field> <field name="arch" type="xml"> <form string="Upah Harian Office"> - <header> <button name="action_create_journal_entries" class="btn-primary" type="object" string="Create Journal Entries" attrs="{'invisible': [('state', 'not in', ['done'])]}"/> <field name="state" widget="statusbar" readonly="1"/> @@ -39,16 +37,44 @@ <group> <group> <field name="pemohon"/> + <field name="departement_type"/> <field name="tanggal"/> <field name="upah_harian"/> </group> <group> - <field name="attachment_type"/> - <field name="attachment"/> + <field name="attachment_type" attrs="{'readonly': [('state', '=', 'approved')]}"/> + + <field name="attachment_file_pdf" filename="attachment_filename" + widget="pdf_viewer" + attrs="{'invisible': [('attachment_type', '!=', 'pdf')], 'readonly': [('state', '=', 'approved')]}"/> + + <field name="attachment_file_image" filename="attachment_filename" + widget="image" + attrs="{'invisible': [('attachment_type', '!=', 'image')], 'readonly': [('state', '=', 'approved')]}" + style="max-width:250px; max-height:250px; object-fit:contain;"/> </group> </group> + <notebook> + <page string="Activity Line" name="activity_line"> + <field name="upah_harian_line"> + <tree editable="top"> + <field name="hari" width="100px"/> + <field name="tanggal_line"/> + <field name="jam_masuk"/> + <field name="jam_keluar"/> + <field name="total_jam_kerja"/> + <field name="is_ganti_jam"/> + <field name="kegiatan"/> + </tree> + </field> + </page> + </notebook> </sheet> + <div class="oe_chatter"> + <field name="message_follower_ids" widget="mail_followers"/> + <field name="message_ids" widget="mail_thread"/> + </div> </form> </field> @@ -67,7 +93,13 @@ </field> </record> + <record id="action_upah_harian" model="ir.actions.act_window"> + <field name="name">Upah Harian</field> + <field name="res_model">upah.harian</field> + <field name="view_mode">tree,form</field> + </record> + + <menuitem id="menu_upah_harian" name="Upah Harian" parent="account.menu_finance_entries" sequence="114" action="action_upah_harian" /> - <menuitem id="menu_upah_harian" name="Upah Harian" parent="account.menu_finance_entries" sequence="114" action="action_advance_payment_settlement" /> </odoo> |
