-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* 供应商模块(供应商、供应商文件、供应商报价) 财务管理(以标单为主,合同金额明细模型) * 外键复数
- Loading branch information
Showing
10 changed files
with
155 additions
and
18 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
from rest_framework import viewsets | ||
|
||
from Core.utils.pagination import SmallResultsSetPagination | ||
from Procurement.models import ContractDetail | ||
from Procurement import serializers | ||
|
||
|
||
class ContractDetailViewSet(viewsets.ModelViewSet): | ||
pagination_class = SmallResultsSetPagination | ||
queryset = ContractDetail.objects.all().order_by('-pk') | ||
serializer_class = serializers.ContractDetailSerializer | ||
|
||
def perform_create(self, serializer): | ||
serializer.save(submitter=self.request.user,) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
from rest_framework import viewsets | ||
|
||
from Core.utils.pagination import SmallResultsSetPagination | ||
from Procurement.models import Supplier, SupplierDocument, Quotation | ||
from Procurement import serializers | ||
|
||
|
||
class SupplierViewSet(viewsets.ModelViewSet): | ||
pagination_class = SmallResultsSetPagination | ||
queryset = Supplier.objects.all().order_by('-pk') | ||
serializer_class = serializers.SupplierSerializer | ||
|
||
def get_serializer_class(self): | ||
if self.action == 'list': | ||
return serializers.SupplierListSerializer | ||
elif self.action == "retrieve": | ||
return serializers.SupplierDetailSerializer | ||
else: | ||
return serializers.SupplierSerializer | ||
|
||
|
||
class SupplierDocumentViewSet(viewsets.ModelViewSet): | ||
pagination_class = SmallResultsSetPagination | ||
queryset = SupplierDocument.objects.all().order_by('-pk') | ||
serializer_class = serializers.SupplierDocumentSerializer | ||
|
||
|
||
class QuotationViewSet(viewsets.ModelViewSet): | ||
pagination_class = SmallResultsSetPagination | ||
queryset = Quotation.objects.all().order_by('-pk') | ||
serializer_class = serializers.QuotationSerializer |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
# -*- coding: utf-8 -*- | ||
# Generated by Django 1.11.6 on 2017-12-24 20:07 | ||
from __future__ import unicode_literals | ||
|
||
from django.db import migrations, models | ||
import django.db.models.deletion | ||
|
||
|
||
class Migration(migrations.Migration): | ||
|
||
dependencies = [ | ||
('Procurement', '0004_auto_20171223_1959'), | ||
] | ||
|
||
operations = [ | ||
migrations.AlterField( | ||
model_name='quotation', | ||
name='supplier', | ||
field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='quotations', to='Procurement.Supplier', verbose_name='供应商'), | ||
), | ||
migrations.AlterField( | ||
model_name='supplierdocument', | ||
name='supplier', | ||
field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='docs', to='Procurement.Supplier', verbose_name='供应商'), | ||
), | ||
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
from rest_framework import serializers | ||
|
||
from Procurement.models import ContractDetail | ||
|
||
|
||
class ContractDetailSerializer(serializers.ModelSerializer): | ||
|
||
class Meta: | ||
model = ContractDetail | ||
fields = '__all__' | ||
read_only_fields = ('submitter',) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
from rest_framework import serializers | ||
|
||
from Procurement.models import Supplier, SupplierDocument, Quotation | ||
|
||
|
||
class SupplierSerializer(serializers.ModelSerializer): | ||
|
||
class Meta: | ||
model = Supplier | ||
fields = '__all__' | ||
|
||
|
||
class SupplierDocumentSerializer(serializers.ModelSerializer): | ||
|
||
class Meta: | ||
model = SupplierDocument | ||
fields = '__all__' | ||
|
||
|
||
class QuotationSerializer(serializers.ModelSerializer): | ||
|
||
class Meta: | ||
model = Quotation | ||
fields = '__all__' | ||
|
||
|
||
class SupplierListSerializer(SupplierSerializer): | ||
doc = SupplierDocumentSerializer(read_only=True, many=True) | ||
|
||
class Meta(SupplierSerializer.Meta): | ||
fields = '__all__' | ||
|
||
|
||
class SupplierDetailSerializer(SupplierSerializer): | ||
doc = SupplierDocumentSerializer(read_only=True, many=True) | ||
quotation = QuotationSerializer(read_only=True, many=True) | ||
|
||
class Meta(SupplierSerializer.Meta): | ||
fields = '__all__' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters