summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMqdd <ahmadmiqdad27@gmail.com>2025-12-12 10:35:34 +0700
committerMqdd <ahmadmiqdad27@gmail.com>2025-12-12 10:35:34 +0700
commit7d7dafff9996f7ed7de731a6c1498a5ff72ebb89 (patch)
treec7745b735fcdd4177193652a53f982aa4e9bf61b
parentb0037dfee3eb9c9a03de185dde9e46df95ea3cb9 (diff)
<Miqdad> cr logistic delivery date and flag revisi SO tukar guling
-rw-r--r--indoteknik_custom/models/stock_picking.py6
-rw-r--r--indoteknik_custom/models/tukar_guling.py16
-rw-r--r--indoteknik_custom/views/stock_picking.xml5
-rw-r--r--indoteknik_custom/views/tukar_guling.xml3
4 files changed, 25 insertions, 5 deletions
diff --git a/indoteknik_custom/models/stock_picking.py b/indoteknik_custom/models/stock_picking.py
index 28d082df..602b1145 100644
--- a/indoteknik_custom/models/stock_picking.py
+++ b/indoteknik_custom/models/stock_picking.py
@@ -202,6 +202,12 @@ class StockPicking(models.Model):
so_num = fields.Char('SO Number', compute='_get_so_num')
is_so_fiktif = fields.Boolean('SO Fiktif?', compute='_compute_is_so_fiktif', tracking=3)
payment_term = fields.Char('Payment Term', compute='_get_partner_payment_term')
+ is_rev_tg = fields.Boolean('Revisi SO', compute='_compute_is_rev_tg', store=False)
+
+ @api.depends('tukar_guling_id.rev_tukar_guling')
+ def _compute_is_rev_tg(self):
+ for record in self:
+ record.is_rev_tg = record.tukar_guling_id.rev_tukar_guling if record.tukar_guling_id else False
@api.depends('sale_id.payment_term_id')
def _get_partner_payment_term(self):
diff --git a/indoteknik_custom/models/tukar_guling.py b/indoteknik_custom/models/tukar_guling.py
index f31c68d0..388d83f7 100644
--- a/indoteknik_custom/models/tukar_guling.py
+++ b/indoteknik_custom/models/tukar_guling.py
@@ -87,6 +87,7 @@ class TukarGuling(models.Model):
is_has_invoice = fields.Boolean('Has Invoice?', compute='_compute_is_has_invoice', readonly=True, default=False)
invoice_id = fields.Many2many('account.move', string='Invoice Ref', readonly=True)
+ rev_tukar_guling = fields.Boolean('SO Direvisi?', default=False, tracking=3)
@api.depends('origin', 'operations')
def _compute_origin_so(self):
@@ -808,7 +809,8 @@ class TukarGuling(models.Model):
srt_picking.write({
'group_id': bu_out.group_id.id,
'tukar_guling_id': record.id,
- 'sale_order': record.origin
+ 'sale_order': record.origin,
+ 'note': record.notes,
})
created_returns.append(srt_picking)
_logger.info(f"✅ SRT created: {srt_picking.name}")
@@ -868,7 +870,11 @@ class TukarGuling(models.Model):
ort_picking.write({
'group_id': bu_out.group_id.id,
'tukar_guling_id': record.id,
- 'sale_order': record.origin
+ 'sale_order': record.origin,
+ 'sj_return_date': bu_out.sj_return_date,
+ 'driver_arrival_date': bu_out.driver_arrival_date,
+ 'delivery_date': bu_out.delivery_date,
+ 'note': record.notes,
})
created_returns.append(ort_picking)
@@ -913,7 +919,8 @@ class TukarGuling(models.Model):
new_pick.write({
'group_id': bu_out.group_id.id,
'tukar_guling_id': record.id,
- 'sale_order': record.origin
+ 'sale_order': record.origin,
+ 'note': record.notes,
})
new_pick.action_assign()
new_pick.action_confirm()
@@ -952,7 +959,8 @@ class TukarGuling(models.Model):
new_out.write({
'group_id': bu_out.group_id.id,
'tukar_guling_id': record.id,
- 'sale_order': record.origin
+ 'sale_order': record.origin,
+ 'note': record.notes,
})
created_returns.append(new_out)
_logger.info(f"✅ BU/OUT Baru dari SRT created: {new_out.name}")
diff --git a/indoteknik_custom/views/stock_picking.xml b/indoteknik_custom/views/stock_picking.xml
index e1d9bd1f..eeb78f3b 100644
--- a/indoteknik_custom/views/stock_picking.xml
+++ b/indoteknik_custom/views/stock_picking.xml
@@ -171,6 +171,7 @@
<field name="invoice_status"/>
<field name="is_bu_iu"/>
<field name="is_so_fiktif" readonly="1"/>
+ <field name="is_rev_tg" attrs="{'invisible': [('is_rev_tg', '=', False)]}" readonly="1"/>
<field name="approval_status" attrs="{'invisible': [('is_bu_iu', '=', False)]}"/>
<field name="date_doc_kirim" attrs="{'readonly':[('invoice_status', '=', 'invoiced')]}"/>
<field name="summary_qty_operation"/>
@@ -356,6 +357,10 @@
title="FIKTIF"
bg_color="bg-danger"
attrs="{'invisible': [('is_so_fiktif', '=', False)]}"/>
+ <widget name="web_ribbon"
+ title="Revisi SO"
+ bg_color="bg-danger"
+ attrs="{'invisible': [('is_rev_tg', '=', False)]}"/>
</xpath>
</field>
</record>
diff --git a/indoteknik_custom/views/tukar_guling.xml b/indoteknik_custom/views/tukar_guling.xml
index 9dd31905..8cfb5680 100644
--- a/indoteknik_custom/views/tukar_guling.xml
+++ b/indoteknik_custom/views/tukar_guling.xml
@@ -85,6 +85,7 @@
attrs="{'readonly': [('state', 'not in', 'draft')]}"/>
<!-- <field name="origin" readonly="1"/>-->
<field name="origin_so" readonly="1"/>
+ <field name="rev_tukar_guling" attrs="{'invisible': [('return_type', '!=', 'tukar_guling')]}"/>
<field name="is_has_invoice" readonly="1"/>
</group>
<group>
@@ -133,4 +134,4 @@
</field>
</record>
</data>
-</odoo> \ No newline at end of file
+</odoo>