Merge branch 'release/2.0.13'

This commit is contained in:
Nathan Chapman 2022-11-08 18:05:36 -07:00
commit 83ff171986
5 changed files with 27 additions and 4 deletions

View File

@ -0,0 +1,19 @@
# Generated by Django 4.0.2 on 2022-11-09 00:38
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
('core', '0010_alter_productvariant_sku'),
]
operations = [
migrations.AlterField(
model_name='productvariant',
name='image',
field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='+', to='core.productphoto'),
),
]

View File

@ -161,6 +161,7 @@ class ProductVariant(models.Model):
ProductPhoto, ProductPhoto,
on_delete=models.SET_NULL, on_delete=models.SET_NULL,
related_name='+', related_name='+',
blank=True,
null=True null=True
) )
name = models.CharField(max_length=255) name = models.CharField(max_length=255)

View File

@ -25,6 +25,7 @@ class ProductVariantUpdateForm(forms.ModelForm):
'weight', 'weight',
'track_inventory', 'track_inventory',
'stock', 'stock',
'sorting',
'image' 'image'
] ]

View File

@ -93,15 +93,17 @@ class CreateOrder(PayPalClient):
processed_items = [ processed_items = [
{ {
# Shows within upper-right dropdown during payment approval # Shows within upper-right dropdown during payment approval
"name": str(item["variant"]), "name": f"{item['variant']} " + "; ".join(
f"{key}: {value}" for key, value in item["options"].items()
),
# Item details will also be in the completed paypal.com # Item details will also be in the completed paypal.com
# transaction view # transaction view
"description": item["variant"].product.subtitle, "description": item["variant"].product.subtitle,
"unit_amount": { "unit_amount": {
"currency_code": settings.DEFAULT_CURRENCY, "currency_code": settings.DEFAULT_CURRENCY,
"value": f'{item["variant"].price}', "value": f"{item['variant'].price}",
}, },
"quantity": f'{item["quantity"]}', "quantity": f"{item['quantity']}",
} }
for item in params["items"] for item in params["items"]
] ]

View File

@ -216,7 +216,7 @@ class ProductDetailView(FormMixin, DetailView):
track_inventory=True, track_inventory=True,
stock__gt=0 stock__gt=0
) )
).order_by('name') ).order_by('sorting', 'name')
options = ProductOption.objects.filter(products__pk=self.object.pk) options = ProductOption.objects.filter(products__pk=self.object.pk)
if form_class is None: if form_class is None:
form_class = self.get_form_class() form_class = self.get_form_class()