feat: add profit and special discount fields to ProductVariant model
- Updated ProductVariant model to include 'profit' and 'special_discount_percent' fields. - Added corresponding fields in the admin interface for ProductVariant. - Created migration to add new fields to the database. feat: implement special discount code functionality in cart - Added composables for submitting and deleting special discount codes. - Updated CartSummary and CartItem components to handle special discount codes. - Enhanced API endpoints to support special discount operations. - Updated global types to include special discount code details in the cart.
This commit is contained in:
@@ -0,0 +1,35 @@
|
||||
# Generated by Django 5.1.2 on 2025-11-14 14:07
|
||||
|
||||
import django.db.models.deletion
|
||||
from django.db import migrations, models
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
dependencies = [
|
||||
('account', '0032_specialdiscountcode'),
|
||||
('order', '0037_ordermodel_is_stock_rolled_back'),
|
||||
]
|
||||
|
||||
operations = [
|
||||
migrations.AddField(
|
||||
model_name='cart',
|
||||
name='special_discount_code',
|
||||
field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.PROTECT, to='account.specialdiscountcode', verbose_name='کدتخفیف خاص'),
|
||||
),
|
||||
migrations.AddField(
|
||||
model_name='cartitem',
|
||||
name='special_discount_amount',
|
||||
field=models.BigIntegerField(default=0, help_text='تخفیف محاسبه شده از سود تنوع', verbose_name='مقدار تخفیف ویژه'),
|
||||
),
|
||||
migrations.AddField(
|
||||
model_name='orderitemmodel',
|
||||
name='special_discount_amount',
|
||||
field=models.BigIntegerField(default=0, verbose_name='مقدار تخفیف ویژه'),
|
||||
),
|
||||
migrations.AddField(
|
||||
model_name='ordermodel',
|
||||
name='special_discount_total',
|
||||
field=models.BigIntegerField(blank=True, null=True, verbose_name='مجموع تخفیف ویژه'),
|
||||
),
|
||||
]
|
||||
@@ -0,0 +1,17 @@
|
||||
# Generated by Django 5.1.2 on 2025-11-14 15:19
|
||||
|
||||
from django.db import migrations
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
dependencies = [
|
||||
('order', '0038_cart_special_discount_code_and_more'),
|
||||
]
|
||||
|
||||
operations = [
|
||||
migrations.RemoveField(
|
||||
model_name='cartitem',
|
||||
name='special_discount_amount',
|
||||
),
|
||||
]
|
||||
Reference in New Issue
Block a user