| Line 1... |
Line 1... |
| 1 |
from datetime import *
|
1 |
from datetime import *
|
| 2 |
from shop2020 import utils
|
2 |
from shop2020 import utils
|
| 3 |
from shop2020.clients.InventoryClient import InventoryClient
|
3 |
from shop2020.clients.InventoryClient import InventoryClient
|
| 4 |
from shop2020.clients.LogisticsClient import LogisticsClient
|
- |
|
| 5 |
from shop2020.clients.TransactionClient import TransactionClient
|
4 |
from shop2020.clients.TransactionClient import TransactionClient
|
| - |
|
5 |
from shop2020.clients.CatalogClient import CatalogClient
|
| 6 |
from shop2020.config.client.ConfigClient import ConfigClient
|
6 |
from shop2020.config.client.ConfigClient import ConfigClient
|
| 7 |
from shop2020.thriftpy.logistics.ttypes import DeliveryType
|
7 |
from shop2020.thriftpy.logistics.ttypes import DeliveryType
|
| 8 |
from shop2020.thriftpy.model.v1.order.TransactionService import Client
|
8 |
from shop2020.thriftpy.model.v1.order.TransactionService import Client
|
| 9 |
from shop2020.thriftpy.model.v1.order.ttypes import Order, LineItem, SellerInfo
|
9 |
from shop2020.thriftpy.model.v1.order.ttypes import Order, LineItem, SellerInfo
|
| 10 |
from shop2020.utils.Utils import to_py_date
|
10 |
from shop2020.utils.Utils import to_py_date
|
| Line 195... |
Line 195... |
| 195 |
shipment[F_DG_SHIPMENT] = 'false'
|
195 |
shipment[F_DG_SHIPMENT] = 'false'
|
| 196 |
shipment[F_ADDITIONAL_INFORMATION] = {"MULTI_SELLER_INFORMATION": _getMultiSellerInfo(orders, sellerInfo, warehouseAddressObj)}
|
196 |
shipment[F_ADDITIONAL_INFORMATION] = {"MULTI_SELLER_INFORMATION": _getMultiSellerInfo(orders, sellerInfo, warehouseAddressObj)}
|
| 197 |
return shipment
|
197 |
return shipment
|
| 198 |
|
198 |
|
| 199 |
def _getMultiSellerInfo(orders, sellerInfo, warehouseAddressObj):
|
199 |
def _getMultiSellerInfo(orders, sellerInfo, warehouseAddressObj):
|
| - |
|
200 |
itemIds = []
|
| - |
|
201 |
inventory_client = InventoryClient().get_client()
|
| - |
|
202 |
warehouse = inventory_client.getWarehouse(orders[0].warehouse_id)
|
| - |
|
203 |
|
| - |
|
204 |
if sellerInfo.stateId == warehouse.stateId:
|
| - |
|
205 |
taxRate = cc.getStateTaxRate(itemIds, sellerInfo.stateId)
|
| - |
|
206 |
else:
|
| - |
|
207 |
taxRate = cc.getStateTaxRate(itemIds, -1)
|
| - |
|
208 |
|
| - |
|
209 |
for order in orders:
|
| - |
|
210 |
lineitem = order.lineitems[0]
|
| 200 |
for order in orders:
|
211 |
for order in orders:
|
| 201 |
lineitem = order.lineitems[0]
|
212 |
lineitem = order.lineitems[0]
|
| - |
|
213 |
cc = CatalogClient().get_client()
|
| 202 |
totalTaxRate = lineitem.sgstRate + lineitem.cgstRate + lineitem.igstRate
|
214 |
totalTaxRate = lineitem.sgstRate + lineitem.cgstRate + lineitem.igstRate
|
| 203 |
stateMaster = fetchStateMaster()
|
215 |
stateMaster = fetchStateMaster()
|
| 204 |
return {
|
216 |
return {
|
| 205 |
"ITEM_DESCRIPTION": " ".join(filter(None, [lineitem.brand, lineitem.model_name, lineitem.model_number])),
|
217 |
"ITEM_DESCRIPTION": " ".join(filter(None, [lineitem.brand, lineitem.model_name, lineitem.model_number])),
|
| 206 |
"ITEM_VALUE": lineitem.unit_price,
|
218 |
"ITEM_VALUE": lineitem.unit_price,
|
| Line 215... |
Line 227... |
| 215 |
"ESUGAM_NUMBER": "",
|
227 |
"ESUGAM_NUMBER": "",
|
| 216 |
"SELLER_GSTIN": sellerInfo.gstin,
|
228 |
"SELLER_GSTIN": sellerInfo.gstin,
|
| 217 |
"GST_HSN": lineitem.hsnCode,
|
229 |
"GST_HSN": lineitem.hsnCode,
|
| 218 |
"GST_TAX_BASE": lineitem.unit_price,
|
230 |
"GST_TAX_BASE": lineitem.unit_price,
|
| 219 |
"DISCOUNT": 0.0,
|
231 |
"DISCOUNT": 0.0,
|
| 220 |
"GST_TAX_RATE_CGSTN": lineitem.cgstRate,
|
232 |
"GST_TAX_RATE_CGSTN": taxRate.cgstRate,
|
| 221 |
"GST_TAX_RATE_SGSTN": lineitem.sgstRate,
|
233 |
"GST_TAX_RATE_SGSTN": taxRate.sgstRate,
|
| 222 |
"GST_TAX_RATE_IGSTN": lineitem.igstRate,
|
234 |
"GST_TAX_RATE_IGSTN": taxRate.igstRate,
|
| 223 |
"GST_TAX_TOTAL": lineitem.unit_price - lineitem.unit_price / (1 + (totalTaxRate/100)),
|
235 |
"GST_TAX_TOTAL": lineitem.unit_price - lineitem.unit_price / (1 + (totalTaxRate/100)),
|
| 224 |
"GST_TAX_CGSTN": lineitem.unit_price - lineitem.unit_price / (1 + (lineitem.cgstRate/100)),
|
236 |
"GST_TAX_CGSTN": lineitem.unit_price - lineitem.unit_price / (1 + (lineitem.cgstRate/100)),
|
| 225 |
"GST_TAX_SGSTN": lineitem.unit_price - lineitem.unit_price / (1 + (lineitem.sgstRate/100)),
|
237 |
"GST_TAX_SGSTN": lineitem.unit_price - lineitem.unit_price / (1 + (lineitem.sgstRate/100)),
|
| 226 |
"GST_TAX_IGSTN": lineitem.unit_price - lineitem.unit_price / (1 + (lineitem.igstRate/100)),
|
238 |
"GST_TAX_IGSTN": lineitem.unit_price - lineitem.unit_price / (1 + (lineitem.igstRate/100)),
|
| 227 |
}
|
239 |
}
|