diff options
| author | FIN-IT_AndriFP <it@fixcomart.co.id> | 2025-09-21 22:06:00 +0700 |
|---|---|---|
| committer | FIN-IT_AndriFP <it@fixcomart.co.id> | 2025-09-21 22:06:00 +0700 |
| commit | b73575cc51ec58c02bccb711689d52e99e915c4e (patch) | |
| tree | 98bc410f09b360b5cf8d8a475bca2fe21b18814f | |
| parent | 2f1673133969bf72268ab61e186a28732d8f5439 (diff) | |
(andri) link PO to stock journal after validate BD
| -rw-r--r-- | indoteknik_custom/models/stock_picking.py | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/indoteknik_custom/models/stock_picking.py b/indoteknik_custom/models/stock_picking.py index 35d408a1..67106073 100644 --- a/indoteknik_custom/models/stock_picking.py +++ b/indoteknik_custom/models/stock_picking.py @@ -1352,6 +1352,19 @@ class StockPicking(models.Model): if self.picking_type_code == 'outgoing' and 'BU/OUT/' in self.name: self.check_koli() res = super(StockPicking, self).button_validate() + + # Penambahan link PO di Stock Journal untuk Picking BD + for picking in self: + if picking.name and 'BD/' in picking.name and picking.purchase_id: + stock_journal = self.env['account.move'].search([ + ('ref', 'ilike', picking.name + '%'), + ('journal_id', '=', 3) # Stock Journal ID + ], limit = 1) + if stock_journal: + stock_journal.write({ + 'purchase_order_id': picking.purchase_id.id + }) + self.date_done = datetime.datetime.utcnow() self.state_reserve = 'done' self.final_seq = 0 |
