summaryrefslogtreecommitdiff
path: root/indoteknik_custom/models/purchase_order.py
diff options
context:
space:
mode:
authorstephanchrst <stephanchrst@gmail.com>2023-11-08 11:19:54 +0700
committerstephanchrst <stephanchrst@gmail.com>2023-11-08 11:19:54 +0700
commitdb561aabfa404edfff9462c812d15a200223b978 (patch)
treeb42bad03df9206778e9e05d8bf13bd6fbf749a53 /indoteknik_custom/models/purchase_order.py
parent019493c8e0e6cc5aff4c612eb332f1c882b0519d (diff)
add responsible in po base on manufacture responsible
Diffstat (limited to 'indoteknik_custom/models/purchase_order.py')
-rwxr-xr-xindoteknik_custom/models/purchase_order.py9
1 files changed, 9 insertions, 0 deletions
diff --git a/indoteknik_custom/models/purchase_order.py b/indoteknik_custom/models/purchase_order.py
index f9cd7f5b..b0f1a569 100755
--- a/indoteknik_custom/models/purchase_order.py
+++ b/indoteknik_custom/models/purchase_order.py
@@ -49,6 +49,15 @@ class PurchaseOrder(models.Model):
has_active_invoice = fields.Boolean(string='Has Active Invoice', compute='_compute_has_active_invoice')
description = fields.Char(string='Description', help='bisa diisi sebagai informasi indent barang tertentu atau apapun')
purchase_order_lines = fields.One2many('purchase.order.line', 'order_id', string='Indent', auto_join=True)
+ responsible_ids = fields.Many2many('res.users', string='Responsibles', compute='_compute_responsibles')
+
+ def _compute_responsibles(self):
+ for purchase in self:
+ resposible_ids = []
+ for line in purchase.order_line:
+ resposible_ids.append(line.product_id.x_manufacture.user_id.id)
+ resposible_ids = list(set(resposible_ids))
+ purchase.responsible_ids = resposible_ids
def _compute_has_active_invoice(self):
for order in self: