summaryrefslogtreecommitdiff
path: root/indoteknik_custom/models/tukar_guling.py
diff options
context:
space:
mode:
authorMiqdad <ahmadmiqdad27@gmail.com>2025-09-16 11:31:42 +0700
committerMiqdad <ahmadmiqdad27@gmail.com>2025-09-16 11:31:42 +0700
commitf48a848147216d1cbf736d6926ab7aebffb0deba (patch)
tree9d468b947112ecb9a16d0789d9957e69f3c99347 /indoteknik_custom/models/tukar_guling.py
parent7fe2c169a448df17c9395dfae20c524e94aa8bfc (diff)
<Miqdad> add help and change return type
Diffstat (limited to 'indoteknik_custom/models/tukar_guling.py')
-rw-r--r--indoteknik_custom/models/tukar_guling.py24
1 files changed, 12 insertions, 12 deletions
diff --git a/indoteknik_custom/models/tukar_guling.py b/indoteknik_custom/models/tukar_guling.py
index d718ba0f..c683f75a 100644
--- a/indoteknik_custom/models/tukar_guling.py
+++ b/indoteknik_custom/models/tukar_guling.py
@@ -61,7 +61,7 @@ class TukarGuling(models.Model):
notes = fields.Text('Notes')
return_type = fields.Selection(String='Return Type', selection=[
('tukar_guling', 'Tukar Guling'), # -> barang yang sama
- ('revisi_so', 'Revisi SO')], required=True, tracking=3)
+ ('retur_so', 'Retur SO')], required=True, tracking=3, help='Retur SO (ORT-SRT),\n Tukar Guling (ORT-SRT-PICK-OUT)')
state = fields.Selection(string='Status', selection=[
('draft', 'Draft'),
('approval_sales', ' Approval Sales'),
@@ -169,7 +169,7 @@ class TukarGuling(models.Model):
raise UserError("❌ Picking type harus BU/OUT atau BU/PICK")
for rec in self:
if rec.operations and rec.operations.picking_type_id.id == 30:
- rec.return_type = 'revisi_so'
+ rec.return_type = 'retur_so'
if self.operations:
from_return_picking = self.env.context.get('from_return_picking', False) or \
@@ -315,7 +315,7 @@ class TukarGuling(models.Model):
@api.constrains('return_type', 'operations')
def _check_required_bu_fields(self):
for record in self:
- if record.return_type in ['revisi_so', 'tukar_guling'] and not record.operations:
+ if record.return_type in ['retur_so', 'tukar_guling'] and not record.operations:
raise ValidationError("Operations harus diisi")
@api.constrains('line_ids', 'state')
@@ -352,16 +352,16 @@ class TukarGuling(models.Model):
# ('state', '!=', 'cancel')
# ]) > 0
- # def _check_invoice_on_revisi_so(self):
+ # def _check_invoice_on_retur_so(self):
# for record in self:
- # if record.return_type == 'revisi_so' and record.origin:
+ # if record.return_type == 'retur_so' and record.origin:
# invoices = self.env['account.move'].search([
# ('invoice_origin', 'ilike', record.origin),
# ('state', 'not in', ['draft', 'cancel'])
# ])
# if invoices:
# raise ValidationError(
- # _("Tidak bisa memilih Return Type 'Revisi SO' karena dokumen %s sudah dibuat invoice.") % record.origin
+ # _("Tidak bisa memilih Return Type 'Retur SO' karena dokumen %s sudah dibuat invoice.") % record.origin
# )
@@ -414,7 +414,7 @@ class TukarGuling(models.Model):
self.ensure_one()
if self.operations.picking_type_id.id not in [29, 30]:
raise UserError("❌ Picking type harus BU/OUT atau BU/PICK")
- # self._check_invoice_on_revisi_so()
+ # self._check_invoice_on_retur_so()
operasi = self.operations.picking_type_id.id
tipe = self.return_type
pp = vals.get('return_type', tipe)
@@ -530,7 +530,7 @@ class TukarGuling(models.Model):
raise UserError(
_("Qty di Koli tidak sesuai dengan qty retur untuk produk %s") % line.product_id.display_name
)
- # self._check_invoice_on_revisi_so()
+ # self._check_invoice_on_retur_so()
self._validate_product_lines()
if self.state != 'draft':
@@ -553,7 +553,7 @@ class TukarGuling(models.Model):
self.state = 'done'
# OUT revisi SO
- elif self.operations.picking_type_id.id == 29 and self.return_type == 'revisi_so':
+ elif self.operations.picking_type_id.id == 29 and self.return_type == 'retur_so':
total_ort = self.env['stock.picking'].search_count([
('tukar_guling_id', '=', self.id),
('picking_type_id', '=', 74),
@@ -567,7 +567,7 @@ class TukarGuling(models.Model):
self.state = 'done'
# PICK revisi SO
- elif self.operations.picking_type_id.id == 30 and self.return_type == 'revisi_so':
+ elif self.operations.picking_type_id.id == 30 and self.return_type == 'retur_so':
done_ort = self.env['stock.picking'].search([
('tukar_guling_id', '=', self.id),
('picking_type_id', '=', 74),
@@ -581,7 +581,7 @@ class TukarGuling(models.Model):
def action_approve(self):
self.ensure_one()
self._validate_product_lines()
- # self._check_invoice_on_revisi_so()
+ # self._check_invoice_on_retur_so()
self._check_not_allow_tukar_guling_on_bu_pick()
operasi = self.operations.picking_type_id.id
@@ -631,7 +631,7 @@ class TukarGuling(models.Model):
elif rec.state == 'approval_finance':
if not rec.env.user.has_group('indoteknik_custom.group_role_fat'):
raise UserError("Hanya Finance Manager yang boleh approve tahap ini.")
- # rec._check_invoice_on_revisi_so()
+ # rec._check_invoice_on_retur_so()
rec.set_opt()
rec.state = 'approval_logistic'
rec.date_finance = now