diff options
| author | Mqdd <ahmadmiqdad27@gmail.com> | 2026-03-06 16:12:07 +0700 |
|---|---|---|
| committer | Mqdd <ahmadmiqdad27@gmail.com> | 2026-03-06 16:12:07 +0700 |
| commit | 469ffc15ee2b614b729ad95ca1af3e499906f814 (patch) | |
| tree | c8aa0bace1263f742eaba90a4428699bfa082292 /fixco_custom/models/detail_order.py | |
| parent | 149d9e14813b1147a80e58a1dcc48c7184fec6cd (diff) | |
<Miqdad> cr shopify
Diffstat (limited to 'fixco_custom/models/detail_order.py')
| -rwxr-xr-x | fixco_custom/models/detail_order.py | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/fixco_custom/models/detail_order.py b/fixco_custom/models/detail_order.py index 6cf291c..a01e7a1 100755 --- a/fixco_custom/models/detail_order.py +++ b/fixco_custom/models/detail_order.py @@ -206,8 +206,20 @@ class DetailOrder(models.Model): return partner.id def prepare_data_so(self, json_data): + order = json_data.get('data', [{}])[0] date_str = json_data.get('data', [{}])[0].get('promisedToShipBefore') deadline_date = False + partner = self.get_partner(json_data.get('data', {})[0].get('shopId')) + if partner == 281: + payment_info = order.get('paymentInfo', {}) + total_discounts = payment_info.get('totalDiscounts', 0) or 0 + discount_shipping = payment_info.get('totalDiscountShipping', 0) or 0 + total_tax = payment_info.get('totalTaxation', 0) or 0 + total_shipping_fee = payment_info.get('totalShippingFee', 0) or 0 + if discount_shipping > 0: + total_discounts += discount_shipping + + total_discounts = -total_discounts if date_str: # utc_dt = datetime.strptime( @@ -231,7 +243,13 @@ class DetailOrder(models.Model): 'source': 'ginee', 'channel': json_data.get('data', {})[0].get('channel'), 'deadline_date': deadline_date, + } + if partner == 281: + data['marketplace_discount'] = total_discounts + data['marketplace_tax'] = total_tax + data['delivery_amount'] = total_shipping_fee + return data def _combine_order_items(self, items, lazada_id): @@ -285,6 +303,10 @@ class DetailOrder(models.Model): limit=1 ) + if product.id == 6031: + product.id = 5792 + product_not_found = True + if product and item.get('masterSkuType') == 'BUNDLE': order_lines.append((0, 0, { 'display_type': 'line_note', @@ -332,12 +354,16 @@ class DetailOrder(models.Model): })) continue + partner = self.get_partner(json_data.get('data', {})[0].get('shopId')) + # Regular product line line_data = { 'product_id': product.id if product else 5792, 'product_uom_qty': combined_item['quantity'], 'price_unit': combined_item['actualPrice'], } + if partner == 281: + line_data['tax_id'] = [(5, 0, 0)] if not product: line_data['name'] = f"{sku} ({combined_item['productName']})" |
