diff options
| author | stephanchrst <stephanchrst@gmail.com> | 2024-05-21 09:21:33 +0700 |
|---|---|---|
| committer | stephanchrst <stephanchrst@gmail.com> | 2024-05-21 09:21:33 +0700 |
| commit | 8da2a7fe0de6f0abe4e35831e5e5560c20b5b627 (patch) | |
| tree | ed6629bcf59841e8343f5a9c9590d0ff4878b1fc | |
| parent | 92413dbeda6eebc85731536dd698bb155b09d7df (diff) | |
bug fix total margin so, forgot deduction of delivery amount
| -rw-r--r-- | indoteknik_custom/models/ged.py | 26 | ||||
| -rwxr-xr-x | indoteknik_custom/models/sale_order.py | 7 |
2 files changed, 19 insertions, 14 deletions
diff --git a/indoteknik_custom/models/ged.py b/indoteknik_custom/models/ged.py index 9e6facc6..9ca426af 100644 --- a/indoteknik_custom/models/ged.py +++ b/indoteknik_custom/models/ged.py @@ -6,20 +6,20 @@ from odoo.exceptions import UserError import json #dev -# url_token = 'https://stagging-api.ged.co.id/api/GetToken' -# url_tracking = 'https://stagging-api.ged.co.id/api/TrackingAwb' -# username = 'mandiri@gmail.co.id' -# password = 'nPcWh8Up75ai5CW' -# x_ged_key = 'Mandiriind' -# x_ged_password = 'M4ndir1ind0n3si4ap1' +url_token = 'https://stagging-api.ged.co.id/api/GetToken' +url_tracking = 'https://stagging-api.ged.co.id/api/TrackingAwb' +username = 'mandiri@gmail.co.id' +password = 'nPcWh8Up75ai5CW' +x_ged_key = 'Mandiriind' +x_ged_password = 'M4ndir1ind0n3si4ap1' #production -url_token = 'https://gedapi.ged.co.id/api/GetToken' -url_tracking = 'https://gedapi.ged.co.id/api/TrackingAwb' -username = 'stephan@indoteknik.co.id' -password = 'faCE2HFFKdzhvPW' -x_ged_key = 'Indoteknikdotcom' -x_ged_password = 'Ind0t3kn1kdotc0m4p1' +# url_token = 'https://gedapi.ged.co.id/api/GetToken' +# url_tracking = 'https://gedapi.ged.co.id/api/TrackingAwb' +# username = 'stephan@indoteknik.co.id' +# password = 'faCE2HFFKdzhvPW' +# x_ged_key = 'Indoteknikdotcom' +# x_ged_password = 'Ind0t3kn1kdotc0m4p1' class GedTracking(models.Model): _name = 'ged.tracking' @@ -245,7 +245,7 @@ class DunningRunGed(models.Model): else: query = [ ('last_status_awb', '!=', 'POD Return'), - ('resi_tukar_faktur', '!=', False), + ('resi_tukar_faktur', '=', False), ('shipper_faktur_id', '=', 123) ] dunnings = self.env['dunning.run'].search(query) diff --git a/indoteknik_custom/models/sale_order.py b/indoteknik_custom/models/sale_order.py index aa34b0f4..fbb5e7a2 100755 --- a/indoteknik_custom/models/sale_order.py +++ b/indoteknik_custom/models/sale_order.py @@ -582,7 +582,12 @@ class SaleOrder(models.Model): if order.amount_untaxed == 0: order.total_percent_margin = 0 continue - order.total_percent_margin = round((order.total_margin / order.amount_untaxed) * 100, 2) + if order.shipping_cost_covered == 'indoteknik': + delivery_amt = order.delivery_amt + else: + delivery_amt = 0 + order.total_percent_margin = round((order.total_margin / (order.amount_untaxed-delivery_amt)) * 100, 2) + # order.total_percent_margin = round((order.total_margin / (order.amount_untaxed)) * 100, 2) @api.onchange('sales_tax_id') def onchange_sales_tax_id(self): |
