Merge remote-tracking branch 'remotes/flaviabastos/187_unify_canceled_spelling'

This commit is contained in:
Raphael Michel
2016-09-21 18:57:35 +02:00
26 changed files with 80 additions and 80 deletions

View File

@@ -29,7 +29,7 @@ class Invoice(models.Model):
:type invoice_no: int
:param is_cancellation: Whether or not this is a cancellation instead of an invoice
:type is_cancellation: bool
:param refers: A link to another invoice this invoice refers to, e.g. the cancelled invoice in a cancellation
:param refers: A link to another invoice this invoice refers to, e.g. the canceled invoice in a cancellation
:type refers: Invoice
:param invoice_from: The sender address
:type invoice_from: str

View File

@@ -107,7 +107,7 @@ class Item(LoggedModel):
:type require_voucher: bool
:param hide_without_voucher: If set to ``True``, this item is only visible and available when a voucher is used.
:type hide_without_voucher: bool
:param allow_cancel: If set to ``False``, an order with this product can not be cancelled by the user.
:param allow_cancel: If set to ``False``, an order with this product can not be canceled by the user.
:type allow_cancel: bool
"""
@@ -192,10 +192,10 @@ class Item(LoggedModel):
'code that is specifically tied to this product (and not via a quota).')
)
allow_cancel = models.BooleanField(
verbose_name=_('Allow product to be cancelled'),
verbose_name=_('Allow product to be canceled'),
default=True,
help_text=_('If you deactivate this, an order including this product might not be cancelled by the user. '
'It may still be cancelled by you.')
help_text=_('If you deactivate this, an order including this product might not be canceled by the user. '
'It may still be canceled by you.')
)
class Meta:

View File

@@ -30,7 +30,7 @@ class Order(LoggedModel):
An order is created when a user clicks 'buy' on his cart. It holds
several OrderPositions and is connected to a user. It has an
expiration date: If items run out of capacity, orders which are over
their expiration date might be cancelled.
their expiration date might be canceled.
An order -- like all objects -- has an ID, which is globally unique,
but also a code, which is shorter and easier to memorize, but only
@@ -45,7 +45,7 @@ class Order(LoggedModel):
* ``STATUS_PENDING``
* ``STATUS_PAID``
* ``STATUS_EXPIRED``
* ``STATUS_CANCELLED``
* ``STATUS_CANCELED``
* ``STATUS_REFUNDED``
:param event: The event this order belongs to
@@ -81,13 +81,13 @@ class Order(LoggedModel):
STATUS_PENDING = "n"
STATUS_PAID = "p"
STATUS_EXPIRED = "e"
STATUS_CANCELLED = "c"
STATUS_CANCELED = "c"
STATUS_REFUNDED = "r"
STATUS_CHOICE = (
(STATUS_PENDING, _("pending")),
(STATUS_PAID, _("paid")),
(STATUS_EXPIRED, _("expired")),
(STATUS_CANCELLED, _("cancelled")),
(STATUS_CANCELED, _("canceled")),
(STATUS_REFUNDED, _("refunded"))
)

View File

@@ -152,10 +152,10 @@ def _cancel_order(order, user=None):
with order.event.lock():
if order.status != Order.STATUS_PENDING:
raise OrderError(_('You cannot cancel this order.'))
order.status = Order.STATUS_CANCELLED
order.status = Order.STATUS_CANCELED
order.save()
order.log_action('pretix.event.order.cancelled', user=user)
order.log_action('pretix.event.order.canceled', user=user)
i = order.invoices.filter(is_cancellation=False).last()
if i:
generate_cancellation(i)

View File

@@ -41,10 +41,10 @@ def order_overview(event: Event) -> Tuple[List[Tuple[ItemCategory, List[Item]]],
.values('item', 'variation')
.annotate(cnt=Count('id'), price=Sum('price')).order_by())
}
num_cancelled = {
num_canceled = {
(p['item'], p['variation']): (p['cnt'], p['price'])
for p in (OrderPosition.objects
.filter(order__event=event, order__status=Order.STATUS_CANCELLED)
.filter(order__event=event, order__status=Order.STATUS_CANCELED)
.values('item', 'variation')
.annotate(cnt=Count('id'), price=Sum('price')).order_by())
}
@@ -79,18 +79,18 @@ def order_overview(event: Event) -> Tuple[List[Tuple[ItemCategory, List[Item]]],
variid = var.id
var.num_total = num_total.get((item.id, variid), (0, 0))
var.num_pending = num_pending.get((item.id, variid), (0, 0))
var.num_cancelled = num_cancelled.get((item.id, variid), (0, 0))
var.num_canceled = num_canceled.get((item.id, variid), (0, 0))
var.num_refunded = num_refunded.get((item.id, variid), (0, 0))
var.num_paid = num_paid.get((item.id, variid), (0, 0))
item.num_total = tuplesum(var.num_total for var in item.all_variations)
item.num_pending = tuplesum(var.num_pending for var in item.all_variations)
item.num_cancelled = tuplesum(var.num_cancelled for var in item.all_variations)
item.num_canceled = tuplesum(var.num_canceled for var in item.all_variations)
item.num_refunded = tuplesum(var.num_refunded for var in item.all_variations)
item.num_paid = tuplesum(var.num_paid for var in item.all_variations)
else:
item.num_total = num_total.get((item.id, None), (0, 0))
item.num_pending = num_pending.get((item.id, None), (0, 0))
item.num_cancelled = num_cancelled.get((item.id, None), (0, 0))
item.num_canceled = num_canceled.get((item.id, None), (0, 0))
item.num_refunded = num_refunded.get((item.id, None), (0, 0))
item.num_paid = num_paid.get((item.id, None), (0, 0))
@@ -112,7 +112,7 @@ def order_overview(event: Event) -> Tuple[List[Tuple[ItemCategory, List[Item]]],
c[0].num_total = tuplesum(item.num_total for item in c[1])
print(c[1], c[0].num_total, [item.num_total for item in c[1]])
c[0].num_pending = tuplesum(item.num_pending for item in c[1])
c[0].num_cancelled = tuplesum(item.num_cancelled for item in c[1])
c[0].num_canceled = tuplesum(item.num_canceled for item in c[1])
c[0].num_refunded = tuplesum(item.num_refunded for item in c[1])
c[0].num_paid = tuplesum(item.num_paid for item in c[1])
@@ -127,10 +127,10 @@ def order_overview(event: Event) -> Tuple[List[Tuple[ItemCategory, List[Item]]],
.values('payment_provider')
.annotate(cnt=Count('id'), payment_fee=Sum('payment_fee')).order_by())
}
num_cancelled = {
num_canceled = {
o['payment_provider']: (o['cnt'], o['payment_fee'])
for o in (Order.objects
.filter(event=event, status=Order.STATUS_CANCELLED)
.filter(event=event, status=Order.STATUS_CANCELED)
.values('payment_provider')
.annotate(cnt=Count('id'), payment_fee=Sum('payment_fee')).order_by())
}
@@ -168,14 +168,14 @@ def order_overview(event: Event) -> Tuple[List[Tuple[ItemCategory, List[Item]]],
ppobj.provider = provider
ppobj.has_variations = False
ppobj.num_total = total
ppobj.num_cancelled = num_cancelled.get(pprov, (0, 0))
ppobj.num_canceled = num_canceled.get(pprov, (0, 0))
ppobj.num_refunded = num_refunded.get(pprov, (0, 0))
ppobj.num_pending = num_pending.get(pprov, (0, 0))
ppobj.num_paid = num_paid.get(pprov, (0, 0))
payment_items.append(ppobj)
payment_cat_obj.num_total = (Dontsum(''), sum(i.num_total[1] for i in payment_items))
payment_cat_obj.num_cancelled = (Dontsum(''), sum(i.num_cancelled[1] for i in payment_items))
payment_cat_obj.num_canceled = (Dontsum(''), sum(i.num_canceled[1] for i in payment_items))
payment_cat_obj.num_refunded = (Dontsum(''), sum(i.num_refunded[1] for i in payment_items))
payment_cat_obj.num_pending = (Dontsum(''), sum(i.num_pending[1] for i in payment_items))
payment_cat_obj.num_paid = (Dontsum(''), sum(i.num_paid[1] for i in payment_items))
@@ -186,7 +186,7 @@ def order_overview(event: Event) -> Tuple[List[Tuple[ItemCategory, List[Item]]],
total = {
'num_total': tuplesum(c.num_total for c, i in items_by_category),
'num_pending': tuplesum(c.num_pending for c, i in items_by_category),
'num_cancelled': tuplesum(c.num_cancelled for c, i in items_by_category),
'num_canceled': tuplesum(c.num_canceled for c, i in items_by_category),
'num_refunded': tuplesum(c.num_refunded for c, i in items_by_category),
'num_paid': tuplesum(c.num_paid for c, i in items_by_category)
}