diff options
| author | stephanchrst <stephanchrst@gmail.com> | 2023-01-02 11:28:12 +0700 |
|---|---|---|
| committer | stephanchrst <stephanchrst@gmail.com> | 2023-01-02 11:28:12 +0700 |
| commit | 9d4ec4d054858368d21a1efc9f58f1fbd080baaf (patch) | |
| tree | eea9b772124aad8cbcaf021575b988727b43225e /indoteknik_custom/models/purchase_order.py | |
| parent | 80cbff436261c85af8b826317037fc5ee07b2d86 (diff) | |
change logic for po status and add table for product spec trusco
Diffstat (limited to 'indoteknik_custom/models/purchase_order.py')
| -rwxr-xr-x | indoteknik_custom/models/purchase_order.py | 20 |
1 files changed, 15 insertions, 5 deletions
diff --git a/indoteknik_custom/models/purchase_order.py b/indoteknik_custom/models/purchase_order.py index a816038e..b4d671b6 100755 --- a/indoteknik_custom/models/purchase_order.py +++ b/indoteknik_custom/models/purchase_order.py @@ -70,19 +70,29 @@ class PurchaseOrder(models.Model): def calculate_po_status(self): purchases = self.env['purchase.order'].search([ ('po_status', '!=', 'terproses'), + # ('id', '=', 213), ]) for order in purchases: sum_qty_received = sum_qty_po = 0 + + have_outstanding_pick = False + for pick in order.picking_ids: + if pick.state == 'draft' or pick.state == 'assigned' or pick.state == 'confirmed' or pick.state == 'waiting': + have_outstanding_pick = True + for po_line in order.order_line: sum_qty_po += po_line.product_uom_qty sum_qty_received += po_line.qty_received - if order.summary_qty_po == order.summary_qty_receipt: - order.po_status = 'terproses' - elif order.summary_qty_po > order.summary_qty_receipt > 0: - order.po_status = 'sebagian' + if have_outstanding_pick: + # if order.summary_qty_po == order.summary_qty_receipt: + # order.po_status = 'terproses' + if order.summary_qty_po > order.summary_qty_receipt > 0: + order.po_status = 'sebagian' + else: + order.po_status = 'menunggu' else: - order.po_status = 'menunggu' + order.po_status = 'terproses' _logger.info("Calculate PO Status %s" % order.id) def _compute_summary_qty(self): |
