shuup.admin.modules.orders package
Subpackages
- shuup.admin.modules.orders.views package
- Submodules
- shuup.admin.modules.orders.views.addresses module
- shuup.admin.modules.orders.views.detail module
- shuup.admin.modules.orders.views.edit module
create_order_from_state
update_order_from_state
create_source_from_state
encode_address
encode_shop
encode_method
encode_line
get_line_data_for_edit
get_price_info
OrderEditView
OrderEditView.model
OrderEditView.template_name
OrderEditView.context_object_name
OrderEditView.title
OrderEditView.fields
OrderEditView.get_context_data
OrderEditView.get_toolbar
OrderEditView.get_config
OrderEditView.get_initial_order_data
OrderEditView.get_customer_data
OrderEditView.dispatch
OrderEditView.dispatch_command
OrderEditView.handle_customer_details
OrderEditView.handle_customer_data
OrderEditView.handle_product_data
OrderEditView.get_request_body
OrderEditView.handle_source_data
OrderEditView.handle_finalize
UpdateAdminCommentView
- shuup.admin.modules.orders.views.list module
OrderListView
OrderListView.model
OrderListView.default_columns
OrderListView.related_objects
OrderListView.mass_actions
OrderListView.toolbar_buttons_provider_key
OrderListView.mass_actions_provider_key
OrderListView.get_toolbar
OrderListView.get_queryset
OrderListView.format_customer_name
OrderListView.format_order_date
OrderListView.format_taxful_total_price
OrderListView.format_taxless_total_price
OrderListView.label
OrderListView.get_object_abstract
- shuup.admin.modules.orders.views.log module
- shuup.admin.modules.orders.views.payment module
OrderCreatePaymentView
OrderCreatePaymentView.model
OrderCreatePaymentView.template_name
OrderCreatePaymentView.context_object_name
OrderCreatePaymentView.form_class
OrderCreatePaymentView.get_queryset
OrderCreatePaymentView.get_context_data
OrderCreatePaymentView.get_form_kwargs
OrderCreatePaymentView.get_form
OrderCreatePaymentView.form_invalid
OrderCreatePaymentView.form_valid
OrderSetPaidView
OrderDeletePaymentView
- shuup.admin.modules.orders.views.refund module
RefundForm
OrderCreateRefundView
OrderCreateRefundView.model
OrderCreateRefundView.template_name
OrderCreateRefundView.context_object_name
OrderCreateRefundView.form_class
OrderCreateRefundView.get_queryset
OrderCreateRefundView.get_context_data
OrderCreateRefundView.get_form_kwargs
OrderCreateRefundView.get_form
OrderCreateRefundView.form_valid
FullRefundConfirmationForm
OrderCreateFullRefundView
OrderCreateFullRefundView.model
OrderCreateFullRefundView.template_name
OrderCreateFullRefundView.context_object_name
OrderCreateFullRefundView.form_class
OrderCreateFullRefundView.get_queryset
OrderCreateFullRefundView.get_context_data
OrderCreateFullRefundView.get_form_kwargs
OrderCreateFullRefundView.form_valid
- shuup.admin.modules.orders.views.shipment module
ShipmentForm
OrderCreateShipmentView
OrderCreateShipmentView.model
OrderCreateShipmentView.template_name
OrderCreateShipmentView.context_object_name
OrderCreateShipmentView.form_class
OrderCreateShipmentView.get_queryset
OrderCreateShipmentView.get_context_data
OrderCreateShipmentView.get_form_kwargs
OrderCreateShipmentView.get_form
OrderCreateShipmentView.form_invalid
OrderCreateShipmentView.create_shipment
OrderCreateShipmentView.get_success_url
OrderCreateShipmentView.form_valid
ShipmentDeleteView
ShipmentSetSentView
ShipmentListView
ShipmentListView.model
ShipmentListView.template_name
ShipmentListView.default_columns
ShipmentListView.tracking_code_url
ShipmentListView.get_supplier
ShipmentListView.get_order
ShipmentListView.get_content
ShipmentListView.create_action_buttons
ShipmentListView.__init__
ShipmentListView.get_queryset
ShipmentListView.get_object_abstract
- shuup.admin.modules.orders.views.status module
- Module contents
NewLogEntryView
OrderAddressEditView
OrderDetailView
OrderEditView
OrderEditView.context_object_name
OrderEditView.dispatch
OrderEditView.dispatch_command
OrderEditView.fields
OrderEditView.get_config
OrderEditView.get_context_data
OrderEditView.get_customer_data
OrderEditView.get_initial_order_data
OrderEditView.get_request_body
OrderEditView.get_toolbar
OrderEditView.handle_customer_data
OrderEditView.handle_customer_details
OrderEditView.handle_finalize
OrderEditView.handle_product_data
OrderEditView.handle_source_data
OrderEditView.model
OrderEditView.template_name
OrderEditView.title
OrderListView
OrderListView.default_columns
OrderListView.format_customer_name
OrderListView.format_order_date
OrderListView.format_taxful_total_price
OrderListView.format_taxless_total_price
OrderListView.get_object_abstract
OrderListView.get_queryset
OrderListView.get_toolbar
OrderListView.label
OrderListView.mass_actions
OrderListView.mass_actions_provider_key
OrderListView.model
OrderListView.related_objects
OrderListView.toolbar_buttons_provider_key
OrderCreatePaymentView
OrderCreatePaymentView.context_object_name
OrderCreatePaymentView.form_class
OrderCreatePaymentView.form_invalid
OrderCreatePaymentView.form_valid
OrderCreatePaymentView.get_context_data
OrderCreatePaymentView.get_form
OrderCreatePaymentView.get_form_kwargs
OrderCreatePaymentView.get_queryset
OrderCreatePaymentView.model
OrderCreatePaymentView.template_name
OrderCreateFullRefundView
OrderCreateFullRefundView.context_object_name
OrderCreateFullRefundView.form_class
OrderCreateFullRefundView.form_valid
OrderCreateFullRefundView.get_context_data
OrderCreateFullRefundView.get_form_kwargs
OrderCreateFullRefundView.get_queryset
OrderCreateFullRefundView.model
OrderCreateFullRefundView.template_name
OrderCreateRefundView
OrderCreateRefundView.context_object_name
OrderCreateRefundView.form_class
OrderCreateRefundView.form_valid
OrderCreateRefundView.get_context_data
OrderCreateRefundView.get_form
OrderCreateRefundView.get_form_kwargs
OrderCreateRefundView.get_queryset
OrderCreateRefundView.model
OrderCreateRefundView.template_name
OrderCreateShipmentView
OrderCreateShipmentView.context_object_name
OrderCreateShipmentView.create_shipment
OrderCreateShipmentView.form_class
OrderCreateShipmentView.form_invalid
OrderCreateShipmentView.form_valid
OrderCreateShipmentView.get_context_data
OrderCreateShipmentView.get_form
OrderCreateShipmentView.get_form_kwargs
OrderCreateShipmentView.get_queryset
OrderCreateShipmentView.get_success_url
OrderCreateShipmentView.model
OrderCreateShipmentView.template_name
OrderSetPaidView
OrderSetStatusView
OrderStatusEditView
OrderStatusListView
ShipmentDeleteView
UpdateAdminCommentView
OrderDeletePaymentView
ShipmentSetSentView
ShipmentListView
ShipmentListView.__init__
ShipmentListView.create_action_buttons
ShipmentListView.default_columns
ShipmentListView.get_content
ShipmentListView.get_object_abstract
ShipmentListView.get_order
ShipmentListView.get_queryset
ShipmentListView.get_supplier
ShipmentListView.model
ShipmentListView.template_name
ShipmentListView.tracking_code_url
Submodules
shuup.admin.modules.orders.json_order_creator module
- class shuup.admin.modules.orders.json_order_creator.AdminOrderSource(shop)[source]
Bases:
OrderSource
- class shuup.admin.modules.orders.json_order_creator.AdminOrderCreator(request=None)[source]
Bases:
OrderCreator
Initialize order creator.
- Parameters:
request (django.http.HttpRequest|None) – Optional request object for backward compatibility. Passing non-None value is DEPRECATED.
- class shuup.admin.modules.orders.json_order_creator.AdminOrderModifier[source]
Bases:
OrderModifier
- class shuup.admin.modules.orders.json_order_creator.JsonOrderCreator[source]
Bases:
object
- static is_empty_address(address_data)[source]
An address will have at least a tax_number field. It will still be considered empty.
- property is_valid
- property errors
- create_source_from_state(state, creator=None, ip_address=None, save=False, order_to_update=None)[source]
Create an order source from a state dict unserialized from JSON.
- Parameters:
state (dict) – State dictionary.
creator (django.contrib.auth.models.User|None) – Creator user.
save (boolean) – Flag whether order customer and addresses is saved to database.
order_to_update (shuup.core.models.Order|None) – Order object to edit.
- Returns:
The created order source, or None if something failed along the way.
- Return type:
OrderSource|None
- create_order_from_state(state, creator=None, ip_address=None)[source]
Create an order from a state dict unserialized from JSON.
- Parameters:
state (dict) – State dictionary.
creator (django.contrib.auth.models.User|None) – Creator user.
ip_address (str) – Remote IP address (IPv4 or IPv6).
- Returns:
The created order, or None if something failed along the way.
- Return type:
Order|None
- update_order_from_state(state, order_to_update, modified_by=None)[source]
Update an order from a state dict unserialized from JSON.
- Parameters:
state (dict) – State dictionary.
order_to_update (shuup.core.models.Order) – Order object to edit.
- Returns:
The created order, or None if something failed along the way.
- Return type:
Order|None
- get_removed_product_ids(state, order_to_update)[source]
Collect product ids for products which were removed from the order.
- Parameters:
state (dict) – State dictionary.
order_to_update (shuup.core.models.Order) – Order object to edit.
- Returns:
set
- update_stock_for_removed_products(removed_ids, shop)[source]
Update stocks for products which were completely removed from the updated order.
- Parameters:
removed_ids (set) – Set of removed product ids.
shop (shuup.core.models.Shop) – Shop instance where this order is made.
shuup.admin.modules.orders.mass_actions module
- class shuup.admin.modules.orders.mass_actions.CancelOrderAction[source]
Bases:
PicotableMassAction
- label = 'Cancel'
- identifier = 'mass_action_order_cancel'
- class shuup.admin.modules.orders.mass_actions.OrderConfirmationPdfAction[source]
Bases:
PicotableFileMassAction
- label = 'Print Confirmation PDF(s)'
- identifier = 'mass_action_order_confirmation_pdf'
- process(request, ids)[source]
Process and return
HttpResponse
.Example
response = HttpResponse(content_type=”text/csv”) response[‘Content-Disposition’] = ‘attachment; filename=”mass_action.csv”’ writer = csv.writer(response) writer.writerow([‘First row’, ‘Foo’, ‘Bar’, ‘Baz’]) return response
- Parameters:
request –
WSGIRequest
ids – list of ids.
- Returns:
HttpResponse
- class shuup.admin.modules.orders.mass_actions.OrderDeliveryPdfAction[source]
Bases:
PicotableFileMassAction
- label = 'Print Delivery PDF(s)'
- identifier = 'mass_action_order_delivery_pdf'
- process(request, ids)[source]
Process and return
HttpResponse
.Example
response = HttpResponse(content_type=”text/csv”) response[‘Content-Disposition’] = ‘attachment; filename=”mass_action.csv”’ writer = csv.writer(response) writer.writerow([‘First row’, ‘Foo’, ‘Bar’, ‘Baz’]) return response
- Parameters:
request –
WSGIRequest
ids – list of ids.
- Returns:
HttpResponse
shuup.admin.modules.orders.receivers module
shuup.admin.modules.orders.sections module
- class shuup.admin.modules.orders.sections.BasicDetailsOrderSection[source]
Bases:
Section
- classmethod visible_for_object(order, request=None)[source]
Returns whether this sections must be visible for the provided object (e.g.
order
).:return whether this section must be shown in order section list, defaults to false :rtype: bool
- classmethod get_context_data(order, request=None)[source]
Returns additional information to be used in the template.
To fetch this data in the template, you must first add it to your request’s context
- e.g. `context[admin_order_section.identifier] =
-
admin_order_section.get_context_data(self.object)`
:return additional context data :rtype: object|None
- class shuup.admin.modules.orders.sections.PaymentOrderSection[source]
Bases:
Section
- classmethod visible_for_object(order, request=None)[source]
Returns whether this sections must be visible for the provided object (e.g.
order
).:return whether this section must be shown in order section list, defaults to false :rtype: bool
- classmethod get_context_data(order, request=None)[source]
Returns additional information to be used in the template.
To fetch this data in the template, you must first add it to your request’s context
- e.g. `context[admin_order_section.identifier] =
-
admin_order_section.get_context_data(self.object)`
:return additional context data :rtype: object|None
- class shuup.admin.modules.orders.sections.ShipmentSection[source]
Bases:
Section
- static visible_for_object(order, request=None)[source]
Returns whether this sections must be visible for the provided object (e.g.
order
).:return whether this section must be shown in order section list, defaults to false :rtype: bool
- static get_context_data(order, request=None)[source]
Returns additional information to be used in the template.
To fetch this data in the template, you must first add it to your request’s context
- e.g. `context[admin_order_section.identifier] =
-
admin_order_section.get_context_data(self.object)`
:return additional context data :rtype: object|None
- class shuup.admin.modules.orders.sections.LogEntriesOrderSection[source]
Bases:
Section
- classmethod visible_for_object(order, request=None)[source]
Returns whether this sections must be visible for the provided object (e.g.
order
).:return whether this section must be shown in order section list, defaults to false :rtype: bool
- classmethod get_context_data(order, request=None)[source]
Returns additional information to be used in the template.
To fetch this data in the template, you must first add it to your request’s context
- e.g. `context[admin_order_section.identifier] =
-
admin_order_section.get_context_data(self.object)`
:return additional context data :rtype: object|None
- class shuup.admin.modules.orders.sections.AdminCommentSection[source]
Bases:
Section
- classmethod visible_for_object(order, request=None)[source]
Returns whether this sections must be visible for the provided object (e.g.
order
).:return whether this section must be shown in order section list, defaults to false :rtype: bool
- classmethod get_context_data(order, request=None)[source]
Returns additional information to be used in the template.
To fetch this data in the template, you must first add it to your request’s context
- e.g. `context[admin_order_section.identifier] =
-
admin_order_section.get_context_data(self.object)`
:return additional context data :rtype: object|None
- class shuup.admin.modules.orders.sections.OrderHistorySection[source]
Bases:
Section
- classmethod visible_for_object(order, request=None)[source]
Returns whether this sections must be visible for the provided object (e.g.
order
).:return whether this section must be shown in order section list, defaults to false :rtype: bool
- classmethod get_context_data(order, request=None)[source]
Returns additional information to be used in the template.
To fetch this data in the template, you must first add it to your request’s context
- e.g. `context[admin_order_section.identifier] =
-
admin_order_section.get_context_data(self.object)`
:return additional context data :rtype: object|None
shuup.admin.modules.orders.toolbar module
- class shuup.admin.modules.orders.toolbar.CreatePaymentAction(object, **kwargs)[source]
Bases:
DropdownItem
- Parameters:
text – The actual text for the button.
icon – Icon CSS class string
disable_reason (str|None) – The reason for this button to be disabled. It’s considered good UX to have an user-visible reason for disabled actions; thus the only way to disable an action is to set the reason. See http://stackoverflow.com/a/372503/51685.
tooltip (str|None) – Tooltip string, if any. May be replaced by the disable reason.
extra_css_class (str) – Extra CSS class(es)
required_permissions (Iterable[str]) – Optional iterable of permission strings
- __init__(object, **kwargs)[source]
- Parameters:
text – The actual text for the button.
icon – Icon CSS class string
disable_reason (str|None) – The reason for this button to be disabled. It’s considered good UX to have an user-visible reason for disabled actions; thus the only way to disable an action is to set the reason. See http://stackoverflow.com/a/372503/51685.
tooltip (str|None) – Tooltip string, if any. May be replaced by the disable reason.
extra_css_class (str) – Extra CSS class(es)
required_permissions (Iterable[str]) – Optional iterable of permission strings
- class shuup.admin.modules.orders.toolbar.SetPaidAction(object, **kwargs)[source]
Bases:
PostActionDropdownItem
- Parameters:
text – The actual text for the button.
icon – Icon CSS class string
disable_reason (str|None) – The reason for this button to be disabled. It’s considered good UX to have an user-visible reason for disabled actions; thus the only way to disable an action is to set the reason. See http://stackoverflow.com/a/372503/51685.
tooltip (str|None) – Tooltip string, if any. May be replaced by the disable reason.
extra_css_class (str) – Extra CSS class(es)
required_permissions (Iterable[str]) – Optional iterable of permission strings
- __init__(object, **kwargs)[source]
- Parameters:
text – The actual text for the button.
icon – Icon CSS class string
disable_reason (str|None) – The reason for this button to be disabled. It’s considered good UX to have an user-visible reason for disabled actions; thus the only way to disable an action is to set the reason. See http://stackoverflow.com/a/372503/51685.
tooltip (str|None) – Tooltip string, if any. May be replaced by the disable reason.
extra_css_class (str) – Extra CSS class(es)
required_permissions (Iterable[str]) – Optional iterable of permission strings
- class shuup.admin.modules.orders.toolbar.CreateRefundAction(object, **kwargs)[source]
Bases:
DropdownItem
- Parameters:
text – The actual text for the button.
icon – Icon CSS class string
disable_reason (str|None) – The reason for this button to be disabled. It’s considered good UX to have an user-visible reason for disabled actions; thus the only way to disable an action is to set the reason. See http://stackoverflow.com/a/372503/51685.
tooltip (str|None) – Tooltip string, if any. May be replaced by the disable reason.
extra_css_class (str) – Extra CSS class(es)
required_permissions (Iterable[str]) – Optional iterable of permission strings
- __init__(object, **kwargs)[source]
- Parameters:
text – The actual text for the button.
icon – Icon CSS class string
disable_reason (str|None) – The reason for this button to be disabled. It’s considered good UX to have an user-visible reason for disabled actions; thus the only way to disable an action is to set the reason. See http://stackoverflow.com/a/372503/51685.
tooltip (str|None) – Tooltip string, if any. May be replaced by the disable reason.
extra_css_class (str) – Extra CSS class(es)
required_permissions (Iterable[str]) – Optional iterable of permission strings
- class shuup.admin.modules.orders.toolbar.EditAddresses(object, **kwargs)[source]
Bases:
DropdownItem
- Parameters:
text – The actual text for the button.
icon – Icon CSS class string
disable_reason (str|None) – The reason for this button to be disabled. It’s considered good UX to have an user-visible reason for disabled actions; thus the only way to disable an action is to set the reason. See http://stackoverflow.com/a/372503/51685.
tooltip (str|None) – Tooltip string, if any. May be replaced by the disable reason.
extra_css_class (str) – Extra CSS class(es)
required_permissions (Iterable[str]) – Optional iterable of permission strings
- __init__(object, **kwargs)[source]
- Parameters:
text – The actual text for the button.
icon – Icon CSS class string
disable_reason (str|None) – The reason for this button to be disabled. It’s considered good UX to have an user-visible reason for disabled actions; thus the only way to disable an action is to set the reason. See http://stackoverflow.com/a/372503/51685.
tooltip (str|None) – Tooltip string, if any. May be replaced by the disable reason.
extra_css_class (str) – Extra CSS class(es)
required_permissions (Iterable[str]) – Optional iterable of permission strings
shuup.admin.modules.orders.utils module
Order utilities and helper classes.
Module contents
- class shuup.admin.modules.orders.OrderEntry(text, url, icon=None, category=None, ordering=99999, aliases=(), **kwargs)[source]
Bases:
MenuEntry
- name = 'Orders'
- class shuup.admin.modules.orders.OrderModule[source]
Bases:
AdminModule
- name = 'Orders'
- Return type:
- get_model_url(object, kind, shop=None)[source]
Retrieve an admin URL for the given object of the kind
kind
.A falsy value must be returned if the module does not know how to reverse the given object.
- Parameters:
object (django.db.models.Model) – A object instance (or object class).
kind (str) – URL kind. Currently “detail”, “list” or “new”.
shop (shuup.core.models.Shop|None) – The shop that owns the resource.
- Returns:
The reversed URL or none.
- Return type:
str|None
- class shuup.admin.modules.orders.OrderStatusModule[source]
Bases:
AdminModule
- name = 'Order Status'
- Return type:
- get_model_url(object, kind, shop=None)[source]
Retrieve an admin URL for the given object of the kind
kind
.A falsy value must be returned if the module does not know how to reverse the given object.
- Parameters:
object (django.db.models.Model) – A object instance (or object class).
kind (str) – URL kind. Currently “detail”, “list” or “new”.
shop (shuup.core.models.Shop|None) – The shop that owns the resource.
- Returns:
The reversed URL or none.
- Return type:
str|None