summaryrefslogtreecommitdiff
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
parent7fe2c169a448df17c9395dfae20c524e94aa8bfc (diff)
<Miqdad> add help and change return type
-rw-r--r--indoteknik_custom/models/tukar_guling.py24
-rw-r--r--indoteknik_custom/models/tukar_guling_po.py24
-rw-r--r--indoteknik_custom/views/tukar_guling_po.xml2
3 files changed, 25 insertions, 25 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
diff --git a/indoteknik_custom/models/tukar_guling_po.py b/indoteknik_custom/models/tukar_guling_po.py
index f2f37606..f61b3828 100644
--- a/indoteknik_custom/models/tukar_guling_po.py
+++ b/indoteknik_custom/models/tukar_guling_po.py
@@ -38,9 +38,9 @@ class TukarGulingPO(models.Model):
)
ba_num = fields.Char('Nomor BA', tracking=3)
return_type = fields.Selection([
- ('revisi_po', 'Revisi PO'),
+ ('retur_po', 'Retur PO'),
('tukar_guling', 'Tukar Guling'),
- ], string='Return Type', required=True, tracking=3)
+ ], string='Return Type', required=True, tracking=3, help='Retur PO (VRT-PRT),\n Tukar Guling (VRT-PRT-INPUT-PUT')
notes = fields.Text('Notes', tracking=3)
tukar_guling_po_id = fields.Many2one('tukar.guling.po', string='Tukar Guling PO', ondelete='cascade')
line_ids = fields.One2many('tukar.guling.line.po', 'tukar_guling_po_id', string='Product Lines', tracking=3)
@@ -143,9 +143,9 @@ class TukarGulingPO(models.Model):
return res
- # def _check_bill_on_revisi_po(self):
+ # def _check_bill_on_retur_po(self):
# for record in self:
- # if record.return_type == 'revisi_po' and record.origin:
+ # if record.return_type == 'retur_po' and record.origin:
# bills = self.env['account.move'].search([
# ('invoice_origin', 'ilike', record.origin),
# ('move_type', '=', 'in_invoice'), # hanya vendor bill
@@ -153,7 +153,7 @@ class TukarGulingPO(models.Model):
# ])
# if bills:
# raise ValidationError(
- # _("Tidak bisa memilih Return Type 'Revisi PO' karena PO %s sudah dibuat vendor bill. Harus Cancel Jika ingin melanjutkan") % record.origin
+ # _("Tidak bisa memilih Return Type 'Retur PO' karena PO %s sudah dibuat vendor bill. Harus Cancel Jika ingin melanjutkan") % record.origin
# )
@api.onchange('operations')
@@ -284,7 +284,7 @@ class TukarGulingPO(models.Model):
@api.constrains('return_type', 'operations')
def _check_required_bu_fields(self):
for record in self:
- if record.return_type in ['revisi_po', 'tukar_guling'] and not record.operations:
+ if record.return_type in ['retur_po', 'tukar_guling'] and not record.operations:
raise ValidationError("Operations harus diisi")
@api.constrains('line_ids', 'state')
@@ -350,7 +350,7 @@ class TukarGulingPO(models.Model):
def write(self, vals):
if self.operations.picking_type_id.id not in [75, 28]:
raise UserError("❌ Tidak bisa retur bukan BU/INPUT atau BU/PUT!")
- # self._check_bill_on_revisi_po()
+ # self._check_bill_on_retur_po()
tipe = vals.get('return_type', self.return_type)
if self.operations and self.operations.picking_type_id.id == 28 and tipe == 'tukar_guling':
@@ -418,7 +418,7 @@ class TukarGulingPO(models.Model):
def action_submit(self):
self.ensure_one()
- # self._check_bill_on_revisi_po()
+ # self._check_bill_on_retur_po()
self._validate_product_lines()
self._check_not_allow_tukar_guling_on_bu_input()
@@ -463,7 +463,7 @@ class TukarGulingPO(models.Model):
def action_approve(self):
self.ensure_one()
self._validate_product_lines()
- # self._check_bill_on_revisi_po()
+ # self._check_bill_on_retur_po()
self._check_not_allow_tukar_guling_on_bu_input()
if not self.operations:
@@ -485,7 +485,7 @@ class TukarGulingPO(models.Model):
elif rec.state == 'approval_finance':
if not rec.env.user.has_group('indoteknik_custom.group_role_fat'):
raise UserError("Hanya Finance yang boleh approve tahap ini.")
- # rec._check_bill_on_revisi_po()
+ # rec._check_bill_on_retur_po()
rec.set_opt()
rec.state = 'approval_logistic'
rec.date_finance = now
@@ -501,7 +501,7 @@ class TukarGulingPO(models.Model):
def update_doc_state(self):
# bu input rev po
- if self.operations.picking_type_id.id == 28 and self.return_type == 'revisi_po':
+ if self.operations.picking_type_id.id == 28 and self.return_type == 'retur_po':
prt = self.env['stock.picking'].search([
('tukar_guling_po_id', '=', self.id),
('state', '=', 'done'),
@@ -510,7 +510,7 @@ class TukarGulingPO(models.Model):
if self.state == 'approved' and prt:
self.state = 'done'
# bu put rev po
- elif self.operations.picking_type_id.id == 75 and self.return_type == 'revisi_po':
+ elif self.operations.picking_type_id.id == 75 and self.return_type == 'retur_po':
total_prt = self.env['stock.picking'].search_count([
('tukar_guling_po_id', '=', self.id),
('picking_type_id.id', '=', 76)
diff --git a/indoteknik_custom/views/tukar_guling_po.xml b/indoteknik_custom/views/tukar_guling_po.xml
index 548a209f..4a9ab25d 100644
--- a/indoteknik_custom/views/tukar_guling_po.xml
+++ b/indoteknik_custom/views/tukar_guling_po.xml
@@ -87,7 +87,7 @@
<!-- <field name="srt_num" readonly="1"/>-->
<field name="operations" string="Operations"
attrs="{
- 'required': [('return_type', 'in', ['revisi_po', 'tukar_guling'])]
+ 'required': [('return_type', 'in', ['retur_po', 'tukar_guling'])]
}"/>
<!-- <field name="origin" readonly="1"/>-->
<field name="origin_po" readonly="1"/>