2014-07-23 16:24:56 +00:00
|
|
|
from rest_framework import serializers
|
|
|
|
|
2014-07-28 17:28:00 +00:00
|
|
|
from orchestra.apps.accounts.serializers import AccountSerializerMixin
|
|
|
|
|
2014-07-23 16:24:56 +00:00
|
|
|
from .models import Bill, BillLine
|
|
|
|
|
|
|
|
|
|
|
|
class BillLineSerializer(serializers.HyperlinkedModelSerializer):
|
|
|
|
class Meta:
|
|
|
|
model = BillLine
|
|
|
|
|
|
|
|
|
2014-07-28 17:28:00 +00:00
|
|
|
|
|
|
|
class BillSerializer(AccountSerializerMixin, serializers.HyperlinkedModelSerializer):
|
2014-07-23 16:24:56 +00:00
|
|
|
lines = BillLineSerializer(source='billlines')
|
|
|
|
|
|
|
|
class Meta:
|
|
|
|
model = Bill
|
2014-07-28 17:28:00 +00:00
|
|
|
fields = (
|
2014-09-30 16:39:47 +00:00
|
|
|
'url', 'number', 'type', 'total', 'is_sent', 'created_on', 'due_on',
|
2014-07-28 17:28:00 +00:00
|
|
|
'comments', 'html', 'lines'
|
|
|
|
)
|