diff options
| author | Miqdad <ahmadmiqdad27@gmail.com> | 2025-06-26 15:23:24 +0700 |
|---|---|---|
| committer | Miqdad <ahmadmiqdad27@gmail.com> | 2025-06-26 15:23:24 +0700 |
| commit | 1e01a6845781821fcf65a42c4528b3efe144e28c (patch) | |
| tree | 7ef57c207c5a93fd53b9ff527729577fd4cd61a6 | |
| parent | 7ac0e952f1ce4be4bbe3c374a646a7b106746581 (diff) | |
<miqdad> show bu pick where the bu out is not done
| -rw-r--r-- | indoteknik_custom/models/tukar_guling.py | 18 | ||||
| -rw-r--r-- | indoteknik_custom/views/tukar_guling.xml | 1 |
2 files changed, 8 insertions, 11 deletions
diff --git a/indoteknik_custom/models/tukar_guling.py b/indoteknik_custom/models/tukar_guling.py index 77538c91..6fbca20c 100644 --- a/indoteknik_custom/models/tukar_guling.py +++ b/indoteknik_custom/models/tukar_guling.py @@ -24,8 +24,10 @@ class TukarGuling(models.Model): name = fields.Char('Number', required=True, copy=False, readonly=True, default='New') date = fields.Datetime('Date', default=fields.Datetime.now, required=True) operations = fields.Many2one('stock.picking', 'Operations', - domain=[('picking_type_id.sequence_code', 'in', ['OUT', 'PICK']), - ('state', '=', 'done')], help='Nomor BU/Out atau BU/Pick') + domain=[('picking_type_id.sequence_code', '=', 'OUT'), + ('state', '=', 'done'), '&', + ('picking_type_id.sequence_code', '=', 'PICK'), + ('state', '!=', 'done')], help='Nomor BU/Out atau BU/Pick') ba_num = fields.Text('Nomor BA') notes = fields.Text('Notes') return_type = fields.Selection(String='Return Type', selection=[ @@ -76,11 +78,6 @@ class TukarGuling(models.Model): elif hasattr(self.operations, 'move_lines') and self.operations.move_lines: moves_to_check = self.operations.move_lines - # Debug logging - _logger = logging.getLogger(__name__) - _logger.info(f"BU/OUT: {self.operations.name}, State: {self.operations.state}") - _logger.info(f"Total moves found: {len(moves_to_check)}") - for move in moves_to_check: _logger.info( f"Move: {move.name}, Product: {move.product_id.name if move.product_id else 'No Product'}, Qty: {move.product_uom_qty}, State: {move.state}") @@ -115,7 +112,7 @@ class TukarGuling(models.Model): """Manual button untuk populate lines - sebagai alternatif""" self.ensure_one() if not self.operations: - raise UserError("Pilih BU/OUT terlebih dahulu!") + raise UserError("Pilih BU/OUT atau BU/PICK terlebih dahulu!") # Clear existing lines self.line_ids = [(5, 0, 0)] @@ -144,7 +141,7 @@ class TukarGuling(models.Model): def _check_required_bu_fields(self): for record in self: if record.return_type in ['revisi_so', 'tukar_guling'] and not record.operations: - raise ValidationError("BU/Out harus diisi!") + raise ValidationError("Operations harus diisi") @api.constrains('line_ids', 'state') def _check_product_lines(self): @@ -178,7 +175,6 @@ class TukarGuling(models.Model): def create(self, vals): # Generate sequence number if not vals.get('name') or vals['name'] == 'New': - # Pastikan sequence code 'tukar.guling' ada sequence = self.env['ir.sequence'].search([('code', '=', 'tukar.guling')], limit=1) if sequence: vals['name'] = sequence.next_by_id() @@ -257,7 +253,7 @@ class TukarGuling(models.Model): self.ensure_one() if not self.operations: - raise UserError("BU/Out harus diisi!") + raise UserError("Operations harus diisi!") if not self.return_type: raise UserError("Return Type harus diisi!") diff --git a/indoteknik_custom/views/tukar_guling.xml b/indoteknik_custom/views/tukar_guling.xml index 9d281986..633f1da4 100644 --- a/indoteknik_custom/views/tukar_guling.xml +++ b/indoteknik_custom/views/tukar_guling.xml @@ -86,6 +86,7 @@ 'required': [('return_type', 'in', ['revisi_so'])] }"/> <field name="origin" readonly="1"/> +<!-- <field name="origin_so" readonly="1"/>--> </group> <group> <field name="ba_num" string="Nomor BA"/> |
