summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAzka Nathan <darizkyfaz@gmail.com>2025-07-15 11:13:04 +0700
committerAzka Nathan <darizkyfaz@gmail.com>2025-07-15 11:13:04 +0700
commit4dd6ef58e2c60df7cb25b65ae6ad23d3bee2ebc1 (patch)
tree04341b322ad0d9e09b83eae05a59ac52b99ed906
parent7f4510f2459e16b7b3f1828f736ec84bc7ea97dc (diff)
add so number on purchasing job
-rw-r--r--indoteknik_custom/models/approval_payment_term.py6
-rw-r--r--indoteknik_custom/models/mrp_production.py2
-rw-r--r--indoteknik_custom/models/purchasing_job.py4
-rw-r--r--indoteknik_custom/views/purchasing_job.xml2
4 files changed, 10 insertions, 4 deletions
diff --git a/indoteknik_custom/models/approval_payment_term.py b/indoteknik_custom/models/approval_payment_term.py
index 025f9ed4..6c857b45 100644
--- a/indoteknik_custom/models/approval_payment_term.py
+++ b/indoteknik_custom/models/approval_payment_term.py
@@ -143,17 +143,17 @@ class ApprovalPaymentTerm(models.Model):
user = self.env.user
is_it = user.has_group('indoteknik_custom.group_role_it')
- if (not user.id ==7 and user.id == 19 and not self.approve_sales_manager) or is_it:
+ if (not user.id ==7 and user.id == 19 and not self.approve_sales_manager) or (is_it and not self.approve_sales_manager):
self.approve_sales_manager = True
self.state = 'waiting_approval_finance'
return
- if (not user.id ==7 and user.id == 688 and not self.approve_finance) or is_it:
+ if (not user.id ==7 and user.id == 688 and not self.approve_finance) or (is_it and not self.approve_finance):
self.approve_finance = True
self.state = 'waiting_approval_leader'
return
- if (user.id == 7 and self.approve_finance) or is_it:
+ if (user.id == 7 and self.approve_finance) or (is_it and not self.approve_leader):
self.approve_leader = True
if not self.approve_finance and not is_it:
diff --git a/indoteknik_custom/models/mrp_production.py b/indoteknik_custom/models/mrp_production.py
index 85b8405f..7977bdf7 100644
--- a/indoteknik_custom/models/mrp_production.py
+++ b/indoteknik_custom/models/mrp_production.py
@@ -156,6 +156,8 @@ class MrpProduction(models.Model):
'order_id': new_po.id
}])
+ new_po.button_confirm()
+
self.is_po = True
return po_ids
diff --git a/indoteknik_custom/models/purchasing_job.py b/indoteknik_custom/models/purchasing_job.py
index ea2f46cb..58f1c067 100644
--- a/indoteknik_custom/models/purchasing_job.py
+++ b/indoteknik_custom/models/purchasing_job.py
@@ -26,6 +26,7 @@ class PurchasingJob(models.Model):
purchase_representative_id = fields.Many2one('res.users', string="Purchase Representative", readonly=True)
note = fields.Char(string="Note Detail")
date_po = fields.Datetime(string='Date PO', copy=False)
+ so_number = fields.Char(string='SO Number', copy=False)
def unlink(self):
# Example: Delete related records from the underlying model
@@ -66,6 +67,7 @@ class PurchasingJob(models.Model):
max(pjs.status_apo::text) AS status_apo,
max(pjs.note::text) AS note,
max(pjs.date_po::text) AS date_po,
+ pmp.so_number,
CASE
WHEN pmp.brand IN ('Tekiro', 'RYU', 'Rexco', 'RYU (Sparepart)') THEN 27
WHEN sub.vendor_id = 9688 THEN 397
@@ -83,7 +85,7 @@ class PurchasingJob(models.Model):
group by vso.product_id
) sub ON sub.product_id = pmp.product_id
WHERE pmp.action = 'kurang'::text AND sub.vendor_id IS NOT NULL
- GROUP BY pmp.product_id, pmp.brand, pmp.item_code, pmp.product, pmp.action, sub.vendor_id;
+ GROUP BY pmp.product_id, pmp.brand, pmp.item_code, pmp.product, pmp.action, sub.vendor_id, pmp.so_number;
""" % self._table)
def open_form_multi_generate_request_po(self):
diff --git a/indoteknik_custom/views/purchasing_job.xml b/indoteknik_custom/views/purchasing_job.xml
index bb1c7643..976f1485 100644
--- a/indoteknik_custom/views/purchasing_job.xml
+++ b/indoteknik_custom/views/purchasing_job.xml
@@ -18,6 +18,7 @@
<field name="action"/>
<field name="note"/>
<field name="date_po"/>
+ <field name="so_number"/>
</tree>
</field>
</record>
@@ -41,6 +42,7 @@
<field name="item_code"/>
<field name="product"/>
<field name="action"/>
+ <field name="so_number"/>
</group>
<group>
<field name="onhand"/>