diff options
| author | Azka Nathan <darizkyfaz@gmail.com> | 2024-03-25 13:07:44 +0700 |
|---|---|---|
| committer | Azka Nathan <darizkyfaz@gmail.com> | 2024-03-25 13:07:44 +0700 |
| commit | b2377426bec8aa334277aac48b0b25f0dfac420f (patch) | |
| tree | 49c6a042e0fe29295231b1d409d705a92ddbfc03 /indoteknik_custom/models/automatic_purchase.py | |
| parent | a05da3fad1855cbf2ce4cc7645f1fda79cae037c (diff) | |
purchasing job feedback
Diffstat (limited to 'indoteknik_custom/models/automatic_purchase.py')
| -rw-r--r-- | indoteknik_custom/models/automatic_purchase.py | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/indoteknik_custom/models/automatic_purchase.py b/indoteknik_custom/models/automatic_purchase.py index da845645..3e2d31e7 100644 --- a/indoteknik_custom/models/automatic_purchase.py +++ b/indoteknik_custom/models/automatic_purchase.py @@ -164,6 +164,7 @@ class AutomaticPurchase(models.Model): 'company_id': 1, # indoteknik dotcom gemilang 'picking_type_id': 28, # indoteknik bandengan receipts 'date_order': current_time, + 'from_apo': True, 'note_description': 'Automatic PO' } @@ -192,8 +193,19 @@ class AutomaticPurchase(models.Model): limit=PRODUCT_PER_PO ) + lines = auto_purchase_line.search( + domain, + offset=i * PRODUCT_PER_PO, + limit=PRODUCT_PER_PO + ) + + for line in lines: product = line.product_id + sales_match = self.env['automatic.purchase.sales.match'].search([ + ('automatic_purchase_id', '=', self.id), + ('product_id', '=', product.id), + ]) param_line = { 'order_id': new_po.id, 'product_id': product.id, @@ -202,6 +214,7 @@ class AutomaticPurchase(models.Model): 'suggest': product._get_po_suggest(line.qty_purchase), 'product_uom_qty': line.qty_purchase, 'price_unit': line.last_price, + # 'so_line_id': [sales.sale_line_id.id for sales in sales_match], } new_po_line = self.env['purchase.order.line'].create([param_line]) line.current_po_id = new_po.id |
