summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorstephanchrst <stephanchrst@gmail.com>2023-06-28 17:12:22 +0700
committerstephanchrst <stephanchrst@gmail.com>2023-06-28 17:12:22 +0700
commit43ac0072bbf65bc7feb882bc3da8bbaefed5a6fe (patch)
treee8088d449caf4c9284f5de671f65d657f935b331
parentb555a10fe638f644fbb001f3557c6ae04b6d00c9 (diff)
add sum purchase total
-rwxr-xr-xindoteknik_custom/models/sale_order.py8
1 files changed, 8 insertions, 0 deletions
diff --git a/indoteknik_custom/models/sale_order.py b/indoteknik_custom/models/sale_order.py
index 5f37e3b2..7741aab7 100755
--- a/indoteknik_custom/models/sale_order.py
+++ b/indoteknik_custom/models/sale_order.py
@@ -78,6 +78,14 @@ class SaleOrder(models.Model):
delivery_service_type = fields.Char(string='Delivery Service Type', help='data dari rajaongkir')
grand_total = fields.Monetary(string='Grand Total', help='Amount total + amount delivery', compute='_compute_grand_total')
payment_link_midtrans = fields.Char(string='Payment Link', help='Url payment yg digenerate oleh midtrans, harap diserahkan ke customer agar dapat dilakukan pembayaran secara mandiri')
+ purchase_total = fields.Char(string='Purchase Total', compute='_compute_purchase_total')
+
+ def _compute_purchase_total(self):
+ for order in self:
+ total = 0
+ for line in order.order_line:
+ total += line.vendor_subtotal
+ order.purchase_total = total
def generate_payment_link_midtrans_sales_order(self):
# midtrans_url = 'https://app.sandbox.midtrans.com/snap/v1/transactions' # dev - sandbox