# Path: catalog/orders/models.py
# class Order(BaseOrder):
#     language_code = models.CharField(
#         _('Language code'), max_length=10, blank=True, null=True)
# 
#     shipping_name = models.CharField(
#         _('Name'), max_length=255, blank=True, null=True)
#     shipping_email = models.EmailField(
#         _('Email'), max_length=255, blank=True, null=True)
#     shipping_phone_number = models.CharField(
#         _('Phone number'), max_length=16, blank=True, null=True)
# 
#     billing_name = models.CharField(
#         _('Name'), max_length=255, blank=True, null=True)
#     billing_email = models.EmailField(
#         _('Email'), max_length=255, blank=True, null=True)
#     billing_phone_number = models.CharField(
#         _('Phone number'), max_length=16, blank=True, null=True)
# 
#     currency_code = models.CharField(
#         _('Code'), max_length=3, blank=True, null=True)
#     currency_name = models.CharField(
#         _('Name'), max_length=35, blank=True, null=True)
#     currency_symbol = models.CharField(
#         _('Symbol'), max_length=4, blank=True, null=True)
#     currency_factor = models.DecimalField(
#         _('Factor'), max_digits=30, decimal_places=10, default=Decimal(1))
# 
#     objects = OrderManager()
# 
#     class Meta:
#         abstract = False
#         db_table = 'catalog_orders_orders'
#         verbose_name = _('Order')
#         verbose_name_plural = _('Orders')
# 
#     def set_billing_address(self, billing_address):
#         self.billing_name = getattr(billing_address, 'name', None)
#         self.billing_email = getattr(billing_address, 'email', None)
#         self.billing_phone_number = getattr(
#             billing_address, 'phone_number', None)
#         super(Order, self).set_billing_address(billing_address)
# 
#     def set_shipping_address(self, shipping_address):
#         self.shipping_name = getattr(shipping_address, 'name', None)
#         self.shipping_email = getattr(shipping_address, 'email', None)
#         self.shipping_phone_number = getattr(
#             shipping_address, 'phone_number', None)
#         super(Order, self).set_shipping_address(shipping_address)
# 
#     def get_name(self):
#         return self.billing_name or self.shipping_name or ''
# 
#     def get_items(self):
#         items = self.items.all()
#         for item in items:
#             item.currency_unit_price = self.calculate_currency(item.unit_price)
#             item.currency_line_total = self.calculate_currency(item.line_total)
#             item.currency_line_subtotal = \
#                 self.calculate_currency(item.line_subtotal)
# 
#             fields = []
#             for field in item.extraorderitempricefield_set.all():
#                 field.currency_value = self.calculate_currency(field.value)
#                 fields.append(field)
#             item.extra_price_fields = fields
#         return items
# 
#     @property
#     def extra_price_fields(self):
#         fields = []
#         for field in self.extraorderpricefield_set.all():
#             field.currency_value = self.calculate_currency(field.value)
#             fields.append(field)
#         return fields
# 
#     def currency_order_subtotal(self):
#         return self.calculate_currency(self.order_subtotal)
#     currency_order_subtotal.short_description = _('Order subtotal')
# 
#     def currency_order_total(self):
#         return self.calculate_currency(self.order_total)
#     currency_order_total.short_description = _('Order Total')
# 
#     def calculate_currency(self, price):
#         return round_2(price * self.currency_factor)


from django.contrib import admin
from django.contrib.admin.options import ModelAdmin
from django.utils.translation import ugettext_lazy as _
from shop.admin.orderadmin import (
    OrderItemInline, OrderExtraInfoInline, ExtraOrderPriceFieldInline,
    OrderPaymentInline)
from shop.admin.mixins import LocalizeDecimalFieldsMixin
from shop.order_signals import completed, shipped, cancelled
from catalog.orders.models import Order
            'fields': (
                'user', 'status', 'order_total', 'order_subtotal',
                'created', 'modified'),
        }),
        (_('Currency'), {
            'fields': (
                'currency_name', 'currency_code', 'currency_symbol',
                'currency_factor', 'currency_order_total',
                'currency_order_subtotal')
        }),
        (_('Shipping'), {
            'fields': (
                'shipping_name', 'shipping_email', 'shipping_phone_number',
                'shipping_address_text'),
        }),
        (_('Billing'), {
            'fields': (
                'billing_name', 'billing_email', 'billing_phone_number',
                'billing_address_text'),
        }),
    )

    def __init__(self, *args, **kwargs):
        super(OrderAdmin, self).__init__(*args, **kwargs)

    def save_model(self, request, order, form, change):
        instance = Order.objects.get(pk=order.pk)
        super(OrderAdmin, self).save_model(request, order, form, change)

        if instance.status != order.status:

