From ea8cad6bf8158bee8d074cb5c493155a87c9b9fe Mon Sep 17 00:00:00 2001 From: Azka Nathan Date: Fri, 17 May 2024 13:53:50 +0700 Subject: fix function onchange on stock picking --- indoteknik_custom/models/stock_picking.py | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/indoteknik_custom/models/stock_picking.py b/indoteknik_custom/models/stock_picking.py index de234067..62d86911 100644 --- a/indoteknik_custom/models/stock_picking.py +++ b/indoteknik_custom/models/stock_picking.py @@ -86,10 +86,11 @@ class StockPicking(models.Model): date_availability = fields.Datetime(string="Date Availability", copy=False, tracking=True) sale_order = fields.Char(string='Matches SO', copy=False) - # @api.onchange('carrier_id') - # def constrains_carrier_id(self): - # if not self.env.user.is_logistic_approver: - # raise UserError('Hanya Logistic yang bisa mengubah shipping method') + @api.onchange('carrier_id') + def constrains_carrier_id(self): + if self.carrier_id: + if not self.env.user.is_logistic_approver: + raise UserError('Hanya Logistic yang bisa mengubah shipping method') def do_unreserve(self): res = super(StockPicking, self).do_unreserve() -- cgit v1.2.3