From 3f4271bf3c924da7b73588de32c670ea00a7e564 Mon Sep 17 00:00:00 2001 From: Mqdd Date: Wed, 11 Mar 2026 17:01:02 +0700 Subject: need to change the permission for harian finance --- indoteknik_custom/__manifest__.py | 1 + indoteknik_custom/models/res_users.py | 1 + indoteknik_custom/models/sale_order.py | 2 +- indoteknik_custom/models/upah_harian_office.py | 18 +++++++++--------- indoteknik_custom/security/ir.model.access.csv | 7 +++++-- indoteknik_custom/security/upah_harian_security.xml | 16 ++++++++++++++++ indoteknik_custom/views/upah_harian_office_views.xml | 20 ++++++++++---------- indoteknik_custom/views/users.xml | 1 + 8 files changed, 44 insertions(+), 22 deletions(-) create mode 100644 indoteknik_custom/security/upah_harian_security.xml diff --git a/indoteknik_custom/__manifest__.py b/indoteknik_custom/__manifest__.py index 77a49e96..656ad4cd 100755 --- a/indoteknik_custom/__manifest__.py +++ b/indoteknik_custom/__manifest__.py @@ -11,6 +11,7 @@ 'depends': ['base', 'coupon', 'delivery', 'sale', 'sale_management', 'vit_kelurahan', 'vit_efaktur', 'proweb_kartu_stok'], "data": [ "security/ir.model.access.csv", + "security/upah_harian_security.xml", "views/account_account_views.xml", "views/account_asset_views.xml", "views/account_bank_statement.xml", diff --git a/indoteknik_custom/models/res_users.py b/indoteknik_custom/models/res_users.py index 8f5b4008..0c1d2fa0 100755 --- a/indoteknik_custom/models/res_users.py +++ b/indoteknik_custom/models/res_users.py @@ -13,6 +13,7 @@ class ResUsers(models.Model): 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') + harian = fields.Boolean('Harian') def _generate_otp(self): diff --git a/indoteknik_custom/models/sale_order.py b/indoteknik_custom/models/sale_order.py index e42f0ce3..d0e5e5d8 100755 --- a/indoteknik_custom/models/sale_order.py +++ b/indoteknik_custom/models/sale_order.py @@ -2429,7 +2429,7 @@ class SaleOrder(models.Model): user = self.env.user is_sales_admin = user.id in (3401, 20, 3988, 17340) if is_sales_admin: - order.approval_status = 'pengajuan1' + order.approval_status = 'pengajuan0' order.message_post(body="Mengajukan approval ke Sales") return self._create_approval_notification('Sales') diff --git a/indoteknik_custom/models/upah_harian_office.py b/indoteknik_custom/models/upah_harian_office.py index d5ee5878..17db4a92 100644 --- a/indoteknik_custom/models/upah_harian_office.py +++ b/indoteknik_custom/models/upah_harian_office.py @@ -78,13 +78,11 @@ class UpahHarian(models.Model): attachment_file_image = fields.Binary( string='Attachment Image', attachment_filename='attachment_filename_image', - compute = 'auto_paid_attachment' ) attachment_file_pdf = fields.Binary( string='Attachment PDF', attachment_filename='attachment_filename_pdf', - compute = 'auto_paid_attachment' ) attachment_filename_image = fields.Char() @@ -192,16 +190,18 @@ class UpahHarian(models.Model): self.approved_by_dept = False or "" self.approved_by_finance = False or "" - @api.depends('attachment_file_image', 'attachment_file_pdf') - def auto_paid_attachment(self): - if self.attachment_file_image or self.attachment_file_pdf: - self.state = 'paid' - self.message_post(body = _("Auto Paid by %s") % self.env.user.name) + def write(self, vals): + res = super().write(vals) + if 'attachment_file_image' in vals or 'attachment_file_pdf' in vals: + for rec in self: + if rec.attachment_file_image or rec.attachment_file_pdf: + rec.state = 'paid' + + return res def action_create_journal_entries(self): - - if self.env.user.has_group('indoteknik_custom.group_role_fat'): + if not self.env.user.has_group('indoteknik_custom.group_role_fat'): raise UserError("Hanya Finance yang bisa create journal") move = self.env['account.move'].create({ diff --git a/indoteknik_custom/security/ir.model.access.csv b/indoteknik_custom/security/ir.model.access.csv index 25c39522..7e00c6a9 100755 --- a/indoteknik_custom/security/ir.model.access.csv +++ b/indoteknik_custom/security/ir.model.access.csv @@ -224,6 +224,9 @@ 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_upah_harian_office_line,upah.harian.line,model_upah_harian_line,base.group_user,1,1,1,0 -access_account_move_change_date_wizard,access.account.move.change.date.wizard,model_account_move_change_date_wizard,,1,1,1,1 +access_upah_harian_user,access.upah.harian.user,model_upah_harian,base.group_user,1,1,1,0 +access_upah_harian_line,upah.harian.line,model_upah_harian_line,base.group_user,1,1,1,0 + +access_account_move_change_date_wizard,access.account.move.change.date.wizard,model_account_move_change_date_wizard,,1,1,1,1 \ No newline at end of file diff --git a/indoteknik_custom/security/upah_harian_security.xml b/indoteknik_custom/security/upah_harian_security.xml new file mode 100644 index 00000000..8d17c84e --- /dev/null +++ b/indoteknik_custom/security/upah_harian_security.xml @@ -0,0 +1,16 @@ + + + Upah Harian - Own Only + + [('pemohon','=',user.id), ('pemohon.harian', '=', True)] + + + + + Upah Harian - Finance All + + [(1,'=',1)] + + + + \ 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 index 7b84bd5c..8e49db03 100644 --- a/indoteknik_custom/views/upah_harian_office_views.xml +++ b/indoteknik_custom/views/upah_harian_office_views.xml @@ -37,15 +37,11 @@ - - +
+ +

@@ -79,10 +75,13 @@ - + + + + @@ -102,6 +101,7 @@ + diff --git a/indoteknik_custom/views/users.xml b/indoteknik_custom/views/users.xml index 2e464458..257de2b3 100644 --- a/indoteknik_custom/views/users.xml +++ b/indoteknik_custom/views/users.xml @@ -17,6 +17,7 @@ + -- cgit v1.2.3