From ffa3c65f93c3b042fb2cb813c17483e7b8ccc4cf Mon Sep 17 00:00:00 2001 From: Azka Nathan Date: Thu, 21 Nov 2024 09:46:54 +0700 Subject: cr stock picking --- indoteknik_custom/models/stock_picking.py | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/indoteknik_custom/models/stock_picking.py b/indoteknik_custom/models/stock_picking.py index f17e12b7..16805197 100644 --- a/indoteknik_custom/models/stock_picking.py +++ b/indoteknik_custom/models/stock_picking.py @@ -444,15 +444,15 @@ class StockPicking(models.Model): pick.approval_return_status = 'approved' continue - action_context = { - 'picking_ids': [x.id for x in self] - } - if self.picking_type_code == 'outgoing': if self.env.user.id in [3988, 3401, 20] or ( self.env.user.has_group('indoteknik_custom.group_role_purchasing') and 'Return of' in self.origin ): - return self.env['ir.actions.act_window']._for_xml_id('indoteknik_custom.action_stock_return_note_wizard', context=action_context) + action = self.env['ir.actions.act_window']._for_xml_id('indoteknik_custom.action_stock_return_note_wizard') + action['context'] = { + 'picking_ids': [x.id for x in self] + } + return action elif not self.env.user.has_group('indoteknik_custom.group_role_purchasing') and 'Return of' in self.origin: raise UserError('Harus Purchasing yang Ask Return') else: @@ -462,7 +462,11 @@ class StockPicking(models.Model): if self.env.user.has_group('indoteknik_custom.group_role_purchasing') or ( self.env.user.id in [3988, 3401, 20] and 'Return of' in self.origin ): - return self.env['ir.actions.act_window']._for_xml_id('indoteknik_custom.action_stock_return_note_wizard', context=action_context) + action = self.env['ir.actions.act_window']._for_xml_id('indoteknik_custom.action_stock_return_note_wizard') + action['context'] = { + 'picking_ids': [x.id for x in self] + } + return action elif not self.env.user.id in [3988, 3401, 20] and 'Return of' in self.origin: raise UserError('Harus Sales Admin yang Ask Return') else: -- cgit v1.2.3