diff options
| author | Miqdad <ahmadmiqdad27@gmail.com> | 2025-07-26 14:33:16 +0700 |
|---|---|---|
| committer | Miqdad <ahmadmiqdad27@gmail.com> | 2025-07-26 14:33:16 +0700 |
| commit | 7cea5aa18bea9b80ace297bfc36eec8db1adef6e (patch) | |
| tree | ff6036ab08fdc4f3997149eb228a2a01ce2924e4 /indoteknik_custom/models | |
| parent | ae201ad5ac392a75da087a5e1215f9b8fcd50dba (diff) | |
| parent | 83c6a567c1e2f1b8c281ea405732a286cb20a8c9 (diff) | |
Merge branch 'odoo-backup' of https://bitbucket.org/altafixco/indoteknik-addons into is_discweb_so_line
Merge
Diffstat (limited to 'indoteknik_custom/models')
| -rw-r--r-- | indoteknik_custom/models/tukar_guling.py | 25 | ||||
| -rw-r--r-- | indoteknik_custom/models/tukar_guling_po.py | 25 |
2 files changed, 34 insertions, 16 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""" 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""" |
