| Line 555... |
Line 555... |
| 555 |
|
555 |
|
| 556 |
order.otg = logistics_info.otgAvailable
|
556 |
order.otg = logistics_info.otgAvailable
|
| 557 |
order.warehouse_id = logistics_info.warehouseId
|
557 |
order.warehouse_id = logistics_info.warehouseId
|
| 558 |
order.fulfilmentWarehouseId = logistics_info.fulfilmentWarehouseId
|
558 |
order.fulfilmentWarehouseId = logistics_info.fulfilmentWarehouseId
|
| 559 |
order.logistics_provider_id = logistics_info.providerId
|
559 |
order.logistics_provider_id = logistics_info.providerId
|
| 560 |
#Start:- Added by Manish Sharma for FedEx Integration - Shipment Creation on 31-Jul-2013
|
- |
|
| 561 |
#order.airwaybill_no = logistics_info.airway_billno
|
- |
|
| 562 |
#order.tracking_id = order.airwaybill_no
|
560 |
|
| 563 |
#End:- Added by Manish Sharma for FedEx Integration- Shipment Creation on 31-Jul-2013
|
- |
|
| - |
|
561 |
|
| 564 |
if order.source != OrderSource.AMAZON or order.source != OrderSource.JUNGLEE:
|
562 |
if order.source != OrderSource.AMAZON or order.source != OrderSource.JUNGLEE:
|
| 565 |
order.courier_delivery_time = (current_time + datetime.timedelta(days=logistics_info.deliveryDelay)).replace(hour=PREPAID_SHIPPING_CUTOFF_TIME, minute=0, second=0)
|
563 |
order.courier_delivery_time = (current_time + datetime.timedelta(days=logistics_info.deliveryDelay)).replace(hour=PREPAID_SHIPPING_CUTOFF_TIME, minute=0, second=0)
|
| 566 |
order.expected_shipping_time = (current_time + datetime.timedelta(days=logistics_info.shippingTime)).replace(hour=PREPAID_SHIPPING_CUTOFF_TIME, minute=0, second=0)
|
564 |
order.expected_shipping_time = (current_time + datetime.timedelta(days=logistics_info.shippingTime)).replace(hour=PREPAID_SHIPPING_CUTOFF_TIME, minute=0, second=0)
|
| 567 |
order.promised_shipping_time = order.expected_shipping_time
|
565 |
order.promised_shipping_time = order.expected_shipping_time
|
| 568 |
order.expected_delivery_time = (current_time + datetime.timedelta(days=logistics_info.deliveryTime)).replace(hour=PREPAID_SHIPPING_CUTOFF_TIME, minute=0, second=0)
|
566 |
order.expected_delivery_time = (current_time + datetime.timedelta(days=logistics_info.deliveryTime)).replace(hour=PREPAID_SHIPPING_CUTOFF_TIME, minute=0, second=0)
|
| Line 11586... |
Line 11584... |
| 11586 |
order.shippingRefund = order.shippingCost
|
11584 |
order.shippingRefund = order.shippingCost
|
| 11587 |
add_amount_in_wallet(order.customer_id, diff, order.transaction_id, WalletReferenceType.SHIPPING_REFUND, False, "Refunded shipping charges", commit_session=False)
|
11585 |
add_amount_in_wallet(order.customer_id, diff, order.transaction_id, WalletReferenceType.SHIPPING_REFUND, False, "Refunded shipping charges", commit_session=False)
|
| 11588 |
if commit:
|
11586 |
if commit:
|
| 11589 |
session.commit()
|
11587 |
session.commit()
|
| 11590 |
|
11588 |
|
| 11591 |
def mark_order_for_selfpickup(transaction_ids):
|
11589 |
#def mark_order_for_selfpickup(transaction_ids):
|
| 11592 |
for transaction_id in transaction_ids:
|
11590 |
# for transaction_id in transaction_ids:
|
| 11593 |
transaction = get_transaction(transaction_id)
|
11591 |
# transaction = get_transaction(transaction_id)
|
| 11594 |
user_client = UserClient().get_client()
|
11592 |
# user_client = UserClient().get_client()
|
| 11595 |
counter = user_client.getCounterByUserId(transaction.customer_id)
|
11593 |
# counter = user_client.getCounterByUserId(transaction.customer_id)
|
| 11596 |
address = user_client.getAddressById(counter.address)
|
11594 |
# address = user_client.getAddressById(counter.address)
|
| 11597 |
for order in transaction.orders:
|
11595 |
# for order in transaction.orders:
|
| 11598 |
oa = Attribute()
|
11596 |
# oa = Attribute()
|
| 11599 |
oa.value = counter.tin
|
11597 |
# oa.value = counter.tin
|
| 11600 |
oa.name='tinNumber'
|
11598 |
# oa.name='tinNumber'
|
| 11601 |
oa.orderId = order.id
|
11599 |
# oa.orderId = order.id
|
| 11602 |
|
11600 |
#
|
| 11603 |
order.customer_name = address.name
|
11601 |
# order.customer_name = address.name
|
| 11604 |
order.customer_pincode = address.pin
|
11602 |
# order.customer_pincode = address.pin
|
| 11605 |
order.customer_address1 = address.line1
|
11603 |
# order.customer_address1 = address.line1
|
| 11606 |
order.customer_address2 = address.line2
|
11604 |
# order.customer_address2 = address.line2
|
| 11607 |
order.customer_city = address.city
|
11605 |
# order.customer_city = address.city
|
| 11608 |
order.customer_state = address.state
|
11606 |
# order.customer_state = address.state
|
| 11609 |
order.orderType = OrderType.B2B
|
11607 |
# order.orderType = OrderType.B2B
|
| 11610 |
#Self Pickup
|
11608 |
# #Self Pickup
|
| 11611 |
order.logistics_provider_id = 4
|
11609 |
# order.logistics_provider_id = 4
|
| 11612 |
__refund_shipping(list(transaction.orders), False)
|
11610 |
# __refund_shipping(list(transaction.orders), False)
|
| 11613 |
session.commit()
|
11611 |
# session.commit()
|
| 11614 |
session.close()
|
11612 |
# session.close()
|
| 11615 |
|
11613 |
|
| - |
|
11614 |
#
|
| 11616 |
#this will be used when wallet is not used
|
11615 |
#This should be called before order processing
|
| - |
|
11616 |
#Billing address is set using this for invoicing purposes
|
| 11617 |
def mark_order_for_selfpickup_temp(transaction_ids):
|
11617 |
def mark_order_for_registered_gst_invoice(transaction_ids):
|
| - |
|
11618 |
try:
|
| 11618 |
for transaction_id in transaction_ids:
|
11619 |
for transaction_id in transaction_ids:
|
| 11619 |
transaction = get_transaction(transaction_id)
|
11620 |
transaction = get_transaction(transaction_id)
|
| 11620 |
user_client = UserClient().get_client()
|
11621 |
user_client = UserClient().get_client()
|
| 11621 |
counter = user_client.getCounterByUserId(transaction.customer_id)
|
11622 |
counter = user_client.getCounterByUserId(transaction.customer_id)
|
| 11622 |
address = user_client.getAddressById(counter.address)
|
11623 |
address = user_client.getAddressById(counter.address)
|
| 11623 |
for order in transaction.orders:
|
11624 |
for order in transaction.orders:
|
| 11624 |
#oa = Attribute()
|
- |
|
| 11625 |
#oa.value = counter.tin
|
- |
|
| 11626 |
#oa.name='tinNumber'
|
- |
|
| 11627 |
#soa.orderId = order.id
|
- |
|
| 11628 |
|
- |
|
| 11629 |
order.customer_name = address.name
|
11625 |
order.customer_name = address.name
|
| 11630 |
order.customer_pincode = address.pin
|
11626 |
order.customer_pincode = address.pin
|
| 11631 |
order.customer_address1 = address.line1
|
11627 |
order.customer_address1 = address.line1
|
| 11632 |
order.customer_address2 = address.line2
|
11628 |
order.customer_address2 = address.line2
|
| 11633 |
order.customer_city = address.city
|
11629 |
order.customer_city = address.city
|
| 11634 |
order.customer_state = address.state
|
11630 |
order.customer_state = address.state
|
| 11635 |
order.orderType = OrderType.B2B
|
11631 |
order.orderType = OrderType.B2B
|
| 11636 |
order.net_payable_amount -= order.shippingCost
|
- |
|
| 11637 |
order.shippingCost = 0
|
11632 |
session.commit()
|
| 11638 |
#Self Pickup
|
11633 |
return True
|
| 11639 |
order.logistics_provider_id = 4
|
11634 |
except:
|
| 11640 |
#__refund_shipping(list(transaction.orders), False)
|
11635 |
logging.info("Tried accessing counter for user id {0} - {1}".format(transaction.customer_id, transaction.orders[0].customer_email))
|
| 11641 |
#order.shippi
|
11636 |
return False
|
| 11642 |
session.commit()
|
11637 |
finally:
|
| 11643 |
session.close()
|
11638 |
session.close()
|
| 11644 |
if __name__ == '__main__':
|
11639 |
if __name__ == '__main__':
|
| 11645 |
DataService.initialize()
|
11640 |
DataService.initialize()
|
| 11646 |
#transaction_ids=[1030084,1030087,1030090,1030093,1030096,1030099,1030102,1030105,1030108,1030111,1030114,1030117,1030120,1030123,1030144,1030147,1030153]
|
11641 |
#transaction_ids=[1030084,1030087,1030090,1030093,1030096,1030099,1030102,1030105,1030108,1030111,1030114,1030117,1030120,1030123,1030144,1030147,1030153]
|
| 11647 |
transaction_ids=[]
|
11642 |
transaction_ids=[]
|
| 11648 |
mark_order_for_selfpickup_temp(transaction_ids)
|
11643 |
# mark_order_for_selfpickup_temp(transaction_ids)
|
| 11649 |
# get_billed_orders_for_manifest_gen(7441, 2, True)
|
11644 |
# get_billed_orders_for_manifest_gen(7441, 2, True)
|
| 11650 |
# ordersmap = {'911319502886601':1544266,'911319502890314':1544266,'x911319502903141':1544269,'x911319502916655':1544269,'x911319502950985':1544269,'x911319502836309':1544269,'x911319502972369':1544269,'x911319502950860':1544269,'x911319502918313':1544269,
|
11645 |
# ordersmap = {'911319502886601':1544266,'911319502890314':1544266,'x911319502903141':1544269,'x911319502916655':1544269,'x911319502950985':1544269,'x911319502836309':1544269,'x911319502972369':1544269,'x911319502950860':1544269,'x911319502918313':1544269,
|
| 11651 |
# 'x911319502943436':1544269,'x911319502928056':1544269,'x911319502838263':1544269,'911319502794144':1544269,'x911319502821616':1544269,'x911319502974746':1544269,'x911319502821442':1544269,'x911319502903984':1544269,'x911319502820980':1544269,
|
11646 |
# 'x911319502943436':1544269,'x911319502928056':1544269,'x911319502838263':1544269,'911319502794144':1544269,'x911319502821616':1544269,'x911319502974746':1544269,'x911319502821442':1544269,'x911319502903984':1544269,'x911319502820980':1544269,
|
| 11652 |
# 'x911319502973102':1544269,'x911319502913009':1544269,'x911319502973979':1544269,'x911319502842729':1544269,'x911319502824784':1544269,'x911319502847249':1544269,'x911319502848387':1544269,'x911319502887021':1544269,'x911319502962634':1544269,
|
11647 |
# 'x911319502973102':1544269,'x911319502913009':1544269,'x911319502973979':1544269,'x911319502842729':1544269,'x911319502824784':1544269,'x911319502847249':1544269,'x911319502848387':1544269,'x911319502887021':1544269,'x911319502962634':1544269,
|
| 11653 |
# 'x911319502826268':1544269,'x911319502785761':1544269,'x911319502956750':1544269,'x911319502825195':1544269,'x911319502828298':1544269,'x911319502972054':1544269,'x911319502902044':1544269,'x911319502846498':1544269,'x911319502824305':1544269,
|
11648 |
# 'x911319502826268':1544269,'x911319502785761':1544269,'x911319502956750':1544269,'x911319502825195':1544269,'x911319502828298':1544269,'x911319502972054':1544269,'x911319502902044':1544269,'x911319502846498':1544269,'x911319502824305':1544269,
|