diff options
| author | Azka Nathan <darizkyfaz@gmail.com> | 2025-06-20 09:57:29 +0700 |
|---|---|---|
| committer | Azka Nathan <darizkyfaz@gmail.com> | 2025-06-23 16:29:23 +0700 |
| commit | af4ee6eef06a440207c6d16809d06e08057f66f0 (patch) | |
| tree | 9b80559cd0aa7dc202177b1e57880d2aa232a425 | |
| parent | eeb72c4ed24c33403bb733a51198b9cc0f356e6a (diff) | |
bu pick in purchase order sales match
| -rw-r--r-- | indoteknik_custom/models/purchase_order_sales_match.py | 14 | ||||
| -rw-r--r-- | indoteknik_custom/models/stock_picking.py | 4 | ||||
| -rwxr-xr-x | indoteknik_custom/views/purchase_order.xml | 1 |
3 files changed, 19 insertions, 0 deletions
diff --git a/indoteknik_custom/models/purchase_order_sales_match.py b/indoteknik_custom/models/purchase_order_sales_match.py index 0bd0092b..2ea89dab 100644 --- a/indoteknik_custom/models/purchase_order_sales_match.py +++ b/indoteknik_custom/models/purchase_order_sales_match.py @@ -28,6 +28,20 @@ class PurchaseOrderSalesMatch(models.Model): purchase_price_po = fields.Float('Purchase Price PO', compute='_compute_purchase_price_po') purchase_line_id = fields.Many2one('purchase.order.line', string='Purchase Line', compute='_compute_purchase_line_id') hold_outgoing_so = fields.Boolean(string='Hold Outgoing SO', related='sale_id.hold_outgoing') + bu_pick = fields.Many2one('stock.picking', string='BU Pick', compute='compute_bu_pick') + + def compute_bu_pick(self): + for rec in self: + stock_move = self.env['stock.move'].search([ + ('reference', 'ilike', 'BU/PICK'), + ('state', 'in', ['confirmed','waiting','partially_available']), + ('product_id', '=', rec.product_id.id), + ('sale_line_id', '=', rec.sale_line_id.id), + ]) + if stock_move: + rec.bu_pick = stock_move.picking_id.id + else: + rec.bu_pick = '' def _compute_purchase_line_id(self): for line in self: diff --git a/indoteknik_custom/models/stock_picking.py b/indoteknik_custom/models/stock_picking.py index eabef37c..7c4e6bc0 100644 --- a/indoteknik_custom/models/stock_picking.py +++ b/indoteknik_custom/models/stock_picking.py @@ -1309,6 +1309,7 @@ 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): @@ -1347,6 +1348,9 @@ class StockPicking(models.Model): } self.send_mail_bills() return res + + # def automatic_reserve_product(self): + # if self.name def check_invoice_date(self): for picking in self: diff --git a/indoteknik_custom/views/purchase_order.xml b/indoteknik_custom/views/purchase_order.xml index 7b568d07..530fd115 100755 --- a/indoteknik_custom/views/purchase_order.xml +++ b/indoteknik_custom/views/purchase_order.xml @@ -332,6 +332,7 @@ <field name="delivery_amt" optional="hide"/> <field name="margin_deduct" optional="hide"/> <field name="hold_outgoing_so" optional="hide"/> + <field name="bu_pick" optional="hide"/> <field name="margin_so"/> </tree> </field> |
