summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAzka Nathan <darizkyfaz@gmail.com>2026-03-12 09:02:36 +0700
committerAzka Nathan <darizkyfaz@gmail.com>2026-03-12 09:02:36 +0700
commit08c93fcf63a23eddae47b56863e4b90b022c87b5 (patch)
tree57d3eb19c6d7db0bd552c9fc3551579e8cd0cbb4
parente6b6691f518a7400babdbd4b95541fb3d07f154d (diff)
fix matches so
-rwxr-xr-xindoteknik_custom/models/purchase_order.py36
-rwxr-xr-xindoteknik_custom/models/sale_order.py2
2 files changed, 20 insertions, 18 deletions
diff --git a/indoteknik_custom/models/purchase_order.py b/indoteknik_custom/models/purchase_order.py
index 1c573371..d83c0336 100755
--- a/indoteknik_custom/models/purchase_order.py
+++ b/indoteknik_custom/models/purchase_order.py
@@ -306,28 +306,30 @@ class PurchaseOrder(models.Model):
Forecast.search([('order_id','=',po.id)]).unlink()
- product_ids = po.order_line.mapped('product_id').ids
+ product_ids = po.order_line.mapped('product_id')
if not product_ids:
continue
- data = report._get_report_data(product_variant_ids=product_ids)
+ for product in product_ids:
- for l in data.get('lines', []):
- doc = l.get('document_in')
+ data = report._get_report_data(product_variant_ids=[product.id])
- if doc and doc._name == 'purchase.order' and doc.id == po.id:
- doc_out = l.get('document_out')
+ for l in data.get('lines', []):
+ doc = l.get('document_in')
- Forecast.create({
- 'order_id': po.id,
- 'product_id': l['product']['id'],
- 'quantity': l['quantity'],
- 'sale_order': doc_out.display_name if doc_out else '',
- 'sale_order_id': doc_out.id if doc_out else '',
- 'is_late': bool(l.get('is_late')),
- 'replenishment_filled': bool(l.get('replenishment_filled')),
- })
-
+ if doc and doc._name == 'purchase.order' and doc.id == po.id:
+ doc_out = l.get('document_out')
+
+ Forecast.create({
+ 'order_id': po.id,
+ 'product_id': l['product']['id'],
+ 'quantity': l['quantity'],
+ 'sale_order': doc_out.display_name if doc_out else '',
+ 'sale_order_id': doc_out.id if doc_out else '',
+ 'is_late': bool(l.get('is_late')),
+ 'replenishment_filled': bool(l.get('replenishment_filled')),
+ })
+
def _get_altama_token(self, source='auto'):
ICP = self.env['ir.config_parameter'].sudo()
TokenLog = self.env['token.log'].sudo()
@@ -1681,7 +1683,7 @@ class PurchaseOrder(models.Model):
# return self.action_view_related_bu()
if self.partner_id.id == 5571 and not self.revisi_po:
self.action_create_order_altama()
-
+
return res
def _remove_product_bom(self):
diff --git a/indoteknik_custom/models/sale_order.py b/indoteknik_custom/models/sale_order.py
index 19ded5ee..2b064042 100755
--- a/indoteknik_custom/models/sale_order.py
+++ b/indoteknik_custom/models/sale_order.py
@@ -2665,7 +2665,7 @@ class SaleOrder(models.Model):
user = self.env.user
is_sales_admin = user.id in (3401, 20, 3988, 17340)
if is_sales_admin:
- order.approval_status = 'pengajuan0'
+ order.approval_status = 'pengajuan1'
order.message_post(body="Mengajukan approval ke Sales")
return self._create_approval_notification('Sales')