示例#1
0
class SharedGroupSerializer(EmbeddedDocumentSerializer):
    user = BDynamicField()
    access = ListField(child=CharField())
    is_owner = BooleanField(default=False)

    class Meta:
        model = SharedGroup
        fields = '__all__'
示例#2
0
class ViewQuerySerializer(EmbeddedDocumentSerializer):
    column = CharField()
    operator = CharField()
    value = BDynamicField()
    logical_operator = CharField()

    class Meta:
        model = ViewQuery
        fields = '__all__'
示例#3
0
class BillingDocumentSerializer(DocumentSerializer):
    beneficiary = BDynamicField(required=True)
    comment = CharField(required=False, allow_null=True)
    doc_date = BDateField()
    attached_files = BEmbeddedListField(serializer=AttachedFileSerializer, allow_null=True, required=False)
    states = DocumentStateSerializer(required=False, allow_null=True)

    class Meta:
        model = BillingDocument
        fields = ['id', 'number', 'beneficiary', 'comment', 'doc_date', 'attached_files', 'states']
示例#4
0
class PaymentLineSerializer(EmbeddedDocumentSerializer):
    total_amount = FloatField(required=False)
    encasement_amount = FloatField(required=False)
    paid_doc = BDynamicField(allow_null=True, required=False)

    class Meta:
        model = PaymentLine
        fields = [
            'encasement_amount', 'paid_doc', 'total_amount', 'remaining_amount'
        ]
示例#5
0
class InvoiceLineSerializer(EmbeddedDocumentSerializer):
    details = BEmbeddedListField(serializer=DetailLineSerializer,
                                 allow_null=True,
                                 required=False)
    description = CharField()
    is_comment = BooleanField(default=False)
    line_doc = BDynamicField(allow_null=True, required=False)

    class Meta:
        model = InvoiceLine
        fields = ['details', 'description', 'is_comment', 'line_doc']
示例#6
0
class DetailLineSerializer(EmbeddedDocumentSerializer):
    code = CharField(required=False)
    description = CharField(required=True)
    discount = FloatField(default=0)
    unit_price = FloatField(default=0)
    qte = FloatField(default=0)
    tariff = TariffSerializer(required=False, allow_null=True)
    line_doc = BDynamicField()
    is_comment = BooleanField(default=False)

    total_amount = FloatField(read_only=True)
    discount_amount = FloatField(read_only=True)

    class Meta:
        model = DetailLine
        fields = [
            'code', 'description', 'discount', 'unit_price', 'qte', 'tariff',
            'line_doc', 'is_comment', 'total_amount', 'discount_amount'
        ]
示例#7
0
class PaymentSerializer(BillingDocumentSerializer):
    beneficiary_type = CharField(allow_blank=True, allow_null=True)
    deadline = BDateField(allow_null=True, required=False)
    payer = BDynamicField(allow_null=True, required=False)
    payer_type = CharField(allow_blank=True, allow_null=True)
    received_amount = FloatField(default=0)
    payment_mode = PaymentModeSerializer(allow_null=True, required=False)
    lines = BEmbeddedListField(serializer=PaymentLineSerializer,
                               allow_null=True,
                               required=False)

    consumed_amount = FloatField(read_only=True)
    remaining_amount = FloatField(read_only=True)
    payer_name = CharField(read_only=True)
    beneficiary_name = CharField(read_only=True)

    class Meta:
        model = Payment
        fields = BillingDocumentSerializer.Meta.fields + [
            'beneficiary_type', 'deadline', 'payer', 'payer_type',
            'received_amount', 'payment_mode', 'consumed_amount',
            'remaining_amount', 'payer_name', 'beneficiary_name', 'lines'
        ]