# Path: catalog/orders/models.py
# class Order(BaseOrder):
#     language_code = models.CharField(
#         _('Language code'), max_length=10, blank=True, null=True)
# 
#     shipping_name = models.CharField(
#         _('Name'), max_length=255, blank=True, null=True)
#     shipping_email = models.EmailField(
#         _('Email'), max_length=255, blank=True, null=True)
#     shipping_phone_number = models.CharField(
#         _('Phone number'), max_length=16, blank=True, null=True)
# 
#     billing_name = models.CharField(
#         _('Name'), max_length=255, blank=True, null=True)
#     billing_email = models.EmailField(
#         _('Email'), max_length=255, blank=True, null=True)
#     billing_phone_number = models.CharField(
#         _('Phone number'), max_length=16, blank=True, null=True)
# 
#     currency_code = models.CharField(
#         _('Code'), max_length=3, blank=True, null=True)
#     currency_name = models.CharField(
#         _('Name'), max_length=35, blank=True, null=True)
#     currency_symbol = models.CharField(
#         _('Symbol'), max_length=4, blank=True, null=True)
#     currency_factor = models.DecimalField(
#         _('Factor'), max_digits=30, decimal_places=10, default=Decimal(1))
# 
#     objects = OrderManager()
# 
#     class Meta:
#         abstract = False
#         db_table = 'catalog_orders_orders'
#         verbose_name = _('Order')
#         verbose_name_plural = _('Orders')
# 
#     def set_billing_address(self, billing_address):
#         self.billing_name = getattr(billing_address, 'name', None)
#         self.billing_email = getattr(billing_address, 'email', None)
#         self.billing_phone_number = getattr(
#             billing_address, 'phone_number', None)
#         super(Order, self).set_billing_address(billing_address)
# 
#     def set_shipping_address(self, shipping_address):
#         self.shipping_name = getattr(shipping_address, 'name', None)
#         self.shipping_email = getattr(shipping_address, 'email', None)
#         self.shipping_phone_number = getattr(
#             shipping_address, 'phone_number', None)
#         super(Order, self).set_shipping_address(shipping_address)
# 
#     def get_name(self):
#         return self.billing_name or self.shipping_name or ''
# 
#     def get_items(self):
#         items = self.items.all()
#         for item in items:
#             item.currency_unit_price = self.calculate_currency(item.unit_price)
#             item.currency_line_total = self.calculate_currency(item.line_total)
#             item.currency_line_subtotal = \
#                 self.calculate_currency(item.line_subtotal)
# 
#             fields = []
#             for field in item.extraorderitempricefield_set.all():
#                 field.currency_value = self.calculate_currency(field.value)
#                 fields.append(field)
#             item.extra_price_fields = fields
#         return items
# 
#     @property
#     def extra_price_fields(self):
#         fields = []
#         for field in self.extraorderpricefield_set.all():
#             field.currency_value = self.calculate_currency(field.value)
#             fields.append(field)
#         return fields
# 
#     def currency_order_subtotal(self):
#         return self.calculate_currency(self.order_subtotal)
#     currency_order_subtotal.short_description = _('Order subtotal')
# 
#     def currency_order_total(self):
#         return self.calculate_currency(self.order_total)
#     currency_order_total.short_description = _('Order Total')
# 
#     def calculate_currency(self, price):
#         return round_2(price * self.currency_factor)


# Path: catalog/orders/admin.py
from django.contrib import admin
from django.contrib.admin.options import ModelAdmin
from django.utils.translation import ugettext_lazy as _
from shop.admin.orderadmin import (
    OrderItemInline, OrderExtraInfoInline, ExtraOrderPriceFieldInline,
    OrderPaymentInline)
from shop.admin.mixins import LocalizeDecimalFieldsMixin
from shop.order_signals import completed, shipped, cancelled
from catalog.orders.models import Order

            'fields': (
                'user', 'status', 'order_total', 'order_subtotal',
                'created', 'modified'),
        }),
        (_('Currency'), {
            'fields': (
                'currency_name', 'currency_code', 'currency_symbol',
                'currency_factor', 'currency_order_total',
                'currency_order_subtotal')
        }),
        (_('Shipping'), {
            'fields': (
                'shipping_name', 'shipping_email', 'shipping_phone_number',
                'shipping_address_text'),
        }),
        (_('Billing'), {
            'fields': (
                'billing_name', 'billing_email', 'billing_phone_number',
                'billing_address_text'),
        }),
    )

    def __init__(self, *args, **kwargs):
        super(OrderAdmin, self).__init__(*args, **kwargs)

    def save_model(self, request, order, form, change):
        instance = Order.objects.get(pk=order.pk)
        super(OrderAdmin, self).save_model(request, order, form, change)

        if instance.status != order.status:

            if order.status == Order.COMPLETED: