fix bug of rancher nations code key in transaction
This commit is contained in:
@@ -70,6 +70,7 @@ INSTALLED_APPS = [
|
|||||||
'apps.search.apps.SearchConfig',
|
'apps.search.apps.SearchConfig',
|
||||||
'apps.log.apps.LogConfig',
|
'apps.log.apps.LogConfig',
|
||||||
'apps.product.apps.ProductConfig',
|
'apps.product.apps.ProductConfig',
|
||||||
|
'apps.notification.apps.NotificationConfig',
|
||||||
'rest_captcha',
|
'rest_captcha',
|
||||||
'captcha',
|
'captcha',
|
||||||
'drf_yasg',
|
'drf_yasg',
|
||||||
|
|||||||
@@ -41,5 +41,6 @@ urlpatterns = [
|
|||||||
path('product/', include('apps.product.urls')),
|
path('product/', include('apps.product.urls')),
|
||||||
path('warehouse/', include('apps.warehouse.urls')),
|
path('warehouse/', include('apps.warehouse.urls')),
|
||||||
path('pos_device/', include('apps.pos_device.urls')),
|
path('pos_device/', include('apps.pos_device.urls')),
|
||||||
|
path('notification/', include('apps.notification.urls')),
|
||||||
path('swagger/', schema_view.with_ui('swagger', cache_timeout=0), name='schema-swagger-ui'),
|
path('swagger/', schema_view.with_ui('swagger', cache_timeout=0), name='schema-swagger-ui'),
|
||||||
]
|
]
|
||||||
|
|||||||
@@ -0,0 +1,10 @@
|
|||||||
|
from django.apps import AppConfig
|
||||||
|
|
||||||
|
|
||||||
|
class NotificationConfig(AppConfig):
|
||||||
|
default_auto_field = 'django.db.models.BigAutoField'
|
||||||
|
name = 'apps.notification'
|
||||||
|
|
||||||
|
def ready(self):
|
||||||
|
import apps.notification.signals
|
||||||
|
|
||||||
|
|||||||
40
apps/notification/migrations/0001_initial.py
Normal file
40
apps/notification/migrations/0001_initial.py
Normal file
@@ -0,0 +1,40 @@
|
|||||||
|
# Generated by Django 5.0 on 2025-09-29 12:30
|
||||||
|
|
||||||
|
import django.db.models.deletion
|
||||||
|
from django.conf import settings
|
||||||
|
from django.db import migrations, models
|
||||||
|
|
||||||
|
|
||||||
|
class Migration(migrations.Migration):
|
||||||
|
|
||||||
|
initial = True
|
||||||
|
|
||||||
|
dependencies = [
|
||||||
|
('authentication', '0036_organization_phone'),
|
||||||
|
migrations.swappable_dependency(settings.AUTH_USER_MODEL),
|
||||||
|
]
|
||||||
|
|
||||||
|
operations = [
|
||||||
|
migrations.CreateModel(
|
||||||
|
name='Notification',
|
||||||
|
fields=[
|
||||||
|
('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
|
||||||
|
('create_date', models.DateTimeField(auto_now_add=True)),
|
||||||
|
('modify_date', models.DateTimeField(auto_now=True)),
|
||||||
|
('creator_info', models.CharField(max_length=100, null=True)),
|
||||||
|
('modifier_info', models.CharField(max_length=100, null=True)),
|
||||||
|
('trash', models.BooleanField(default=False)),
|
||||||
|
('title', models.CharField(max_length=255, null=True)),
|
||||||
|
('message', models.TextField(blank=True, null=True)),
|
||||||
|
('type', models.CharField(choices=[('quota', 'Quota'), ('inventory', 'Inventory'), ('transaction', 'Transaction'), ('system', 'System')], default='system', max_length=50)),
|
||||||
|
('is_read', models.BooleanField(default=False)),
|
||||||
|
('delivered', models.BooleanField(default=False)),
|
||||||
|
('created_by', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, related_name='%(class)s_createddby', to=settings.AUTH_USER_MODEL)),
|
||||||
|
('modified_by', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, related_name='%(class)s_modifiedby', to=settings.AUTH_USER_MODEL)),
|
||||||
|
('organization', models.ForeignKey(null=True, on_delete=django.db.models.deletion.CASCADE, related_name='notifications', to='authentication.organization')),
|
||||||
|
],
|
||||||
|
options={
|
||||||
|
'abstract': False,
|
||||||
|
},
|
||||||
|
),
|
||||||
|
]
|
||||||
@@ -1 +1,6 @@
|
|||||||
# Your urls go here
|
from django.urls import path, include
|
||||||
|
|
||||||
|
urlpatterns = [
|
||||||
|
path('web/', include('apps.notification.web.api.v1.urls')),
|
||||||
|
path('pos/', include('apps.notification.pos.api.v1.urls'))
|
||||||
|
]
|
||||||
|
|||||||
@@ -122,7 +122,10 @@ class InventoryQuotaSaleTransactionSerializer(serializers.ModelSerializer):
|
|||||||
|
|
||||||
def create(self, validated_data):
|
def create(self, validated_data):
|
||||||
items_data = self.context['request'].data['items']
|
items_data = self.context['request'].data['items']
|
||||||
rancher_code = validated_data.pop('rancher_national_code')
|
rancher_code = validated_data.pop(
|
||||||
|
'rancher_national_code'
|
||||||
|
) if 'rancher_national_code' in self.context['request'].data.keys() else None
|
||||||
|
|
||||||
with atomic():
|
with atomic():
|
||||||
# get rancher with national code
|
# get rancher with national code
|
||||||
rancher = None
|
rancher = None
|
||||||
|
|||||||
Reference in New Issue
Block a user