diff options
| author | FIN-IT_AndriFP <it@fixcomart.co.id> | 2025-09-29 10:47:25 +0700 |
|---|---|---|
| committer | FIN-IT_AndriFP <it@fixcomart.co.id> | 2025-09-29 10:47:25 +0700 |
| commit | e1efb70e0002fec8ad684f7ab62f551f4c649963 (patch) | |
| tree | 67ddf1ea0cf8294758b552fde26cdcc25630d682 /indoteknik_custom/models/tukar_guling.py | |
| parent | 6582949e6e8f7017b8b44ed937d6042d8794fbc5 (diff) | |
| parent | ec21c4721f35028fc9b2a61bd0dbc6e4bf600e74 (diff) | |
Merge branch 'odoo-backup' of https://bitbucket.org/altafixco/indoteknik-addons into closing-apt
Diffstat (limited to 'indoteknik_custom/models/tukar_guling.py')
| -rw-r--r-- | indoteknik_custom/models/tukar_guling.py | 26 |
1 files changed, 25 insertions, 1 deletions
diff --git a/indoteknik_custom/models/tukar_guling.py b/indoteknik_custom/models/tukar_guling.py index c683f75a..cb630a04 100644 --- a/indoteknik_custom/models/tukar_guling.py +++ b/indoteknik_custom/models/tukar_guling.py @@ -538,6 +538,11 @@ class TukarGuling(models.Model): self.state = 'approval_sales' def update_doc_state(self): + bu_pick = self.env['stock.picking'].search([ + ('origin', '=', self.operations.origin), + ('name', 'ilike', 'BU/PICK'), + ]) + # OUT tukar guling if self.operations.picking_type_id.id == 29 and self.return_type == 'tukar_guling': total_out = self.env['stock.picking'].search_count([ @@ -552,7 +557,26 @@ class TukarGuling(models.Model): if self.state == 'approved' and total_out > 0 and done_out == total_out: self.state = 'done' - # OUT revisi SO + #SO Lama (gk ada bu pick) + elif self.operations.picking_type_id.id == 29 and self.return_type == 'retur_so' and not bu_pick: + # so_lama = self.env['sale.order'].search([ + # ('name', '=', self.operations.origin), + # ('state', '=', 'done'), + # ('group_id.name', '=', self.operations.origin) + # ]) + total_ort = self.env['stock.picking'].search_count([ + ('tukar_guling_id', '=', self.id), + ('picking_type_id', '=', 74), + ]) + done_srt = self.env['stock.picking'].search([ + ('tukar_guling_id', '=', self.id), + ('picking_type_id', '=', 73), + ('state', '=', 'done') + ]) + if self.state == 'approved' and total_ort == 0 and done_srt and not bu_pick: + self.state = 'done' + + # OUT retur 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), |
