diff options
| -rwxr-xr-x | indoteknik_custom/models/sale_order.py | 8 |
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 |
