summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rwxr-xr-xindoteknik_custom/__manifest__.py374
-rwxr-xr-xindoteknik_custom/models/__init__.py1
-rwxr-xr-xindoteknik_custom/models/res_users.py1
-rw-r--r--indoteknik_custom/models/upah_harian_office.py307
-rwxr-xr-xindoteknik_custom/security/ir.model.access.csv3
-rw-r--r--indoteknik_custom/views/ir_sequence.xml9
-rw-r--r--indoteknik_custom/views/upah_harian_office_views.xml162
7 files changed, 671 insertions, 186 deletions
diff --git a/indoteknik_custom/__manifest__.py b/indoteknik_custom/__manifest__.py
index 8c427579..77a49e96 100755
--- a/indoteknik_custom/__manifest__.py
+++ b/indoteknik_custom/__manifest__.py
@@ -9,192 +9,194 @@
'website': '',
'images': ['assets/favicon.ico'],
'depends': ['base', 'coupon', 'delivery', 'sale', 'sale_management', 'vit_kelurahan', 'vit_efaktur', 'proweb_kartu_stok'],
- 'data': [
- 'views/assets.xml',
- 'security/ir.model.access.csv',
- 'views/group_partner.xml',
- 'views/blog_post.xml',
- 'views/coupon_program.xml',
- 'views/delivery_order.xml',
- 'views/product_pricelist.xml',
- 'views/res_groups.xml',
- 'views/res_partner_company_type.xml',
- 'views/res_partner.xml',
- 'views/product_pricelist_item.xml',
- 'views/product_public_category.xml',
- 'views/product_template.xml',
- 'views/uangmuka_pembelian.xml',
- 'views/purchase_order.xml',
- 'views/purchase_pricelist.xml',
- 'views/sale_monitoring.xml',
- 'views/sale_monitoring_detail.xml',
- 'views/web_logging/user_activity_log.xml',
- 'views/web_logging/web_utm_source.xml',
- 'views/user_company_request.xml',
- 'views/user_pengajuan_tempo_request.xml',
- 'views/vit_kelurahan.xml',
- 'views/vit_kecamatan.xml',
- 'views/vit_kota.xml',
- 'views/website_user_cart.xml',
- 'views/website_user_wishlist.xml',
- 'views/x_banner_banner.xml',
- 'views/x_banner_category.xml',
- 'views/x_biaya_kirim.xml',
- 'views/x_manufactures.xml',
- 'views/x_partner_purchase_order.xml',
- 'views/x_product_tags.xml',
- 'views/stock_vendor.xml',
- 'views/crm_lead.xml',
- 'views/uangmuka_penjualan.xml',
- 'views/sale_order.xml',
- 'views/account_asset_views.xml',
- 'views/account_move_views.xml',
- 'views/ir_sequence.xml',
- 'views/stock_location.xml',
- 'views/stock_picking.xml',
- 'views/stock_picking_type.xml',
- 'views/users.xml',
- 'views/delivery_carrier.xml',
- 'views/invoice_reklas.xml',
- 'views/account_move.xml',
- 'views/dunning_run.xml',
- 'views/website_brand_homepage.xml',
- 'views/website_categories_homepage.xml',
- 'views/website_categories_management.xml',
- 'views/website_telegram.xml',
- 'views/website_categories_lob.xml',
- 'views/sales_target.xml',
- 'views/purchase_outstanding.xml',
- 'views/sales_outstanding.xml',
- 'views/customer_review.xml',
- 'views/website_content_channel.xml',
- 'views/website_content.xml',
- 'views/website_page_content.xml',
- 'views/custom_mail_marketing.xml',
- 'views/website_ads.xml',
- 'views/leads_monitoring.xml',
- 'views/ip_lookup.xml',
- 'views/wati.xml',
- 'views/midtrans.xml',
- 'views/automatic_purchase.xml',
- 'views/raja_ongkir.xml',
- 'views/procurement_monitoring_detail.xml',
- 'views/product_product.xml',
- 'views/brand_vendor.xml',
- 'views/promotion/promotion_program.xml',
- 'views/promotion/promotion_program_line.xml',
- 'views/promotion/promotion_product.xml',
- 'views/promotion/promotion_monitoring.xml',
- 'views/requisition.xml',
- 'views/landedcost.xml',
- 'views/product_sla.xml',
- 'views/voucher.xml',
- 'views/bill_receipt.xml',
- 'views/account_financial_report_view.xml',
- 'views/account_report_general_ledger_view.xml',
- 'views/account_move_multi_update.xml',
- 'views/airway_bill.xml',
- 'views/product_attribute_value.xml',
- 'views/mail_template_po.xml',
- 'views/mail_template_efaktur.xml',
- 'views/mail_template_invoice_po.xml',
- 'views/mail_template_invoice_reminder.xml',
- 'views/price_group.xml',
- 'views/mrp_production.xml',
- 'views/apache_solr.xml',
- 'views/apache_solr_queue.xml',
- 'views/cost_centre.xml',
- 'views/account_account_views.xml',
- 'views/account_move_line.xml',
- 'views/sale_orders_multi_update.xml',
- 'views/quotation_so_multi_update.xml',
- 'views/stock_move_line.xml',
- 'views/product_monitoring.xml',
- 'views/res_users.xml',
- 'views/account_bank_statement.xml',
- 'views/stock_warehouse_orderpoint.xml',
- 'views/customer_commision.xml',
- 'views/wati_history.xml',
- 'views/purchasing_job.xml',
- 'views/purchasing_job_multi_update.xml',
- 'views/sale_monitoring_detail_v2.xml',
- 'views/purchase_order_multi_update.xml',
- 'views/purchase_order_multi_confirm.xml',
- 'views/purchase_order_multi_ask_approval.xml',
- 'views/invoice_reklas_penjualan.xml',
- 'views/po_multi_cancel.xml',
- 'views/logbook_sj.xml',
- 'views/report_logbook_sj.xml',
- 'views/role_permission/ir_model_access.xml',
- 'views/role_permission/res_groups.xml',
- 'views/cust_commision.xml',
- 'views/stock_quant.xml',
- 'views/purchasing_job_state.xml',
- 'views/res_partner_site.xml',
- 'views/apps_stored.xml',
- 'views/ged_tracking.xml',
- 'views/dunning_run_ged.xml',
- 'views/account_move_multi_update_bills.xml',
- 'views/def_cargo_province.xml',
- 'views/def_cargo_city.xml',
- 'views/def_cargo_district.xml',
- 'views/purchase_order_multi_uangmuka.xml',
- 'views/purchase_order_multi_uangmuka2.xml',
- 'views/logbook_bill.xml',
- 'views/report_logbook_bill.xml',
- 'views/sale_order_multi_uangmuka_penjualan.xml',
- 'views/shipment_group.xml',
- 'views/approval_date_doc.xml',
- 'views/approval_invoice_date.xml',
- 'views/partner_payment_term.xml',
- 'views/vendor_payment_term.xml',
- 'views/approval_unreserve.xml',
- 'views/vendor_approval.xml',
- 'views/find_page.xml',
- 'views/approval_retur_picking.xml',
- 'views/form_vendor_approval_multi_approve.xml',
- 'views/form_vendor_approval_multi_reject.xml',
- 'views/user_pengajuan_tempo.xml',
- 'views/stock_backorder_confirmation_views.xml',
- 'views/barcoding_product.xml',
- 'views/project_views.xml',
- 'views/approval_payment_term.xml',
- 'report/report.xml',
- 'report/report_banner_banner.xml',
- 'report/report_banner_banner2.xml',
- 'report/purchase_order.xml',
- 'report/report_invoice.xml',
- 'report/report_picking.xml',
- 'report/report_sale_order.xml',
- 'report/report_surat_piutang.xml',
- 'report/report_tutup_tempo.xml',
- 'report/purchase_report.xml',
- 'report/purchase_report_internal.xml',
- 'views/vendor_sla.xml',
- 'views/coretax_faktur.xml',
- 'views/public_holiday.xml',
- 'views/stock_inventory.xml',
- 'views/sale_order_delay.xml',
- 'views/refund_sale_order.xml',
- 'views/advance_payment_request.xml',
- 'views/advance_payment_settlement.xml',
- 'views/tukar_guling.xml',
- 'views/tukar_guling_po.xml',
- 'views/update_date_planned_po_wizard_view.xml',
- 'views/unpaid_invoice_view.xml',
- 'views/letter_receivable.xml',
- 'views/letter_receivable_mail_template.xml',
- 'views/mail_template_pum.xml',
- 'views/sj_tele.xml',
- 'views/close_tempo_mail_template.xml',
- 'views/domain_apo.xml',
- 'views/uom_uom.xml',
- 'views/update_depreciation_move_wizard_view.xml',
- 'views/commission_internal.xml',
- 'views/keywords.xml',
- 'views/token_log.xml',
- 'views/gudang_service.xml',
- 'views/kartu_stock.xml',
+ "data": [
+ "security/ir.model.access.csv",
+ "views/account_account_views.xml",
+ "views/account_asset_views.xml",
+ "views/account_bank_statement.xml",
+ "views/account_financial_report_view.xml",
+ "views/account_move_line.xml",
+ "views/account_move_multi_update_bills.xml",
+ "views/account_move_multi_update.xml",
+ "views/account_move_views.xml",
+ "views/account_move.xml",
+ "views/account_report_general_ledger_view.xml",
+ "views/advance_payment_request.xml",
+ "views/advance_payment_settlement.xml",
+ "views/airway_bill.xml",
+ "views/apache_solr_queue.xml",
+ "views/apache_solr.xml",
+ "views/approval_date_doc.xml",
+ "views/approval_invoice_date.xml",
+ "views/approval_payment_term.xml",
+ "views/approval_retur_picking.xml",
+ "views/approval_unreserve.xml",
+ "views/apps_stored.xml",
+ "views/assets.xml",
+ "views/automatic_purchase.xml",
+ "views/barcoding_product.xml",
+ "views/bill_receipt.xml",
+ "views/blog_post.xml",
+ "views/brand_vendor.xml",
+ "views/close_tempo_mail_template.xml",
+ "views/commission_internal.xml",
+ "views/coretax_faktur.xml",
+ "views/cost_centre.xml",
+ "views/coupon_program.xml",
+ "views/crm_lead.xml",
+ "views/cust_commision.xml",
+ "views/custom_mail_marketing.xml",
+ "views/customer_commision.xml",
+ "views/customer_review.xml",
+ "views/def_cargo_city.xml",
+ "views/def_cargo_district.xml",
+ "views/def_cargo_province.xml",
+ "views/delivery_carrier.xml",
+ "views/delivery_order.xml",
+ "views/domain_apo.xml",
+ "views/dunning_run_ged.xml",
+ "views/dunning_run.xml",
+ "views/find_page.xml",
+ "views/form_vendor_approval_multi_approve.xml",
+ "views/form_vendor_approval_multi_reject.xml",
+ "views/ged_tracking.xml",
+ "views/group_partner.xml",
+ "views/gudang_service.xml",
+ "views/invoice_reklas_penjualan.xml",
+ "views/invoice_reklas.xml",
+ "views/ip_lookup.xml",
+ "views/ir_sequence.xml",
+ "views/kartu_stock.xml",
+ "views/keywords.xml",
+ "views/landedcost.xml",
+ "views/leads_monitoring.xml",
+ "views/letter_receivable_mail_template.xml",
+ "views/letter_receivable.xml",
+ "views/logbook_bill.xml",
+ "views/logbook_sj.xml",
+ "views/mail_template_efaktur.xml",
+ "views/mail_template_invoice_po.xml",
+ "views/mail_template_invoice_reminder.xml",
+ "views/mail_template_po.xml",
+ "views/mail_template_pum.xml",
+ "views/midtrans.xml",
+ "views/mrp_production.xml",
+ "views/partner_payment_term.xml",
+ "views/po_multi_cancel.xml",
+ "views/price_group.xml",
+ "views/procurement_monitoring_detail.xml",
+ "views/product_attribute_value.xml",
+ "views/product_monitoring.xml",
+ "views/product_pricelist_item.xml",
+ "views/product_pricelist.xml",
+ "views/product_product.xml",
+ "views/product_public_category.xml",
+ "views/product_sla.xml",
+ "views/product_template.xml",
+ "views/project_views.xml",
+ "views/promotion/promotion_monitoring.xml",
+ "views/promotion/promotion_product.xml",
+ "views/promotion/promotion_program_line.xml",
+ "views/promotion/promotion_program.xml",
+ "views/public_holiday.xml",
+ "views/purchase_order_multi_ask_approval.xml",
+ "views/purchase_order_multi_confirm.xml",
+ "views/purchase_order_multi_uangmuka.xml",
+ "views/purchase_order_multi_uangmuka2.xml",
+ "views/purchase_order_multi_update.xml",
+ "views/purchase_order.xml",
+ "views/purchase_outstanding.xml",
+ "views/purchase_pricelist.xml",
+ "views/purchasing_job_multi_update.xml",
+ "views/purchasing_job_state.xml",
+ "views/purchasing_job.xml",
+ "views/quotation_so_multi_update.xml",
+ "views/raja_ongkir.xml",
+ "views/refund_sale_order.xml",
+ "views/report_logbook_bill.xml",
+ "views/report_logbook_sj.xml",
+ "views/requisition.xml",
+ "views/res_groups.xml",
+ "views/res_partner_company_type.xml",
+ "views/res_partner_site.xml",
+ "views/res_partner.xml",
+ "views/res_users.xml",
+ "views/role_permission/ir_model_access.xml",
+ "views/role_permission/res_groups.xml",
+ "views/sale_monitoring_detail_v2.xml",
+ "views/sale_monitoring_detail.xml",
+ "views/sale_monitoring.xml",
+ "views/sale_order_delay.xml",
+ "views/sale_order_multi_uangmuka_penjualan.xml",
+ "views/sale_order.xml",
+ "views/sale_orders_multi_update.xml",
+ "views/sales_outstanding.xml",
+ "views/sales_target.xml",
+ "views/shipment_group.xml",
+ "views/sj_tele.xml",
+ "views/stock_backorder_confirmation_views.xml",
+ "views/stock_inventory.xml",
+ "views/stock_location.xml",
+ "views/stock_move_line.xml",
+ "views/stock_picking_type.xml",
+ "views/stock_picking.xml",
+ "views/stock_quant.xml",
+ "views/stock_vendor.xml",
+ "views/stock_warehouse_orderpoint.xml",
+ "views/token_log.xml",
+ "views/tukar_guling_po.xml",
+ "views/tukar_guling.xml",
+ "views/uangmuka_pembelian.xml",
+ "views/uangmuka_penjualan.xml",
+ "views/unpaid_invoice_view.xml",
+ "views/uom_uom.xml",
+ "views/upah_harian_office_views.xml",
+ "views/update_date_planned_po_wizard_view.xml",
+ "views/update_depreciation_move_wizard_view.xml",
+ "views/user_company_request.xml",
+ "views/user_pengajuan_tempo_request.xml",
+ "views/user_pengajuan_tempo.xml",
+ "views/users.xml",
+ "views/vendor_approval.xml",
+ "views/vendor_payment_term.xml",
+ "views/vendor_sla.xml",
+ "views/vit_kecamatan.xml",
+ "views/vit_kelurahan.xml",
+ "views/vit_kota.xml",
+ "views/voucher.xml",
+ "views/wati_history.xml",
+ "views/wati.xml",
+ "views/web_logging/user_activity_log.xml",
+ "views/web_logging/web_utm_source.xml",
+ "views/website_ads.xml",
+ "views/website_brand_homepage.xml",
+ "views/website_categories_homepage.xml",
+ "views/website_categories_lob.xml",
+ "views/website_categories_management.xml",
+ "views/website_content_channel.xml",
+ "views/website_content.xml",
+ "views/website_page_content.xml",
+ "views/website_telegram.xml",
+ "views/website_user_cart.xml",
+ "views/website_user_wishlist.xml",
+ "views/x_banner_banner.xml",
+ "views/x_banner_category.xml",
+ "views/x_biaya_kirim.xml",
+ "views/x_manufactures.xml",
+ "views/x_partner_purchase_order.xml",
+ "views/x_product_tags.xml",
+ "views/upah_harian_office_views.xml",
+ "report/purchase_order.xml",
+ "report/purchase_report_internal.xml",
+ "report/purchase_report.xml",
+ "report/report_banner_banner.xml",
+ "report/report_banner_banner2.xml",
+ "report/report_invoice.xml",
+ "report/report_picking.xml",
+ "report/report_sale_order.xml",
+ "report/report_surat_piutang.xml",
+ "report/report_tutup_tempo.xml",
+ "report/report.xml"
],
'demo': [],
'css': [],
diff --git a/indoteknik_custom/models/__init__.py b/indoteknik_custom/models/__init__.py
index 31ee5108..b11b961f 100755
--- a/indoteknik_custom/models/__init__.py
+++ b/indoteknik_custom/models/__init__.py
@@ -170,3 +170,4 @@ from . import update_depreciation_move_wizard
from . import keywords
from . import token_log
from . import kartu_stock
+from . import upah_harian_office
diff --git a/indoteknik_custom/models/res_users.py b/indoteknik_custom/models/res_users.py
index b0864f2c..8f5b4008 100755
--- a/indoteknik_custom/models/res_users.py
+++ b/indoteknik_custom/models/res_users.py
@@ -12,6 +12,7 @@ class ResUsers(models.Model):
otp_code = fields.Char(string='OTP Code')
otp_create_date = fields.Datetime(string='OTP Create Date')
payment_terms_id = fields.Many2one('account.payment.term', related='partner_id.property_payment_term_id', string='Payment Terms')
+ pic = fields.Boolean('PIC')
def _generate_otp(self):
diff --git a/indoteknik_custom/models/upah_harian_office.py b/indoteknik_custom/models/upah_harian_office.py
new file mode 100644
index 00000000..0e91a402
--- /dev/null
+++ b/indoteknik_custom/models/upah_harian_office.py
@@ -0,0 +1,307 @@
+from odoo import models, fields, api
+from odoo.exceptions import UserError, ValidationError
+
+class UpahHarianOffice(models.Model):
+ _name = 'upah.harian'
+ _description = 'Upah Harian'
+ _inherit = ['mail.thread', 'mail.activity.mixin']
+
+ 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,
+ default=fields.Date.today()
+ )
+
+ upah_harian = fields.Float('Upah Harian')
+ notes = fields.Text('Notes')
+
+ state = fields.Selection([
+ ('draft', 'Draft'),
+ ('approved', 'Approved'),
+ ('paid', 'Paid'),
+ ('cancel', 'Canceled')
+ ], default='draft')
+
+ cancel_reason = fields.Text('Alasan Cancel')
+
+ approved_by = fields.Char('Approved By')
+
+ departement_type = fields.Selection([
+ ('sales', 'Sales'),
+ ('merchandiser', 'Merchandiser'),
+ ('marketing', 'Marketing'),
+ ('logistic', 'Logistic'),
+ ('procurement', 'Procurement'),
+ ('fat', 'FAT'),
+ ('it', 'IT'),
+ ('hr_ga', 'HR & GA'),
+ ], string='Departement Type', required=True, tracking=True)
+
+ upah_harian_line = fields.One2many(
+ 'upah.harian.line',
+ 'upah_harian_id',
+ string='Activity Line'
+ )
+
+ total_upah = fields.Float(
+ 'Total Upah Harian',
+ compute='_compute_total_upah',
+ store=True
+ )
+
+ sisa_jam_mingguan = fields.Float(
+ string='Sisa Jam Mingguan',
+ compute='_compute_sisa_jam_mingguan'
+ )
+
+ attachment_type = fields.Selection([
+ ('pdf', 'PDF'),
+ ('image', 'Image')
+ ])
+
+ 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()
+ attachment_filename_pdf = fields.Char()
+
+ # =========================================================
+ # COMPUTE
+ # =========================================================
+
+ @api.depends('upah_harian_line.upah_harian_compute')
+ def _compute_total_upah(self):
+ for rec in self:
+ rec.total_upah = sum(rec.upah_harian_line.mapped('upah_harian_compute'))
+
+ @api.depends('upah_harian_line.jam_masuk', 'upah_harian_line.jam_keluar')
+ def _compute_sisa_jam_mingguan(self):
+
+ MAX = 7.5
+
+ for rec in self:
+ total_kurang = 0
+
+ for line in rec.upah_harian_line:
+
+ jam = max(line.jam_keluar - line.jam_masuk, 0)
+
+ if jam < MAX:
+ total_kurang += (MAX - jam)
+
+ rec.sisa_jam_mingguan = total_kurang
+
+ # =========================================================
+ # ONCHANGE
+ # =========================================================
+
+ @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
+
+ # =========================================================
+ # CREATE
+ # =========================================================
+
+ @api.model
+ def create(self, vals):
+
+ vals['name'] = self.env['ir.sequence'].next_by_code('upah.harian.office')
+
+ return super().create(vals)
+
+ # =========================================================
+ # ACTION
+ # =========================================================
+
+ def action_approve(self):
+
+ if not self.env.user.pic:
+ raise UserError("Only PIC user can approve this document.")
+
+ if self.state == 'draft':
+ self.state = 'approved'
+ self.approved_by = self.env.user.name
+
+ def action_reset_to_draft(self):
+
+ if self.state == 'cancel':
+ self.state = 'draft'
+
+ def action_cancel(self):
+
+ if self.state == 'draft':
+
+ if not self.cancel_reason:
+ raise UserError('Harus Isi Alasan Cancel')
+
+ self.state = 'cancel'
+
+ def action_create_journal_entries(self):
+ return
+
+
+class UpahHarianOfficeLine(models.Model):
+ _name = 'upah.harian.line'
+ _description = 'Upah Harian Line'
+ _order = 'tanggal_line asc'
+
+ MAX_WORKING_HOUR = 7.5
+
+ upah_harian_id = fields.Many2one(
+ 'upah.harian',
+ ondelete='cascade'
+ )
+
+ tanggal_line = fields.Date(
+ 'Tanggal',
+ required=True
+ )
+
+ hari = fields.Char('Hari')
+
+ jam_masuk = fields.Float(
+ 'Jam Masuk',
+ required=True
+ )
+
+ jam_keluar = fields.Float(
+ 'Jam Keluar',
+ required=True
+ )
+
+ kegiatan = fields.Text(
+ 'Kegiatan',
+ required=True
+ )
+
+ is_ganti_jam = fields.Boolean(
+ 'Ganti Jam Kerja',
+ default=False
+ )
+
+ total_jam_kerja = fields.Float(
+ 'Total Jam Kerja',
+ compute='_compute_total_jam_kerja',
+ store=True
+ )
+
+ upah_harian_compute = fields.Float(
+ 'Upah Harian',
+ compute='_compute_upah_harian',
+ store=True
+ )
+
+ # =========================================================
+ # COMPUTE
+ # =========================================================
+
+ @api.depends('jam_masuk', 'jam_keluar', 'is_ganti_jam')
+ def _compute_total_jam_kerja(self):
+ for rec in self:
+
+ if not rec.jam_masuk or not rec.jam_keluar:
+ rec.total_jam_kerja = 0
+ continue
+
+ masuk = rec.jam_masuk
+ keluar = rec.jam_keluar
+
+ if rec.is_ganti_jam:
+ rec.total_jam_kerja = keluar - masuk
+ else:
+ normal_start = 8.5
+ normal_end = 16.5
+
+ start = max(masuk, normal_start)
+ end = min(keluar, normal_end)
+
+ total = end - start
+
+ if total < 0:
+ total = 0
+
+ if total > 7.5:
+ total = 7.5
+
+ rec.total_jam_kerja = total
+
+ @api.depends(
+ 'jam_masuk',
+ 'jam_keluar',
+ 'is_ganti_jam',
+ 'upah_harian_id.upah_harian'
+ )
+ def _compute_upah_harian(self):
+
+ MAX = self.MAX_WORKING_HOUR
+
+ for line in self:
+
+ jam = max(line.jam_keluar - line.jam_masuk, 0)
+
+ jam_final = min(jam, MAX)
+
+ if line.upah_harian_id.upah_harian:
+ rate = line.upah_harian_id.upah_harian / MAX
+ line.upah_harian_compute = jam_final * rate
+ else:
+ line.upah_harian_compute = 0
+
+ # =========================================================
+ # VALIDATION
+ # =========================================================
+
+ @api.constrains('jam_masuk', 'jam_keluar')
+ def _check_jam_valid(self):
+
+ for line in self:
+
+ if line.jam_keluar <= line.jam_masuk:
+ raise ValidationError(
+ "Jam keluar harus lebih besar dari jam masuk."
+ )
+
+ # =========================================================
+ # ONCHANGE
+ # =========================================================
+
+ @api.onchange('tanggal_line')
+ def _onchange_tanggal(self):
+
+ if self.tanggal_line:
+
+ day = self.tanggal_line.strftime('%A')
+
+ mapping = {
+ 'Monday': 'Senin',
+ 'Tuesday': 'Selasa',
+ 'Wednesday': 'Rabu',
+ 'Thursday': 'Kamis',
+ 'Friday': 'Jumat',
+ 'Saturday': 'Sabtu',
+ 'Sunday': 'Minggu',
+ }
+
+ self.hari = mapping.get(day) \ No newline at end of file
diff --git a/indoteknik_custom/security/ir.model.access.csv b/indoteknik_custom/security/ir.model.access.csv
index 041634fc..25c39522 100755
--- a/indoteknik_custom/security/ir.model.access.csv
+++ b/indoteknik_custom/security/ir.model.access.csv
@@ -223,4 +223,7 @@ access_update_depreciation_move_wizard,access.update.depreciation.move.wizard,mo
access_keywords,keywords,model_keywords,base.group_user,1,1,1,1
access_token_log,access.token.log,model_token_log,,1,1,1,1
+access_upah_harian_office,upah.harian.office,model_upah_harian,base.group_user,1,1,1,1
+access_upah_harian_office_line,upah.harian.line,model_upah_harian_line,base.group_user,1,1,1,1
+
access_account_move_change_date_wizard,access.account.move.change.date.wizard,model_account_move_change_date_wizard,,1,1,1,1
diff --git a/indoteknik_custom/views/ir_sequence.xml b/indoteknik_custom/views/ir_sequence.xml
index 55e48300..aa56e46a 100644
--- a/indoteknik_custom/views/ir_sequence.xml
+++ b/indoteknik_custom/views/ir_sequence.xml
@@ -269,5 +269,14 @@
<field name="number_next">1</field>
<field name="number_increment">1</field>
</record>
+
+ <record id="seq_upah_harian_office" model="ir.sequence">
+ <field name="name"></field>
+ <field name="code">upah.harian.office</field>
+ <field name="prefix">UPHO/%(year)s/%(month)s/</field>
+ <field name="padding">4</field>
+ <field name="number_next">1</field>
+ <field name="number_increment">1</field>
+ </record>
</data>
</odoo> \ No newline at end of file
diff --git a/indoteknik_custom/views/upah_harian_office_views.xml b/indoteknik_custom/views/upah_harian_office_views.xml
new file mode 100644
index 00000000..a88a1e66
--- /dev/null
+++ b/indoteknik_custom/views/upah_harian_office_views.xml
@@ -0,0 +1,162 @@
+<?xml version="1.0" encoding="utf-8"?>
+<odoo>
+
+ <!-- ================= TREE ================= -->
+ <record id="view_upah_harian_tree" model="ir.ui.view">
+ <field name="name">view.upah.harian.tree</field>
+ <field name="model">upah.harian</field>
+ <field name="arch" type="xml">
+ <tree>
+ <field name="name"/>
+ <field name="pemohon"/>
+ <field name="tanggal"/>
+ <field name="state"/>
+ </tree>
+ </field>
+ </record>
+
+
+ <!-- ================= FORM ================= -->
+ <record id="view_upah_harian_form" model="ir.ui.view">
+ <field name="name">view.upah.harian.form</field>
+ <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', ['approved'])]}"/>
+
+ <field name="state" widget="statusbar" readonly="1"/>
+
+ </header>
+
+
+ <sheet>
+
+ <div class="oe_title">
+ <h1>
+ <field name="name"/>
+ </h1>
+ </div>
+
+
+ <group>
+
+ <group>
+ <field name="pemohon"/>
+ <field name="departement_type"/>
+ <field name="tanggal"/>
+ <field name="upah_harian"/>
+
+ <field name="sisa_jam_mingguan" class="text-danger" attrs="{'invisible':[('sisa_jam_mingguan','=',0)]}"/>
+ </group>
+
+
+ <!-- ATTACHMENT -->
+ <group>
+
+ <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;"/>
+
+ <field name="total_upah" readonly="1"/>
+
+ </group>
+
+ </group>
+
+
+ <!-- ACTIVITY LINE -->
+ <notebook>
+
+ <page string="Activity Line">
+
+ <field name="upah_harian_line">
+
+ <!-- LIST -->
+ <tree>
+ <field name="tanggal_line"/>
+ <field name="hari"/>
+ <field name="jam_masuk"/>
+ <field name="jam_keluar"/>
+ <field name="total_jam_kerja"/>
+ <field name="is_ganti_jam"/>
+ <field name="kegiatan"/>
+ </tree>
+
+ <!-- POPUP FORM -->
+ <form string="Activity">
+
+ <group col="2">
+
+ <field name="tanggal_line"/>
+ <field name="hari" readonly="1"/>
+
+ <field name="jam_masuk"/>
+ <field name="jam_keluar"/>
+
+ <field name="total_jam_kerja" readonly="1"/>
+
+ <field name="is_ganti_jam"/>
+
+ <field name="kegiatan" colspan="2" widget="text" placeholder="Tuliskan kegiatan hari ini..." style="min-height:120px;"/>
+
+ </group>
+
+ </form>
+
+ </field>
+
+ </page>
+
+ </notebook>
+
+ </sheet>
+
+
+ <!-- CHATTER -->
+ <div class="oe_chatter">
+ <field name="message_follower_ids" widget="mail_followers"/>
+ <field name="message_ids" widget="mail_thread"/>
+ </div>
+
+ </form>
+
+ </field>
+ </record>
+
+
+ <record id="view_upah_harian_search" model="ir.ui.view">
+ <field name="name">view.upah.harian.search</field>
+ <field name="model">upah.harian</field>
+ <field name="arch" type="xml">
+ <search>
+
+ <field name="name"/>
+ <field name="pemohon"/>
+
+ <group expand="1" string="Group By">
+ <filter string="Pemohon" name="group_pemohon" context="{'group_by':'pemohon'}"/>
+ </group>
+
+ </search>
+ </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"/>
+
+</odoo> \ No newline at end of file