distributor_short_name

Brightcells 6 gadi atpakaļ
vecāks
revīzija
f4e231d906
4 mainītis faili ar 13 papildinājumiem un 1 dzēšanām
  1. 5 0
      api/distributor_views.py
  2. 3 0
      mch/models.py
  3. 3 0
      page/sale_views.py
  4. 2 1
      statistic/models.py

+ 5 - 0
api/distributor_views.py

@@ -13,6 +13,7 @@ from utils.error.errno_utils import AdministratorStatusCode, ProductDistributorS
13 13
 @logit
14 14
 def distributor_add(request):
15 15
     distributor_name = request.POST.get('distributor_name', '')
16
+    distributor_short_name = request.POST.get('distributor_short_name', '')
16 17
     province_code = request.POST.get('province_code', '')
17 18
     province_name = request.POST.get('province_name', '')
18 19
 
@@ -26,6 +27,7 @@ def distributor_add(request):
26 27
     DistributorInfo.objects.create(
27 28
         brand_id=administrator.brand_id,
28 29
         distributor_name=distributor_name,
30
+        distributor_short_name=distributor_short_name,
29 31
         distributor_province_code=province_code,
30 32
         distributor_province_name=province_name,
31 33
     )
@@ -59,6 +61,7 @@ def distributor_delete(request):
59 61
 def distributor_update(request):
60 62
     distributor_id = request.POST.get('distributor_id', '')
61 63
     distributor_name = request.POST.get('distributor_name', '')
64
+    distributor_short_name = request.POST.get('distributor_short_name', '')
62 65
     province_code = request.POST.get('province_code', '')
63 66
     province_name = request.POST.get('province_name', '')
64 67
 
@@ -76,6 +79,8 @@ def distributor_update(request):
76 79
 
77 80
     if distributor_name:
78 81
         distributor.distributor_name = distributor_name
82
+    if distributor_short_name:
83
+        distributor.distributor_short_name = distributor_short_name
79 84
     if province_code:
80 85
         distributor.distributor_province_code = province_code
81 86
     if province_name:

+ 3 - 0
mch/models.py

@@ -236,6 +236,7 @@ class DistributorInfo(BaseModelMixin):
236 236
 
237 237
     distributor_id = ShortUUIDField(_(u'distributor_id'), max_length=32, help_text=u'经销商唯一标识', db_index=True, unique=True)
238 238
     distributor_name = models.CharField(_(u'distributor_name'), max_length=255, blank=True, null=True, help_text=u'经销商名称')
239
+    distributor_short_name = models.CharField(_(u'distributor_short_name'), max_length=8, blank=True, null=True, help_text=u'经销商简称')
239 240
     distributor_descr = models.TextField(_(u'distributor_descr'), max_length=255, blank=True, null=True, help_text=u'经销商描述')
240 241
 
241 242
     distributor_province_code = models.CharField(_(u'distributor_province_code'), max_length=6, blank=True, null=True, help_text=u'经销商所在省份编码')
@@ -255,6 +256,7 @@ class DistributorInfo(BaseModelMixin):
255 256
         return {
256 257
             'distributor_id': str(self.pk),
257 258
             'distributor_name': self.distributor_name,
259
+            'distributor_short_name': self.distributor_short_name,
258 260
             'distributor_descr': self.distributor_descr,
259 261
         }
260 262
 
@@ -263,6 +265,7 @@ class DistributorInfo(BaseModelMixin):
263 265
         return {
264 266
             'distributor_id': self.distributor_id,
265 267
             'distributor_name': self.distributor_name,
268
+            'distributor_short_name': self.distributor_short_name,
266 269
             'distributor_descr': self.distributor_descr,
267 270
             'province_code': self.distributor_province_code,
268 271
             'province_name': self.distributor_province_name,

+ 3 - 0
page/sale_views.py

@@ -245,6 +245,7 @@ def clerk_sale_submit_api(request):
245 245
         )
246 246
         sssi.distributor_id = distributor.distributor_id
247 247
         sssi.distributor_name = distributor.distributor_name
248
+        sssi.distributor_short_name = distributor.distributor_short_name
248 249
         sssi.clerk_name = clerk.clerk_name
249 250
         sssi.num += 1
250 251
         sssi.save()
@@ -256,6 +257,7 @@ def clerk_sale_submit_api(request):
256 257
         )
257 258
         sssi.distributor_id = distributor.distributor_id
258 259
         sssi.distributor_name = distributor.distributor_name
260
+        sssi.distributor_short_name = distributor.distributor_short_name
259 261
         sssi.clerk_name = clerk.clerk_name
260 262
         sssi.num += 1
261 263
         sssi.save()
@@ -267,6 +269,7 @@ def clerk_sale_submit_api(request):
267 269
         )
268 270
         sssi.distributor_id = distributor.distributor_id
269 271
         sssi.distributor_name = distributor.distributor_name
272
+        sssi.distributor_short_name = distributor.distributor_short_name
270 273
         sssi.clerk_name = clerk.clerk_name
271 274
         sssi.num += 1
272 275
         sssi.save()

+ 2 - 1
statistic/models.py

@@ -138,6 +138,7 @@ class SaleclerkSaleStatisticInfo(BaseModelMixin):
138 138
     brand_id = models.CharField(_(u'brand_id'), max_length=32, blank=True, null=True, help_text=u'品牌唯一标识', db_index=True)
139 139
     distributor_id = models.CharField(_(u'distributor_id'), max_length=32, blank=True, null=True, help_text=u'经销商唯一标识', db_index=True)
140 140
     distributor_name = models.CharField(_(u'distributor_name'), max_length=32, blank=True, null=True, help_text=u'经销商名称')
141
+    distributor_short_name = models.CharField(_(u'distributor_short_name'), max_length=8, blank=True, null=True, help_text=u'经销商简称')
141 142
     clerk_id = models.CharField(_(u'clerk_id'), max_length=32, blank=True, null=True, help_text=u'店员唯一标识', db_index=True)
142 143
     clerk_name = models.CharField(_(u'clerk_name'), max_length=32, blank=True, null=True, help_text=u'店员名称')
143 144
     ymd = models.IntegerField(_(u'ymd'), default=0, help_text=u'年月日', db_index=True)  # 例:20171208, tc.local_string(format='%Y%m%d'), 0 为全部
@@ -153,7 +154,7 @@ class SaleclerkSaleStatisticInfo(BaseModelMixin):
153 154
     @property
154 155
     def data(self):
155 156
         return {
156
-            'distributor_name': self.distributor_name,
157
+            'distributor_name': self.distributor_short_name or self.distributor_name or '',
157 158
             'salesman_id': self.clerk_id,
158 159
             'salesman_name': self.clerk_name,
159 160
             # 'ymd': self.ymd,