diff options
| -rwxr-xr-x | indoteknik_custom/__manifest__.py | 1 | ||||
| -rwxr-xr-x | indoteknik_custom/models/res_users.py | 1 | ||||
| -rwxr-xr-x | indoteknik_custom/models/sale_order.py | 2 | ||||
| -rw-r--r-- | indoteknik_custom/models/upah_harian_office.py | 18 | ||||
| -rwxr-xr-x | indoteknik_custom/security/ir.model.access.csv | 7 | ||||
| -rw-r--r-- | indoteknik_custom/security/upah_harian_security.xml | 16 | ||||
| -rw-r--r-- | indoteknik_custom/views/upah_harian_office_views.xml | 20 | ||||
| -rw-r--r-- | indoteknik_custom/views/users.xml | 1 |
8 files changed, 44 insertions, 22 deletions
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 @@ +<odoo> + <record id="upah_harian_rule_user_own" model="ir.rule"> + <field name="name">Upah Harian - Own Only</field> + <field name="model_id" ref="model_upah_harian"/> + <field name="domain_force">[('pemohon','=',user.id), ('pemohon.harian', '=', True)]</field> + <field name="groups" eval="[(4, ref('base.group_user'))]"/> + </record> + + <record id="upah_harian_rule_finance_all" model="ir.rule"> + <field name="name">Upah Harian - Finance All</field> + <field name="model_id" ref="model_upah_harian"/> + <field name="domain_force">[(1,'=',1)]</field> + <field name="groups" eval="[(4, ref('indoteknik_custom.group_role_fat'))]"/> + </record> + +</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 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 @@ <sheet> - <button name="action_open_journal" - type="object" - class="oe_stat_button" - icon="fa-book" - width="250px" - attrs="{'invisible': [('journal_upah_id', '=', False)]}"> - <field name="journal_upah_id" string="Journal" widget="statinfo"/> - </button> - + <div class="oe_button_box"> + <button name="action_open_journal" type="object" class="oe_stat_button" icon="fa-book" width="250px" attrs="{'invisible': [('journal_upah_id', '=', False)]}"> + <field name="journal_upah_id" string="Journal" widget="statinfo"/> + </button> + </div> <div class="oe_title"> <h1> <field name="name"/> @@ -79,10 +75,13 @@ <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> + <field name="total_upah" readonly="1"/> + </group> + </group> @@ -102,6 +101,7 @@ <field name="total_jam_kerja"/> <field name="is_ganti_jam"/> <field name="kegiatan"/> + <field name="upah_harian_compute"/> </tree> <!-- POPUP FORM --> 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 @@ <field name="is_outbound"/> <field name="is_inbound"/> <field name="pic"/> + <field name="harian"/> </field> </field> </record> |
