diff options
| author | Azka Nathan <darizkyfaz@gmail.com> | 2025-06-23 16:29:02 +0700 |
|---|---|---|
| committer | Azka Nathan <darizkyfaz@gmail.com> | 2025-06-23 16:29:23 +0700 |
| commit | a6aa700b5016c98d579a52125e3686acc615ce88 (patch) | |
| tree | cca7b42d53e6a56f534ce4a3e9c28f73bb5fff17 | |
| parent | af4ee6eef06a440207c6d16809d06e08057f66f0 (diff) | |
trial automatic reserve and change qty purchase stock
| -rw-r--r-- | indoteknik_custom/models/automatic_purchase.py | 2 | ||||
| -rw-r--r-- | indoteknik_custom/models/stock_picking.py | 14 |
2 files changed, 11 insertions, 5 deletions
diff --git a/indoteknik_custom/models/automatic_purchase.py b/indoteknik_custom/models/automatic_purchase.py index c9edf07c..83a7cb3c 100644 --- a/indoteknik_custom/models/automatic_purchase.py +++ b/indoteknik_custom/models/automatic_purchase.py @@ -486,7 +486,7 @@ class AutomaticPurchase(models.Model): # _logger.info('test %s' % point.product_id.name) if point.product_id.qty_available_bandengan > point.product_min_qty: continue - qty_purchase = point.product_max_qty - point.product_id.qty_incoming_bandengan - point.product_id.qty_onhand_bandengan + qty_purchase = point.product_max_qty - point.product_id.qty_incoming_bandengan - point.product_id.qty_available_bandengan po_line = self.env['purchase.order.line'].search([('product_id', '=', point.product_id.id), ('order_id.state', '=', 'done')], order='id desc', limit=1) if self.vendor_id: diff --git a/indoteknik_custom/models/stock_picking.py b/indoteknik_custom/models/stock_picking.py index 7c4e6bc0..27046063 100644 --- a/indoteknik_custom/models/stock_picking.py +++ b/indoteknik_custom/models/stock_picking.py @@ -1309,8 +1309,6 @@ class StockPicking(models.Model): self.final_seq = 0 self.set_picking_code_out() self.send_koli_to_so() - self.automatic_reserve_product() - if (self.state_reserve == 'done' and self.picking_type_code == 'internal' and 'BU/PICK/' in self.name and self.linked_manual_bu_out): if not self.linked_manual_bu_out.date_reserved: @@ -1347,10 +1345,18 @@ class StockPicking(models.Model): 'target': 'new', } self.send_mail_bills() + if 'BU/PUT' in self.name: + self.automatic_reserve_product() return res - # def automatic_reserve_product(self): - # if self.name + def automatic_reserve_product(self): + if self.state == 'done': + po = self.env['purchase.order'].search([ + ('name', '=', self.group_id.name) + ]) + + for line in po.order_sales_match_line: + line.bu_pick.action_assign() def check_invoice_date(self): for picking in self: |
