From f4f150ec2492b048886e1965a0a650864295c76c Mon Sep 17 00:00:00 2001 From: Rafi Zadanly Date: Mon, 15 May 2023 16:22:21 +0700 Subject: grand total field, compute grand total, sale order print for website, fix sale order download pdf api --- indoteknik_custom/models/sale_order.py | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'indoteknik_custom/models') diff --git a/indoteknik_custom/models/sale_order.py b/indoteknik_custom/models/sale_order.py index 69e96968..14c87641 100755 --- a/indoteknik_custom/models/sale_order.py +++ b/indoteknik_custom/models/sale_order.py @@ -73,6 +73,7 @@ class SaleOrder(models.Model): gross_amount = fields.Float(string='Gross Amount', help='Jumlah pembayaran yang dilakukan dengan Midtrans') notification = fields.Char(string='Notification', help='Dapat membantu error dari approval') 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') @api.model def _generate_so_access_token(self, limit=50): @@ -362,6 +363,10 @@ class SaleOrder(models.Model): for line in self.order_line: line.product_id_change() + def _compute_grand_total(self): + for order in self: + order.grand_total = order.delivery_amt + order.amount_total + class SaleOrderLine(models.Model): _inherit = 'sale.order.line' -- cgit v1.2.3