added serializer BillingProject
This commit is contained in:
parent
3843e23394
commit
2f7715b265
1 changed files with 15 additions and 1 deletions
|
@ -1,7 +1,7 @@
|
||||||
from djmoney.contrib.django_rest_framework import MoneyField
|
from djmoney.contrib.django_rest_framework import MoneyField
|
||||||
from rest_framework import serializers
|
from rest_framework import serializers
|
||||||
|
|
||||||
from core.models import Invoice
|
from core.models import Invoice, BillingProject
|
||||||
from core.component import component
|
from core.component import component
|
||||||
|
|
||||||
|
|
||||||
|
@ -54,3 +54,17 @@ class SimpleInvoiceSerializer(serializers.ModelSerializer):
|
||||||
model = Invoice
|
model = Invoice
|
||||||
fields = ['id', 'start_date', 'end_date', 'state', 'tax', 'subtotal', 'subtotal_currency', 'total',
|
fields = ['id', 'start_date', 'end_date', 'state', 'tax', 'subtotal', 'subtotal_currency', 'total',
|
||||||
'total_currency']
|
'total_currency']
|
||||||
|
|
||||||
|
|
||||||
|
class BillingProjectSerializer(serializers.ModelSerializer):
|
||||||
|
tenant_id = serializers.CharField(required=False, read_only=True)
|
||||||
|
email_notification = serializers.EmailField(required=False)
|
||||||
|
|
||||||
|
def update(self, instance, validated_data):
|
||||||
|
instance.email_notification = validated_data.get('email_notification', instance.email_notification)
|
||||||
|
instance.save()
|
||||||
|
return instance
|
||||||
|
|
||||||
|
class Meta:
|
||||||
|
model = BillingProject
|
||||||
|
fields = ['tenant_id', 'email_notification']
|
||||||
|
|
Loading…
Add table
Reference in a new issue