diff options
| author | FIN-IT_AndriFP <it@fixcomart.co.id> | 2025-10-08 14:43:49 +0700 |
|---|---|---|
| committer | FIN-IT_AndriFP <it@fixcomart.co.id> | 2025-10-08 14:43:49 +0700 |
| commit | aa754e863440d7fb8884649e53a5961124a4dbbd (patch) | |
| tree | ecdfcd9924ec1082291ff5a585596d64bb5c1c3d | |
| parent | f0c62faa2d65317b3571af84770fe0694072707a (diff) | |
(andri) fix view + dll
| -rw-r--r-- | indoteknik_custom/models/advance_payment_request.py | 28 | ||||
| -rw-r--r-- | indoteknik_custom/views/advance_payment_request.xml | 34 |
2 files changed, 44 insertions, 18 deletions
diff --git a/indoteknik_custom/models/advance_payment_request.py b/indoteknik_custom/models/advance_payment_request.py index 1b5f2c2f..a0fb4d51 100644 --- a/indoteknik_custom/models/advance_payment_request.py +++ b/indoteknik_custom/models/advance_payment_request.py @@ -125,6 +125,10 @@ class AdvancePaymentRequest(models.Model): ('manager', 'Manager'), ('pimpinan', 'Pimpinan')], string='Jabatan') + settlement_type = fields.Selection([ + ('no_settlement', 'Belum Realisasi'), + ('settlement', 'Realisasi') + ]) @api.onchange('nominal') def _onchange_nominal_no_minus(self): @@ -292,8 +296,8 @@ class AdvancePaymentRequest(models.Model): # --------------------------------------- # AP : Manzila (Finance) ID 23 - def _get_departement_approver(self): - mapping = { + def _get_approver_mapping(self): + return { 'sales': 19, 'merchandiser': 19, 'marketing': 216, @@ -302,8 +306,28 @@ class AdvancePaymentRequest(models.Model): 'fat': 28, 'hr_ga': 7, } + + def _get_departement_approver(self): + mapping = self._get_approver_mapping() return mapping.get(self.departement_type) + @api.model + def default_get(self, fields_list): + defaults = super(AdvancePaymentRequest, self).default_get(fields_list) + user_id = defaults.get('user_id', self.env.uid) + mapping = self._get_approver_mapping() + manager_ids = set(mapping.values()) + pimpinan_id = 7 + + position = 'staff' + if user_id == pimpinan_id: + position = 'pimpinan' + elif user_id in manager_ids: + position = 'manager' + + defaults['position_type'] = position + return defaults + def action_realisasi_pum(self): self.ensure_one() diff --git a/indoteknik_custom/views/advance_payment_request.xml b/indoteknik_custom/views/advance_payment_request.xml index 20f43961..0c851d78 100644 --- a/indoteknik_custom/views/advance_payment_request.xml +++ b/indoteknik_custom/views/advance_payment_request.xml @@ -29,18 +29,20 @@ type="object" string="Konfirmasi Pembayaran" class="btn-info" - attrs="{'invisible': ['|', ('status', '=', 'reject'), ('status_pay_down_payment', '=', 'payment')]}"/> + attrs="{'invisible': ['|', ('status', 'in', ['reject','draft']), ('status_pay_down_payment', '=', 'payment')]}"/> <button name="action_ap_only" type="object" string="AP Only" class="btn-info" - attrs="{'invisible': ['|', ('status', '=', 'reject'), ('is_cab_visible', '=', True)]}"/> + attrs="{'invisible': ['|', ('status', 'in', ['approved','reject','draft']), ('is_cab_visible', '=', True)]}"/> <field name="status" widget="statusbar" statusbar_visible="draft,pengajuan1,pengajuan2,pengajuan3,approved" statusbar_colors='{"reject":"red"}' readonly="1"/> </header> <sheet> + <widget name="web_ribbon" title="Payment" attrs="{'invisible': ['|', ('status_pay_down_payment', '!=', 'payment'), ('status', '=', 'draft')]}"/> + <widget name="web_ribbon" title="Pending" bg_color="bg-danger" attrs="{'invisible': ['|', ('status_pay_down_payment', '!=', 'pending'), ('status', '=', 'draft')]}"/> <div class="oe_button_box" name="button_box"> <field name="is_cab_visible" invisible="1"/> <button type="object" @@ -69,28 +71,26 @@ <field name="account_name" colspan="2" attrs="{'readonly': [('status', '=', 'approved')]}"/> <field name="bank_account" colspan="2" attrs="{'readonly': [('status', '=', 'approved')]}"/> <field name="detail_note" attrs="{'readonly': [('status', '=', 'approved')]}"/> - </group> - - <group> + <br/> <field name="user_id" readonly="1"/> + <field name="position_type" readonly="1"/> <!-- <field name="partner_id" readonly="1"/> --> <field name="departement_type"/> - <field name="status_pay_down_payment" - readonly="1" - decoration-success="status_pay_down_payment == 'payment'" - decoration-danger="status_pay_down_payment == 'pending'" - widget="badge"/> - <field name="create_date" readonly="1"/> + <field name="date_back_to_office"/> <field name="estimated_return_date" readonly="1" widget="badge"/> <field name="days_remaining" readonly="1" widget="badge"/> <field name="approved_by" readonly="1"/> + <field name="create_date" readonly="1"/> + <field name="status_pay_down_payment" + readonly="1" + decoration-success="status_pay_down_payment == 'payment'" + decoration-danger="status_pay_down_payment == 'pending'" + widget="badge" invisible = "1"/> <field name="reason_reject" attrs="{'invisible': [('status', '!=', 'reject')], 'readonly': True}"/> </group> - - <notebook> - <page string="Attachment"> - <field name="attachment_type" attrs="{'readonly': [('status', '=', 'approved')]}"/> + <group> + <field name="attachment_type" attrs="{'readonly': [('status', '=', 'approved')]}"/> <field name="attachment_file_pdf" filename="attachment_filename" widget="pdf_viewer" attrs="{'invisible': [('attachment_type', '!=', 'pdf')], 'readonly': [('status', '=', 'approved')]}"/> @@ -100,7 +100,9 @@ attrs="{'invisible': [('attachment_type', '!=', 'image')], 'readonly': [('status', '=', 'approved')]}" style="max-width:250px; max-height:250px; object-fit:contain;"/> <br/> - </page> + </group> + + <notebook> <page string="Reimburse" attrs="{'invisible': [('type_request', '!=', 'reimburse')]}"> <h1>Hello World HEHE</h1> </page> |
