diff options
| author | Miqdad <ahmadmiqdad27@gmail.com> | 2025-07-26 13:32:59 +0700 |
|---|---|---|
| committer | Miqdad <ahmadmiqdad27@gmail.com> | 2025-07-26 13:32:59 +0700 |
| commit | 0c5486d6e67cd8bab4913dd177ed9ddf0be36d60 (patch) | |
| tree | 63c61e78feaf0497b23b6e5cad623ccb5ab689ac | |
| parent | 77e76f376b78733cad58aa196e3ead3c6a04ff42 (diff) | |
<miqdad> fix user cannot access delivery tukar guling
| -rw-r--r-- | indoteknik_custom/models/tukar_guling.py | 25 |
1 files changed, 17 insertions, 8 deletions
diff --git a/indoteknik_custom/models/tukar_guling.py b/indoteknik_custom/models/tukar_guling.py index 43bc156e..26b98e32 100644 --- a/indoteknik_custom/models/tukar_guling.py +++ b/indoteknik_custom/models/tukar_guling.py @@ -386,14 +386,23 @@ class TukarGuling(models.Model): def action_view_picking(self): self.ensure_one() - action = self.env.ref('stock.action_picking_tree_all').read()[0] - pickings = self.picking_ids - if len(pickings) > 1: - action['domain'] = [('id', 'in', pickings.ids)] - elif pickings: - action['views'] = [(self.env.ref('stock.view_picking_form').id, 'form')] - action['res_id'] = pickings.id - return action + + # picking_origin = f"Return of {self.operations.name}" + returs = self.env['stock.picking'].search([ + ('tukar_guling_id', '=', self.id), + ]) + + if not returs: + raise UserError("Doc Retrun Not Found") + + return { + 'type': 'ir.actions.act_window', + 'name': 'Delivery Pengajuan Retur SO', + 'res_model': 'stock.picking', + 'view_mode': 'tree,form', + 'domain': [('id', 'in', returs.ids)], + 'target': 'current', + } def action_draft(self): """Reset to draft state""" |
