diff options
| -rwxr-xr-x | indoteknik_custom/__manifest__.py | 374 | ||||
| -rwxr-xr-x | indoteknik_custom/models/__init__.py | 1 | ||||
| -rw-r--r-- | indoteknik_custom/models/account_move.py | 46 | ||||
| -rw-r--r-- | indoteknik_custom/models/commision.py | 2 | ||||
| -rwxr-xr-x | indoteknik_custom/models/purchase_order.py | 6 | ||||
| -rw-r--r-- | indoteknik_custom/models/refund_sale_order.py | 14 | ||||
| -rwxr-xr-x | indoteknik_custom/models/sale_order.py | 44 | ||||
| -rw-r--r-- | indoteknik_custom/models/upah_harian_office.py | 93 | ||||
| -rwxr-xr-x | indoteknik_custom/security/ir.model.access.csv | 4 | ||||
| -rw-r--r-- | indoteknik_custom/views/account_move.xml | 42 | ||||
| -rw-r--r-- | indoteknik_custom/views/account_move_line.xml | 13 | ||||
| -rw-r--r-- | indoteknik_custom/views/purchasing_job.xml | 24 | ||||
| -rw-r--r-- | indoteknik_custom/views/upah_harian_office_views.xml | 106 |
13 files changed, 528 insertions, 241 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/account_move.py b/indoteknik_custom/models/account_move.py index a317dccc..723f225c 100644 --- a/indoteknik_custom/models/account_move.py +++ b/indoteknik_custom/models/account_move.py @@ -786,6 +786,24 @@ class AccountMove(models.Model): if rec.statement_line_id and not rec.statement_line_id.statement_id.is_edit and rec.statement_line_id.statement_id.state == 'confirm': raise UserError('Bank Statement di Lock, Minta admin reconcile untuk unlock') return res + + def action_open_change_date_wizard(self): + if not self.env.user.is_accounting: + raise UserError('Hanya Accounting yang bisa edit tanggal journal entry') + non_draft = self.filtered(lambda m: m.state != 'draft') + if non_draft: + raise UserError('Hanya invoice dengan status draft yang bisa diubah tanggalnya. Mohon reset ke draft terlebih dahulu.') + return{ + 'name': 'Change Date Journal Entry', + 'type': 'ir.actions.act_window', + 'view_mode': 'form', + 'res_model': 'account.move.change.date.wizard', + 'target': 'new', + 'context':{ + 'active_ids': self.ids, + 'active_model': self._name, + } + } def action_post(self): if self._name != 'account.move': @@ -997,3 +1015,31 @@ class SyncPromiseDateWizardLine(models.TransientModel): date_terima_tukar_faktur = fields.Date(related="invoice_id.date_terima_tukar_faktur", string="Tanggal Terima Tukar Faktur", readonly=True) amount_total = fields.Monetary(related="invoice_id.amount_total", string="Total", readonly=True) currency_id = fields.Many2one(related="invoice_id.currency_id", readonly=True) + +class AccountMoveChangeDateWizard(models.TransientModel): + _name = "account.move.change.date.wizard" + _description = "Account Move Change Date Wizard" + + # move_id = fields.Many2one('account.move', string="Journal Entry", required=True) + new_date = fields.Date(string="New Date", required=True) + + def action_change_date(self): + if not self.env.user.is_accounting: + raise UserError('Hanya Accounting yang bisa ubah tanggal') + + active_ids = self.env.context.get('active_ids', []) + moves = self.env['account.move'].browse(active_ids) + + if not moves: + raise UserError("Tidak ada journal entry yang dipilih.") + + non_draft_moves = moves.filtered(lambda m: m.state != 'draft') + if non_draft_moves: + raise UserError("Hanya journal entry dengan status 'Draft' yang dapat diubah tanggalnya.") + + for move in moves: + move.write({'date': self.new_date}) + move.message_post(body="Tanggal berhasil diubah") + + return {'type': 'ir.actions.act_window_close'} +
\ No newline at end of file diff --git a/indoteknik_custom/models/commision.py b/indoteknik_custom/models/commision.py index 983c07fe..afd36bc7 100644 --- a/indoteknik_custom/models/commision.py +++ b/indoteknik_custom/models/commision.py @@ -443,7 +443,7 @@ class CustomerCommision(models.Model): self.approved_by = (self.approved_by + ', ' if self.approved_by else '') + self.env.user.name self.date_approved_pimpinan = now_naive self.position_pimpinan = 'Pimpinan' - elif self.status == 'pengajuan4' and (self.env.user.id == 1272 or self.env.user.has_group('indoteknik_custom.group_role_it')): + elif self.status == 'pengajuan4' and (self.env.user.id in [1272,14075,571] or self.env.user.has_group('indoteknik_custom.group_role_it')): for line in self.commision_lines: line.invoice_id.is_customer_commision = True if self.commision_type == 'fee': diff --git a/indoteknik_custom/models/purchase_order.py b/indoteknik_custom/models/purchase_order.py index a345b96b..244575ae 100755 --- a/indoteknik_custom/models/purchase_order.py +++ b/indoteknik_custom/models/purchase_order.py @@ -1446,8 +1446,8 @@ class PurchaseOrder(models.Model): send_email = True break - if self.partner_id.id == 5571 and not self.revisi_po: - self.action_create_order_altama() + # if self.partner_id.id == 5571 and not self.revisi_po: + # self.action_create_order_altama() if send_email: if self.is_local_env(): @@ -1484,6 +1484,8 @@ class PurchaseOrder(models.Model): # if len(self) == 1: # _logger.info("Redirecting ke BU") # return self.action_view_related_bu() + if self.partner_id.id == 5571 and not self.revisi_po: + self.action_create_order_altama() return res diff --git a/indoteknik_custom/models/refund_sale_order.py b/indoteknik_custom/models/refund_sale_order.py index 4c3ca52e..6acd0b59 100644 --- a/indoteknik_custom/models/refund_sale_order.py +++ b/indoteknik_custom/models/refund_sale_order.py @@ -680,6 +680,20 @@ class RefundSaleOrder(models.Model): ('journal_id', '=', 13), ('state', '=', 'posted'), ]) + if rec.sale_order_ids: + so_records = rec.sale_order_ids + so_names = so_records.mapped('name') + domain = [ + ('journal_id', '=', 13), + ('state', '=', 'posted'), + ('sale_id', '=', False), + ('ref', 'ilike', 'selisih'), + ] + domain += ['|'] * (len(so_names) - 1) + for name in so_names: + domain.append(('ref', 'ilike', name)) + + misc = self.env['account.move'].search(domain) moves_ongkir = self.env['account.move'] if rec.sale_order_ids: diff --git a/indoteknik_custom/models/sale_order.py b/indoteknik_custom/models/sale_order.py index 0cb6670e..e42f0ce3 100755 --- a/indoteknik_custom/models/sale_order.py +++ b/indoteknik_custom/models/sale_order.py @@ -156,7 +156,7 @@ class SaleOrder(models.Model): total_margin_excl_third_party = fields.Float('Before Margin', help="Before Margin in Sales Order Header") approval_status = fields.Selection([ - ('pengajuan0', 'Approval Team Sales'), + ('pengajuan0', 'Approval Leader Team Sales'), ('pengajuan1', 'Approval Manager'), ('pengajuan2', 'Approval Pimpinan'), ('approved', 'Approved'), @@ -2391,12 +2391,15 @@ class SaleOrder(models.Model): self.check_credit_limit() self.check_limit_so_to_invoice() order.approval_status = 'pengajuan0' - order.message_post(body="Mengajukan approval ke Team Sales_") + order.message_post(body="Mengajukan approval ke Leader Team Sales_") + return self._create_approval_notification('Team Sales') + elif order._requires_approval_team_sales(): + self.check_product_bom() + self.check_credit_limit() + self.check_limit_so_to_invoice() + order.approval_status = 'pengajuan0' + order.message_post(body="Mengajukan approval ke Leader Team Sales") return self._create_approval_notification('Team Sales') - elif order._requires_approval_margin_leader(): - order.approval_status = 'pengajuan2' - order.message_post(body="Mengajukan approval ke Pimpinan") - return self._create_approval_notification('Pimpinan') elif order._requires_approval_margin_manager(): self.check_product_bom() self.check_credit_limit() @@ -2404,13 +2407,11 @@ class SaleOrder(models.Model): order.approval_status = 'pengajuan1' order.message_post(body="Mengajukan approval ke Sales Manager") return self._create_approval_notification('Sales Manager') - elif order._requires_approval_team_sales(): - self.check_product_bom() - self.check_credit_limit() - self.check_limit_so_to_invoice() - order.approval_status = 'pengajuan0' - order.message_post(body="Mengajukan approval ke Team Sales") - return self._create_approval_notification('Team Sales') + elif order._requires_approval_margin_leader(): + order.approval_status = 'pengajuan2' + order.message_post(body="Mengajukan approval ke Pimpinan") + return self._create_approval_notification('Pimpinan') + # elif value_trigger: # self.check_product_bom() # self.check_credit_limit() @@ -2685,18 +2686,19 @@ class SaleOrder(models.Model): value_trigger = order._requires_approval_by_value() if value_trigger: order.approval_status = 'pengajuan0' - order.message_post(body="Mengajukan approval ke Team Sales") + order.message_post(body="Mengajukan approval ke Leader Team Sales") return self._create_approval_notification('Team Sales') - elif order._requires_approval_margin_leader(): - order.approval_status = 'pengajuan2' - return self._create_approval_notification('Pimpinan') - elif order._requires_approval_margin_manager(): - order.approval_status = 'pengajuan1' - return self._create_approval_notification('Sales Manager') elif value_trigger or order._requires_approval_team_sales(): order.approval_status = 'pengajuan0' - order.message_post(body="Mengajukan approval ke Team Sales") + order.message_post(body="Mengajukan approval ke Leader Team Sales") return self._create_approval_notification('Team Sales') + elif order._requires_approval_margin_manager(): + order.approval_status = 'pengajuan1' + return self._create_approval_notification('Sales Manager') + elif order._requires_approval_margin_leader(): + order.approval_status = 'pengajuan2' + return self._create_approval_notification('Pimpinan') + # elif value_trigger: # order.approval_status = 'pengajuan0' # order.message_post(body="Mengajukan approval ke Team Sales (Total SO > 50jt)") diff --git a/indoteknik_custom/models/upah_harian_office.py b/indoteknik_custom/models/upah_harian_office.py index b2c12bd5..d18ce64d 100644 --- a/indoteknik_custom/models/upah_harian_office.py +++ b/indoteknik_custom/models/upah_harian_office.py @@ -2,13 +2,17 @@ from odoo import models, fields, api from odoo.exceptions import UserError, ValidationError class UpahHarianOffice(models.Model): - _name = 'upah.harian.office' - _description = 'Upah Harian Office' + _name = 'upah.harian' + _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) - state = fields.Selection([('draft', 'Draft'), ('done', 'Done')], default='draft') + 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') attachment = fields.Binary('Attachment') approved_by = fields.Char('Approved By') attachment_type = fields.Selection([('pdf', 'PDF'), ('image', 'Image')]) @@ -22,48 +26,99 @@ class UpahHarianOffice(models.Model): ('fat', 'FAT'), ('it', 'IT'), ('hr_ga', 'HR & GA'), - ('pimpinan', 'Pimpinan') ], string='Departement Type', tracking=3, required=True) - total_upah = fields.Float('Total Upah Harian', compute='_compute_total_upah') + is_ganti_jam = fields.Boolean('Ganti Jam?', default="False") + total_upah = fields.Float('Total Upah Harian', compute='_compute_total_upah', readonly=True) + 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.models + + @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): vals['name'] = self.env['ir.sequence'].next_by_code('upah.harian.office') return super(UpahHarianOffice, self).create(vals) def action_approve(self): if self.state == 'draft' and self.env.user.pic: - self.state = 'done' + self.state = 'approved' self.approved_by = self.env.user.name if not self.env.user.pic: raise UserError("Only PIC user can approve this document.") self.state = 'done' + def action_reset_to_draft(self): + if self.state == 'cancel': + self.state = 'draft' + + def action_cancel(self): + if self.state == 'draft': + if self.cancel_reason == '' or self.cancel_reason == False: + raise UserError ('Harus Isi Alasan Cancel') + else: + self.state = 'cancel' + @api.depends('upah_harian_line.upah_harian_compute') def _compute_total_upah(self): - for line in self: - line.total_upah = sum(line.mapped('upah_harian_line').mapped('upah_harian')) + for rec in self: + rec.total_upah = sum(rec.upah_harian_line.mapped('upah_harian_compute')) + + def action_create_journal_entries(self): + return class UpahHarianOfficeLine(models.Model): _name = 'upah.harian.line' _description = 'Upah Harian Line' + _order = 'id asc' + + MAX_WORKING_HOUR = 7.5 - upah_harian_id = fields.Many2one('upah.harian.office') - upah_harian= fields.Float('Upah Harian', required=True, compute='_compute_upah_harian') + upah_harian_id = fields.Many2one('upah.harian') + upah_harian_compute = fields.Float('Upah Harian Computed', required=True, compute='_compute_upah_harian') 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): + @api.depends('total_jam_kerja', 'upah_harian_id.upah_harian') + def _compute_upah_harian(self): for line in self: - line.total_jam_kerja = line.jam + if line.upah_harian_id.upah_harian: + upah_full = line.upah_harian_id.upah_harian + rate_per_hour = upah_full / self.MAX_WORKING_HOUR + line.upah_harian_compute = rate_per_hour * line.total_jam_kerja + else: + line.upah_harian_compute = 0 - def _compute_upah_harian(self): + @api.depends('jam_masuk', 'jam_keluar') + def _compute_total_jam_kerja(self): + for line in self: + if line.jam_keluar and line.jam_masuk: + total = line.jam_keluar - line.jam_masuk + # Maksimal 7.5 jam + if total > self.MAX_WORKING_HOUR: + total = self.MAX_WORKING_HOUR + if total < 0: + total = 0 + line.total_jam_kerja = total + else: + line.total_jam_kerja = 0 + + @api.constrains('jam_masuk', 'jam_keluar') + def _check_jam_valid(self): for line in self: - line.upah_harian = line.jam + if line.jam_keluar <= line.jam_masuk: + raise ValidationError("Jam keluar harus lebih besar dari jam masuk.")
\ 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 42c68e80..362e0951 100755 --- a/indoteknik_custom/security/ir.model.access.csv +++ b/indoteknik_custom/security/ir.model.access.csv @@ -222,3 +222,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/account_move.xml b/indoteknik_custom/views/account_move.xml index c5f9580c..4b9f5316 100644 --- a/indoteknik_custom/views/account_move.xml +++ b/indoteknik_custom/views/account_move.xml @@ -218,6 +218,48 @@ <field name="code">action = records.export_faktur_to_xml()</field> </record> + <record id="action_set_to_draft_journal_entry" model="ir.actions.server"> + <field name="name">Set to Draft</field> + <field name="model_id" ref="account.model_account_move" /> + <field name="binding_model_id" ref="account.model_account_move" /> + <field name="state">code</field> + <field name="code">action = records.button_draft()</field> + </record> + + <!-- <record id="action_account_move_change_date_wizard" model="ir.actions.act_window"> + <field name="name">Change Date</field> + <field name="res_model">account.move.change.date.wizard</field> + <field name="view_mode">form</field> + <field name="target">new</field> + <field name="binding_model_id" ref="account.model_account_move"/> + <field name="binding_view_types">list</field> + </record> --> + + <record id="action_change_date" model="ir.actions.server"> + <field name="name">Change Date</field> + <field name="model_id" ref="account.model_account_move"/> + <field name="binding_model_id" ref="account.model_account_move"/> + <field name="state">code</field> + <field name="code">action = records.action_open_change_date_wizard()</field> + </record> + + <record id="view_account_move_change_date_wizard_form" model="ir.ui.view"> + <field name="name">account.move.change.date.wizard.form</field> + <field name="model">account.move.change.date.wizard</field> + <field name="arch" type="xml"> + <form string="Change Date"> + <p>Ubah tanggal journal yang dipilih, pastikan untuk memeriksa kembali tanggal yang akan diubah sebelum mengkonfirmasi perubahan.</p> + <group> + <field name="new_date"/> + </group> + <footer> + <button name="action_change_date" string="Confirm" type="object" class="btn-primary"/> + <button string="Cancel" class="btn-secondary" special="cancel"/> + </footer> + </form> + </field> + </record> + <record id="view_sync_promise_date_wizard_form" model="ir.ui.view"> <field name="name">sync.promise.date.wizard.form</field> <field name="model">sync.promise.date.wizard</field> diff --git a/indoteknik_custom/views/account_move_line.xml b/indoteknik_custom/views/account_move_line.xml index 346494f3..cb6f6690 100644 --- a/indoteknik_custom/views/account_move_line.xml +++ b/indoteknik_custom/views/account_move_line.xml @@ -24,6 +24,19 @@ </xpath> </field> </record> + <record id="view_account_move_line_filter_inherit" model="ir.ui.view"> + <field name="name">account.move.line.filter.inherit</field> + <field name="model">account.move.line</field> + <field name="inherit_id" ref="account.view_account_move_line_filter"/> + <field name="arch" type="xml"> + <xpath expr="//search/group" position="inside"> + <filter string="Analytic Account" + name="group_by_analytic_account" + domain="[]" + context="{'group_by': 'analytic_account_id'}"/> + </xpath> + </field> + </record> </data> <data> <record id="action_gl_reconcile_server" model="ir.actions.server"> diff --git a/indoteknik_custom/views/purchasing_job.xml b/indoteknik_custom/views/purchasing_job.xml index 8e1eb3b6..16fbb01a 100644 --- a/indoteknik_custom/views/purchasing_job.xml +++ b/indoteknik_custom/views/purchasing_job.xml @@ -7,20 +7,20 @@ <tree decoration-info="(check_pj == False)" create="false" multi_edit="1"> <field name="product_id"/> <field name="vendor_id"/> - <field name="purchase_representative_id"/> - <field name="brand"/> - <field name="item_code"/> - <field name="product"/> - <field name="onhand"/> - <field name="incoming"/> - <field name="outgoing"/> - <field name="status_apo" invisible="1"/> - <field name="action"/> + <field name="purchase_representative_id" optional="hide"/> + <field name="brand" optional="hide"/> + <field name="item_code" optional="hide"/> + <field name="product" optional="hide"/> + <field name="onhand" optional="hide"/> + <field name="incoming" optional="hide"/> + <field name="outgoing" optional="hide"/> + <field name="status_apo" optional="hide" invisible="1"/> + <field name="action" optional="hide"/> <field name="note" optional="hide"/> - <field name="note_detail"/> + <field name="note_detail" optional="hide"/> <field name="date_po" optional="hide"/> - <field name="so_number"/> - <field name="check_pj" invisible="1"/> + <field name="so_number" optional="hide"/> + <field name="check_pj" optional="hide" invisible="1"/> <button name="action_open_job_detail" string="📄" type="object" 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..f8260552 --- /dev/null +++ b/indoteknik_custom/views/upah_harian_office_views.xml @@ -0,0 +1,106 @@ +<?xml version="1.0" encoding="utf-8"?> +<odoo> + + <!-- View upah.harian.office View 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> + + <!-- View upah.harian.office 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', ['done'])]}"/> + <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"/> + </group> + + <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"/> + </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> + </record> + + <!-- View upah.harian.office search --> + <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> + <group expand="1" string="Group By"> + <filter string="Name" name="name" domain="[]" context="{'group_by':'name'}"/> + </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> |
