summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAzka Nathan <darizkyfaz@gmail.com>2023-11-09 09:22:14 +0700
committerAzka Nathan <darizkyfaz@gmail.com>2023-11-09 09:22:14 +0700
commitc9a54676b0ba5b1e27e3619cd0443031bdd27fda (patch)
tree28f89b400d15b538d8c00840b294120d09f12c42
parent27b2145a60fde081f7dd5555126e169d426904e9 (diff)
parentdb561aabfa404edfff9462c812d15a200223b978 (diff)
Merge branch 'production' of bitbucket.org:altafixco/indoteknik-addons into production
-rwxr-xr-xindoteknik_custom/models/purchase_order.py9
-rwxr-xr-xindoteknik_custom/views/purchase_order.xml4
2 files changed, 12 insertions, 1 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:
diff --git a/indoteknik_custom/views/purchase_order.xml b/indoteknik_custom/views/purchase_order.xml
index 8f7ea6df..bc84bcd1 100755
--- a/indoteknik_custom/views/purchase_order.xml
+++ b/indoteknik_custom/views/purchase_order.xml
@@ -79,7 +79,7 @@
<field name="description"/>
<field name="total_so_percent_margin"/>
<field name="has_active_invoice" invisible="1" />
- <field name="purchase_order_lines"/>
+ <field name="responsible_ids" widget="many2many_tags"/>
</field>
<field name="order_line" position="attributes">
@@ -115,6 +115,7 @@
<field name="arch" type="xml">
<field name="create_date" position="after">
<field name="approval_status" />
+ <field name="responsible_ids" widget="many2many_tags" optional="hide"/>
</field>
</field>
</record>
@@ -130,6 +131,7 @@
<field name="po_status"/>
<field name="note_description" optional="hide"/>
<field name="sale_order_id" optional="hide"/>
+ <field name="responsible_ids" widget="many2many_tags" optional="hide"/>
</field>
</field>
</record>