From 9bd46f112fdfb4fb7f56866b4e260efbd26c6daa Mon Sep 17 00:00:00 2001 From: it-fixcomart Date: Mon, 17 Feb 2025 08:36:01 +0700 Subject: renca req tempo status --- indoteknik_custom/models/user_pengajuan_tempo_request.py | 13 +++++++++++++ indoteknik_custom/views/user_pengajuan_tempo_request.xml | 12 +++++++++++- 2 files changed, 24 insertions(+), 1 deletion(-) diff --git a/indoteknik_custom/models/user_pengajuan_tempo_request.py b/indoteknik_custom/models/user_pengajuan_tempo_request.py index 4a1994fb..be4293a0 100644 --- a/indoteknik_custom/models/user_pengajuan_tempo_request.py +++ b/indoteknik_custom/models/user_pengajuan_tempo_request.py @@ -63,6 +63,19 @@ class UserPengajuanTempoRequest(models.Model): ('reject', 'Rejected'), ], string='Status',) reason_reject = fields.Char(string='Reason Reaject', tracking=True, track_visibility='onchange') + state_tempo_text = fields.Char(string="Status", compute="_compute_state_tempo_text") + + @api.depends('state_tempo') + def _compute_state_tempo_text(self): + for record in self: + status_mapping = { + 'draft': "Menunggu Approve Manager", + 'approval_sales': "Menunggu Approve Finance", + 'approval_finance': "Menunggu Approve Direktur", + 'approval_director': "Approved", + 'reject': "Rejected", + } + record.state_tempo_text = status_mapping.get(record.state_tempo, "Unknown") # informasi perusahaan name_tempo = fields.Many2one('res.partner', string='Nama Perusahaan', related='pengajuan_tempo_id.name_tempo', store=True, tracking=True, readonly=False) diff --git a/indoteknik_custom/views/user_pengajuan_tempo_request.xml b/indoteknik_custom/views/user_pengajuan_tempo_request.xml index f7ad9afb..7063231b 100644 --- a/indoteknik_custom/views/user_pengajuan_tempo_request.xml +++ b/indoteknik_custom/views/user_pengajuan_tempo_request.xml @@ -10,7 +10,17 @@ - + + + + + + + + + + + -- cgit v1.2.3 From b2f39b75e96ef7c80f32ddd7cec86de1eb6c7279 Mon Sep 17 00:00:00 2001 From: it-fixcomart Date: Mon, 17 Feb 2025 08:54:23 +0700 Subject: add logic if cbd not validasi limit --- indoteknik_custom/models/sale_order.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/indoteknik_custom/models/sale_order.py b/indoteknik_custom/models/sale_order.py index 9631fe6e..8a851a69 100755 --- a/indoteknik_custom/models/sale_order.py +++ b/indoteknik_custom/models/sale_order.py @@ -942,6 +942,7 @@ class SaleOrder(models.Model): # Ambil blocking stage dari partner block_stage = rec.partner_id.parent_id.blocking_stage if rec.partner_id.parent_id else rec.partner_id.blocking_stage or 0 + is_cbd = rec.partner_id.parent_id.property_payment_term_id.id == 26 if rec.partner_id.parent_id else rec.partner_id.property_payment_term_id.id == 26 or False # Ambil jumlah nilai dari SO yang invoice_status masih 'to invoice' so_to_invoice = 0 @@ -952,7 +953,7 @@ class SaleOrder(models.Model): remaining_credit_limit = block_stage - current_total - so_to_invoice # Validasi limit - if remaining_credit_limit <= 0 and block_stage > 0: + if remaining_credit_limit <= 0 and block_stage > 0 and not is_cbd: raise UserError(_("The credit limit for %s will exceed the Blocking Stage if the Sale Order is confirmed. The remaining credit limit is %s, from %s and the outstanding amount is %s.") % (rec.partner_id.name, block_stage - current_total, block_stage, outstanding_amount)) -- cgit v1.2.3 From 5f14f6eb9256a7bbdbab8b5ba5482939a479f59a Mon Sep 17 00:00:00 2001 From: it-fixcomart Date: Tue, 18 Feb 2025 08:27:26 +0700 Subject: CR back margin leader approval to 13% --- indoteknik_custom/models/sale_order.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/indoteknik_custom/models/sale_order.py b/indoteknik_custom/models/sale_order.py index 8a851a69..24b1d85c 100755 --- a/indoteknik_custom/models/sale_order.py +++ b/indoteknik_custom/models/sale_order.py @@ -1119,7 +1119,7 @@ class SaleOrder(models.Model): return False def _requires_approval_margin_leader(self): - return self.total_percent_margin <= 13 and not self.env.user.is_leader + return self.total_percent_margin <= 15 and not self.env.user.is_leader def _requires_approval_margin_manager(self): return self.total_percent_margin <= 20 and not self.env.user.is_leader and not self.env.user.is_sales_manager -- cgit v1.2.3 From cbe7af2817b0a18097ace08e63e32e02d7ce4c26 Mon Sep 17 00:00:00 2001 From: it-fixcomart Date: Tue, 18 Feb 2025 09:16:09 +0700 Subject: CR margin approve leader jadi < 15% not <= 15 --- indoteknik_custom/models/sale_order.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/indoteknik_custom/models/sale_order.py b/indoteknik_custom/models/sale_order.py index 24b1d85c..430b4526 100755 --- a/indoteknik_custom/models/sale_order.py +++ b/indoteknik_custom/models/sale_order.py @@ -1119,7 +1119,7 @@ class SaleOrder(models.Model): return False def _requires_approval_margin_leader(self): - return self.total_percent_margin <= 15 and not self.env.user.is_leader + return self.total_percent_margin < 15 and not self.env.user.is_leader def _requires_approval_margin_manager(self): return self.total_percent_margin <= 20 and not self.env.user.is_leader and not self.env.user.is_sales_manager -- cgit v1.2.3 From 80c56615d5c605f6e96cc3567a6b3d0332152957 Mon Sep 17 00:00:00 2001 From: it-fixcomart Date: Tue, 18 Feb 2025 13:16:20 +0700 Subject: CR customer commision --- indoteknik_custom/models/commision.py | 13 +++++++++++++ indoteknik_custom/views/customer_commision.xml | 9 +++++++++ 2 files changed, 22 insertions(+) diff --git a/indoteknik_custom/models/commision.py b/indoteknik_custom/models/commision.py index 48f1c7f6..3f035e2f 100644 --- a/indoteknik_custom/models/commision.py +++ b/indoteknik_custom/models/commision.py @@ -153,6 +153,10 @@ class CustomerCommision(models.Model): bank_account = fields.Char(string='Account No', tracking=3) note_transfer = fields.Char(string='Keterangan') brand_ids = fields.Many2many('x_manufactures', string='Brands') + payment_status = fields.Selection([ + ('pending', 'Pending'), + ('payment', 'Payment'), + ], string='Payment Status', copy=False, readonly=True, tracking=3, default='pending') # add status for type of commision, fee, rebate / cashback # include child or not? @@ -228,6 +232,15 @@ class CustomerCommision(models.Model): raise UserError('Harus di approved oleh yang bersangkutan') return + def action_confirm_customer_payment(self): + group_id = self.env.ref('indoteknik_custom.group_role_fat').id + users_in_group = self.env['res.users'].search([('groups_id', 'in', [group_id])]) + if self.env.user.id not in users_in_group.mapped('id'): + raise UserError('Hanya bisa dikonfirmasi oleh FAT') + else: + self.payment_status = 'payment' + return + def generate_customer_commision(self): if self.commision_lines: raise UserError('Line sudah ada, tidak bisa di generate ulang') diff --git a/indoteknik_custom/views/customer_commision.xml b/indoteknik_custom/views/customer_commision.xml index 0b72587e..55736b0d 100644 --- a/indoteknik_custom/views/customer_commision.xml +++ b/indoteknik_custom/views/customer_commision.xml @@ -12,6 +12,10 @@ + @@ -43,6 +47,10 @@