diff options
| author | Miqdad <ahmadmiqdad27@gmail.com> | 2025-06-24 08:41:47 +0700 |
|---|---|---|
| committer | Miqdad <ahmadmiqdad27@gmail.com> | 2025-06-24 08:41:47 +0700 |
| commit | 0d95dabc04a3f5334168e989705e9a7568130df4 (patch) | |
| tree | 72dee655de11cea02cbe36114e560b35d3e6db6d | |
| parent | f0f3e9d142dd435c9740f6d6c439e1b400a36c45 (diff) | |
<miqdad> spesific tf
| -rw-r--r-- | indoteknik_custom/models/tukar_guling.py | 8 | ||||
| -rw-r--r-- | indoteknik_custom/views/tukar_guling.xml | 2 |
2 files changed, 8 insertions, 2 deletions
diff --git a/indoteknik_custom/models/tukar_guling.py b/indoteknik_custom/models/tukar_guling.py index dfa62dc8..d75dad41 100644 --- a/indoteknik_custom/models/tukar_guling.py +++ b/indoteknik_custom/models/tukar_guling.py @@ -25,6 +25,7 @@ class TukarGuling(models.Model): date = fields.Datetime('Date', default=fields.Datetime.now, required=True) operations = fields.Many2one('stock.picking', 'Operations', domain=[('picking_type_id.code', '=', 'outgoing')], help='Nomor BU/Out atau BU/Pick') + spesific_operations = fields.Many2one('stock.picking', 'Spesific Operations', domain = [('origin', '=', origin), ('state', '=', 'done')]) ba_num = fields.Text('Nomor BA') notes = fields.Text('Notes') return_type = fields.Selection(String='Return Type', selection=[ @@ -44,6 +45,10 @@ class TukarGuling(models.Model): @api.onchange('operations') def _onchange_operations(self): """Auto-populate lines ketika operations dipilih""" + if self.origin: + return {'domain': { + 'specific_transfers': [('origin', '=', self.origin), ('state', '=', 'done')] + }} if self.operations: from_return_picking = self.env.context.get('from_return_picking', False) or \ self.env.context.get('default_line_ids', False) @@ -294,7 +299,6 @@ class TukarGuling(models.Model): operation_picking = record.operations - # 1. Cari semua picking DONE berdasarkan origin SO related_pickings = self.env['stock.picking'].search([ ('origin', '=', record.origin), ('state', '=', 'done'), @@ -391,6 +395,8 @@ class TukarGuling(models.Model): 'quantity': line.product_uom_qty, 'move_id': move.id, })) + if not move: + raise UserError("eror woi") if not return_lines: return None diff --git a/indoteknik_custom/views/tukar_guling.xml b/indoteknik_custom/views/tukar_guling.xml index 942f085d..7bc783eb 100644 --- a/indoteknik_custom/views/tukar_guling.xml +++ b/indoteknik_custom/views/tukar_guling.xml @@ -12,7 +12,7 @@ <menuitem id="menu_pengajuan_tukar_guling" name="Pengajuan Return SO" - parent="sale.sale_order_menu" + parent="sale.menu_sale_report" sequence="3" action="action_pengajuan_tukar_guling" /> |
