summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMiqdad <ahmadmiqdad27@gmail.com>2025-07-26 13:34:00 +0700
committerMiqdad <ahmadmiqdad27@gmail.com>2025-07-26 13:34:00 +0700
commit83c6a567c1e2f1b8c281ea405732a286cb20a8c9 (patch)
tree2a96aa7f0960d99dad4add9aa9327630aaea14c4
parent0c5486d6e67cd8bab4913dd177ed9ddf0be36d60 (diff)
<miqdad> fix user cannot access delivery tukar guling
-rw-r--r--indoteknik_custom/models/tukar_guling_po.py25
1 files changed, 17 insertions, 8 deletions
diff --git a/indoteknik_custom/models/tukar_guling_po.py b/indoteknik_custom/models/tukar_guling_po.py
index 14f2cc96..fced7fdb 100644
--- a/indoteknik_custom/models/tukar_guling_po.py
+++ b/indoteknik_custom/models/tukar_guling_po.py
@@ -320,14 +320,23 @@ class TukarGulingPO(models.Model):
def action_view_picking(self):
self.ensure_one()
- action = self.env.ref('stock.action_picking_tree_all').read()[0]
- pickings = self.po_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_po_id', '=', self.id),
+ ])
+
+ if not returs:
+ raise UserError("Doc Retrun Not Found")
+
+ return {
+ 'type': 'ir.actions.act_window',
+ 'name': 'Delivery Pengajuan Retur PO',
+ 'res_model': 'stock.picking',
+ 'view_mode': 'tree,form',
+ 'domain': [('id', 'in', returs.ids)],
+ 'target': 'current',
+ }
def action_draft(self):
"""Reset to draft state"""