|
@@ -8,9 +8,20 @@ from apps.product_order.models import *
|
|
|
from apps.base import Formater
|
|
|
from utils.exceptions import CustomError
|
|
|
from apps.maint_order.models import MaintOrderReserve
|
|
|
+from .xgj import XGJ
|
|
|
|
|
|
|
|
|
class CustomerVehicleSerializer(serializers.ModelSerializer):
|
|
|
+ has_orders = serializers.SerializerMethodField()
|
|
|
+
|
|
|
+ def get_has_orders(self, obj):
|
|
|
+ abutment_xgj = Config.getConfigValue(Config.KEY_ABUTMENT_XGJ) or ''
|
|
|
+ if abutment_xgj and abutment_xgj == 'true':
|
|
|
+ res = XGJ.get_order(obj.id)
|
|
|
+ if len(res['data']) > 0:
|
|
|
+ return True
|
|
|
+ return False
|
|
|
+ return False
|
|
|
|
|
|
class Meta:
|
|
|
model = CustomerVehicle
|