Subversion Repositories SmartDukaan

Rev

Rev 20965 | Rev 20989 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 20965 Rev 20966
Line 9589... Line 9589...
9589
                            OrderStatus.LOW_INV_REVERSAL_IN_PROCESS, 
9589
                            OrderStatus.LOW_INV_REVERSAL_IN_PROCESS, 
9590
                            OrderStatus.LOW_INV_NOT_AVAILABLE_AT_HOTSPOT, 
9590
                            OrderStatus.LOW_INV_NOT_AVAILABLE_AT_HOTSPOT, 
9591
                            OrderStatus.CAPTURE_IN_PROCESS, OrderStatus.REJECTED]:
9591
                            OrderStatus.CAPTURE_IN_PROCESS, OrderStatus.REJECTED]:
9592
        raise TransactionServiceException(115, "Order not allowed to be split")
9592
        raise TransactionServiceException(115, "Order not allowed to be split")
9593
    
9593
    
9594
    new_order = __copy_row(Order, order, [id])
9594
    new_order = __copy_order(order)
9595
    
9595
    
9596
    new_order.lineitems[0].quantity = split_order_quantity
9596
    new_order.lineitems[0].quantity = split_order_quantity
9597
    new_order.logistics_provider_id = order.logistics_provider_id
9597
    new_order.logistics_provider_id = order.logistics_provider_id
9598
    new_order.lineitems[0].logisticsCost = round((order.lineitems[0].logisticsCost/order.lineitems[0].quantity)*split_order_quantity,2)
9598
    new_order.lineitems[0].logisticsCost = round((order.lineitems[0].logisticsCost/order.lineitems[0].quantity)*split_order_quantity,2)
9599
    order.lineitems[0].logisticsCost = order.lineitems[0].logisticsCost - new_order.lineitems[0].logisticsCost
9599
    order.lineitems[0].logisticsCost = order.lineitems[0].logisticsCost - new_order.lineitems[0].logisticsCost
Line 11399... Line 11399...
11399
    if cod:
11399
    if cod:
11400
        return c_returnMap.values()
11400
        return c_returnMap.values()
11401
    else:
11401
    else:
11402
        return p_returnMap.values()
11402
        return p_returnMap.values()
11403
 
11403
 
11404
def __copy_row(model, row, ignored_columns=[]):
11404
def __copy_order(order):
11405
    copy = model()
11405
    copy = Order()
-
 
11406
    copy.from_dict(order.to_dict())
-
 
11407
    copy.id = None
11406
 
11408
 
11407
    for col in row.__table__.columns:
-
 
11408
        if col.name not in ignored_columns:
-
 
11409
            try:
11409
    lineitem = LineItem()
11410
                copy.__setattr__(col.name, getattr(row, col.name))
11410
    lineitem.from_dict(order.lineitems[0].to_dict())
11411
            except Exception as e:
-
 
11412
                print e
11411
    lineitem.id = None
11413
                continue
11412
    copy.lineitems = [lineitem]
11414
 
11413
    
11415
    return copy
11414
    return copy
11416
 
11415
 
11417
 
11416
 
11418
 
11417
 
11419
if __name__ == '__main__':
11418
if __name__ == '__main__':