Skip to content

Saleor Core: the high performance, composable, headless commerce API.

Standardize shipment naming in translation strings and docstrings

Anna Siwike52bc2ca2528
diff --git a/saleor/checkout/core.py b/saleor/checkout/core.py
index 5094da5630..a954bee7fa 100644
--- a/saleor/checkout/core.py
+++ b/saleor/checkout/core.py
@@ -99,7 +99,7 @@ class Checkout(object):
@property
def deliveries(self):
- """Return the cart split into delivery groups.
+ """Return the cart split into shipment groups.
Generates tuples consisting of a partition, its shipping cost and its
total cost.
diff --git a/saleor/dashboard/order/forms.py b/saleor/dashboard/order/forms.py
index c8d67e4e4d..6c44a1c4ce 100644
--- a/saleor/dashboard/order/forms.py
+++ b/saleor/dashboard/order/forms.py
@@ -101,7 +101,7 @@ class MoveLinesForm(forms.Form):
target_group = forms.ModelChoiceField(
queryset=DeliveryGroup.objects.none(), required=False,
empty_label=pgettext_lazy(
- 'Delivery group value for `target_group` field',
+ 'Shipment group value for `target_group` field',
'New shipment'),
label=pgettext_lazy('Move lines form label', 'Target shipment'))
@@ -121,7 +121,7 @@ class MoveLinesForm(forms.Form):
how_many = self.cleaned_data.get('quantity')
target_group = self.cleaned_data.get('target_group')
if not target_group:
- # For new group we use the same delivery name but zero price
+ # For new group we use the same shipping name but zero price
target_group = self.old_group.order.groups.create(
status=self.old_group.status,
shipping_method_name=self.old_group.shipping_method_name)
@@ -326,14 +326,14 @@ class ChangeStockForm(forms.ModelForm):
class AddVariantToDeliveryGroupForm(forms.Form):
- """ Adds variant in given quantity to delivery group. """
+ """ Adds variant in given quantity to shipment group. """
variant = AjaxSelect2ChoiceField(
queryset=ProductVariant.objects.filter(
product__in=Product.objects.get_available_products()),
fetch_data_url=reverse_lazy('dashboard:ajax-available-variants'))
quantity = QuantityField(
label=pgettext_lazy(
- 'Add variant to delivery group form label', 'Quantity'),
+ 'Add variant to shipment group form label', 'Quantity'),
validators=[MinValueValidator(1)])
def __init__(self, *args, **kwargs):
diff --git a/saleor/dashboard/order/views.py b/saleor/dashboard/order/views.py
index faea144c4c..4ff5e12904 100644
--- a/saleor/dashboard/order/views.py
+++ b/saleor/dashboard/order/views.py
@@ -210,10 +210,10 @@ def orderline_split(request, order_pk, line_pk):
target_group = form.move_lines()
if not old_group.pk:
old_group = pgettext_lazy(
- 'Dashboard message related to a delivery group',
+ 'Dashboard message related to a shipment group',
'removed group')
msg = pgettext_lazy(
- 'Dashboard message related to delivery groups',
+ 'Dashboard message related to shipment groups',
'Moved %(how_many)s items %(item)s from %(old_group)s'
' to %(new_group)s') % {
'how_many': how_many, 'item': line, 'old_group': old_group,
@@ -264,7 +264,7 @@ def ship_delivery_group(request, order_pk, group_pk):
with transaction.atomic():
form.save()
msg = pgettext_lazy(
- 'Dashboard message related to a delivery group',
+ 'Dashboard message related to a shipment group',
'Shipped %s') % group
messages.success(request, msg)
group.order.create_history_entry(comment=msg, user=request.user)
@@ -287,7 +287,7 @@ def cancel_delivery_group(request, order_pk, group_pk):
with transaction.atomic():
form.cancel_group()
msg = pgettext_lazy(
- 'Dashboard message related to a delivery group',
+ 'Dashboard message related to a shipment group',
'Cancelled %s') % group
messages.success(request, msg)
group.order.create_history_entry(comment=msg, user=request.user)
@@ -317,13 +317,13 @@ def add_variant_to_group(request, order_pk, group_pk):
with transaction.atomic():
form.save()
msg = pgettext_lazy(
- 'Dashboard message related to a delivery group',
+ 'Dashboard message related to a shipment group',
'Added %(quantity)d x %(variant)s to %(group)s') % msg_dict
order.create_history_entry(comment=msg, user=request.user)
messages.success(request, msg)
except InsufficientStock:
msg = pgettext_lazy(
- 'Dashboard message related to a delivery group',
+ 'Dashboard message related to a shipment group',
'Insufficient stock: could not add %(quantity)d x '
'%(variant)s to %(group)s') % msg_dict
messages.warning(request, msg)
diff --git a/saleor/order/models.py b/saleor/order/models.py
index 91fd788128..8f9615bb09 100644
--- a/saleor/order/models.py
+++ b/saleor/order/models.py
@@ -223,30 +223,30 @@ class Order(models.Model, ItemSet):
class DeliveryGroup(models.Model, ItemSet):
"""Represents a single shipment.
- A single order can consist of may delivery groups.
+ A single order can consist of many shipment groups.
"""
status = models.CharField(
- pgettext_lazy('Delivery group field', 'delivery status'),
+ pgettext_lazy('Shipment group field', 'shipment status'),
max_length=32, default=OrderStatus.NEW, choices=OrderStatus.CHOICES)
order = models.ForeignKey(
Order, related_name='groups', editable=False, on_delete=models.CASCADE)
shipping_price = PriceField(
- pgettext_lazy('Delivery group field', 'shipping price'),
+ pgettext_lazy('Shipment group field', 'shipping price'),
currency=settings.DEFAULT_CURRENCY, max_digits=12, decimal_places=4,
default=0, editable=False)
shipping_method_name = models.CharField(
- pgettext_lazy('Delivery group field', 'shipping method name'),
+ pgettext_lazy('Shipment group field', 'shipping method name'),
max_length=255, null=True, default=None, blank=True, editable=False)
tracking_number = models.CharField(
- pgettext_lazy('Delivery group field', 'tracking number'),
+ pgettext_lazy('Shipment group field', 'tracking number'),
max_length=255, default='', blank=True)
last_updated = models.DateTimeField(
- pgettext_lazy('Delivery group field', 'last updated'),
+ pgettext_lazy('Shipment group field', 'last updated'),
null=True, auto_now=True)
def __str__(self):
return pgettext_lazy(
- 'Delivery group str', 'Shipment #%s') % self.pk
+ 'Shipment group str', 'Shipment #%s') % self.pk
def __repr__(self):
return '%s(%r)' % (self.__class__.__name__, list(self))
@@ -325,7 +325,7 @@ class OrderLineManager(models.Manager):
class OrderLine(models.Model, ItemLine):
delivery_group = models.ForeignKey(
DeliveryGroup, related_name='lines', editable=False,
- verbose_name=pgettext_lazy('Ordered line field', 'delivery group'),
+ verbose_name=pgettext_lazy('Ordered line field', 'shipment group'),
on_delete=models.CASCADE)
product = models.ForeignKey(
Product, blank=True, null=True, related_name='+',
diff --git a/saleor/order/utils.py b/saleor/order/utils.py
index d28d73d94b..a86a9441dc 100644
--- a/saleor/order/utils.py
+++ b/saleor/order/utils.py
@@ -58,7 +58,7 @@ def attach_order_to_user(order, user):
def fill_group_with_partition(group, partition, discounts=None):
"""
- Fills delivery group with order lines created from partition items.
+ Fills shipment group with order lines created from partition items.
"""
for item in partition:
add_variant_to_delivery_group(
@@ -160,7 +160,7 @@ def cancel_order(order):
def merge_duplicated_lines(line):
- """ Merges duplicated lines in delivery group into one (given) line.
+ """ Merges duplicated lines in shipment group into one (given) line.
If there are no duplicates, nothing will happen.
"""
lines = line.delivery_group.lines.filter(
diff --git a/tests/dashboard/test_order.py b/tests/dashboard/test_order.py
index 09ea260d56..b685d62386 100644
--- a/tests/dashboard/test_order.py
+++ b/tests/dashboard/test_order.py
@@ -51,7 +51,7 @@ def test_view_cancel_order_line(admin_client, order_with_lines_and_stock):
'line_pk': OrderLine.objects.get().pk})
response = admin_client.post(
url, {'csrfmiddlewaretoken': 'hello'}, follow=True)
- # check delivery group removal if it becomes empty
+ # check shipment group removal if it becomes empty
assert Order.objects.get().get_lines().count() == 0
assert DeliveryGroup.objects.count() == 0
# check success messages after redirect
@@ -94,7 +94,7 @@ def test_view_change_order_line_quantity(admin_client, order_with_lines_and_stoc
line.refresh_from_db()
# source line quantity should be decreased to 2
assert line.quantity == 2
- # order should have the same delivery groups count
+ # order should have the same shipment groups count
assert order_with_lines_and_stock.groups.count() == 1
# a note in the order's history should be created
assert OrderHistoryEntry.objects.get(
@@ -213,7 +213,7 @@ def test_view_split_order_line(admin_client, order_with_lines_and_stock):
line.refresh_from_db()
# source line quantity should be decreased to 1
assert line.quantity == line_quantity_before_split - 2
- # order should have 2 delivery groups now
+ # order should have 2 shipment groups now
assert order_with_lines_and_stock.groups.count() == 2
# a note in the order's history should be created
new_group = DeliveryGroup.objects.last()
@@ -256,7 +256,7 @@ def test_view_split_order_line_with_invalid_data(admin_client, order_with_lines_
"""
user goes to order details page
user selects first order line with quantity 3 and try move 0 and 4 items to a new shipment
- user gets an error and no delivery groups are created.
+ user gets an error and no shipment groups are created.
"""
lines = order_with_lines_and_stock.get_lines()
line = lines.first()