summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorstephanchrst <stephanchrst@gmail.com>2022-10-14 15:49:41 +0700
committerstephanchrst <stephanchrst@gmail.com>2022-10-14 15:49:41 +0700
commit589aacc782ce4a7d2cb89fca9ea2233294a21439 (patch)
tree3a4e410c006576fd95d5b2b3278b4860a36a8953
parent4426c0a7f19969b59ff35fa1e4f793b66c6c5d91 (diff)
Update purchase_order.py and purchase_order.xml
-rwxr-xr-xindoteknik_custom/models/purchase_order.py23
-rwxr-xr-xindoteknik_custom/views/purchase_order.xml4
2 files changed, 16 insertions, 11 deletions
diff --git a/indoteknik_custom/models/purchase_order.py b/indoteknik_custom/models/purchase_order.py
index 8736a6f4..84a95f9a 100755
--- a/indoteknik_custom/models/purchase_order.py
+++ b/indoteknik_custom/models/purchase_order.py
@@ -34,8 +34,9 @@ class PurchaseOrder(models.Model):
'SO Margin%', compute='compute_total_margin',
help="Total % Margin in Sales Order Header")
amount_total_without_service = fields.Float('AmtTotalWithoutService', compute='compute_amt_total_without_service')
- summary_qty_po = fields.Float('Summary Qty PO', compute='_compute_summary_qty')
+ summary_qty_po = fields.Float('Total Qty', compute='_compute_summary_qty')
summary_qty_receipt = fields.Float('Summary Qty Receipt', compute='_compute_summary_qty')
+ count_line_product = fields.Float('Total Item', compute='compute_count_line_product')
def calculate_po_status_beginning(self):
purchases = self.env['purchase.order'].search([
@@ -122,16 +123,16 @@ class PurchaseOrder(models.Model):
}
self.env['purchase.order.line'].sudo().create(values)
- # def compute_count_line_product(self):
- # for order in self:
- # count = 0
- # for line in order.order_line:
- # if line.product_id.type == 'product':
- # count += 1
- # if count == 0:
- # order.count_line_product = 1
- # else:
- # order.count_line_product = count
+ def compute_count_line_product(self):
+ for order in self:
+ count = 0
+ for line in order.order_line:
+ if line.product_id.type == 'product':
+ count += 1
+ if count == 0:
+ order.count_line_product = 1
+ else:
+ order.count_line_product = count
def compute_delivery_amount(self):
for order in self:
diff --git a/indoteknik_custom/views/purchase_order.xml b/indoteknik_custom/views/purchase_order.xml
index 41e97cd9..31524d65 100755
--- a/indoteknik_custom/views/purchase_order.xml
+++ b/indoteknik_custom/views/purchase_order.xml
@@ -24,6 +24,10 @@
<field name="sale_order_id" attrs="{'readonly': [('state', 'not in', ['draft'])]}"/>
<field name="approval_status"/>
</field>
+ <field name="currency_id" position="after">
+ <field name="summary_qty_po"/>
+ <field name="count_line_product"/>
+ </field>
<field name="amount_total" position="after">
<field name="total_margin"/>
<field name="total_so_margin"/>