From 837228a2b4b799de182e52096f638ee5f491137a Mon Sep 17 00:00:00 2001 From: stephanchrst Date: Tue, 20 Jun 2023 18:00:42 +0700 Subject: fix code receipt approval --- indoteknik_custom/models/stock_picking.py | 11 ++++++++--- indoteknik_custom/views/stock_picking.xml | 24 ++++++++++++++++-------- 2 files changed, 24 insertions(+), 11 deletions(-) diff --git a/indoteknik_custom/models/stock_picking.py b/indoteknik_custom/models/stock_picking.py index 74fd0356..d8c24e10 100644 --- a/indoteknik_custom/models/stock_picking.py +++ b/indoteknik_custom/models/stock_picking.py @@ -57,7 +57,7 @@ class StockPicking(models.Model): approval_receipt_status = fields.Selection([ ('pengajuan1', 'Approval Logistic'), ('approved', 'Approved'), - ], string='Approval Status', readonly=True, copy=False, index=True, tracking=3, help="Approval Status untuk Receipt") + ], string='Approval Receipt Status', readonly=True, copy=False, index=True, tracking=3, help="Approval Status untuk Receipt") approval_return_status = fields.Selection([ ('pengajuan1', 'Approval Finance'), @@ -211,6 +211,12 @@ class StockPicking(models.Model): raise UserError("Qty tidak boleh 0") pick.approval_status = 'pengajuan1' + def ask_receipt_approval(self): + if self.env.user.is_logistic_approver: + raise UserError('Bisa langsung validate tanpa Ask Receipt') + else: + self.approval_receipt_status = 'pengajuan1' + def ask_return_approval(self): for pick in self: if self.env.user.is_accounting: @@ -270,9 +276,8 @@ class StockPicking(models.Model): if self.is_internal_use and not self.env.user.is_accounting: raise UserError("Harus di Approve oleh Accounting") - print(self.picking_type_id.id) if self.picking_type_id.id == 28 and not self.env.user.is_logistic_approver: - raise UserError("Harus di Approve oleh Eplin") + raise UserError("Harus di Approve oleh Logistik") if self.group_id.sale_id: if self.group_id.sale_id.payment_link_midtrans: diff --git a/indoteknik_custom/views/stock_picking.xml b/indoteknik_custom/views/stock_picking.xml index 02003e05..f95db854 100644 --- a/indoteknik_custom/views/stock_picking.xml +++ b/indoteknik_custom/views/stock_picking.xml @@ -27,6 +27,11 @@ type="object" attrs="{'invisible': [('is_internal_use', '=', False)]}" /> + - @@ -53,8 +52,6 @@ - - + + + + + + -- cgit v1.2.3