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_stateupdate_order_from_statecreate_source_from_stateencode_addressencode_shopencode_methodencode_lineget_line_data_for_editget_price_infoOrderEditViewOrderEditView.modelOrderEditView.template_nameOrderEditView.context_object_nameOrderEditView.titleOrderEditView.fieldsOrderEditView.get_context_dataOrderEditView.get_toolbarOrderEditView.get_configOrderEditView.get_initial_order_dataOrderEditView.get_customer_dataOrderEditView.dispatchOrderEditView.dispatch_commandOrderEditView.handle_customer_detailsOrderEditView.handle_customer_dataOrderEditView.handle_product_dataOrderEditView.get_request_bodyOrderEditView.handle_source_dataOrderEditView.handle_finalize
UpdateAdminCommentView
- shuup.admin.modules.orders.views.list module
OrderListViewOrderListView.modelOrderListView.default_columnsOrderListView.related_objectsOrderListView.mass_actionsOrderListView.toolbar_buttons_provider_keyOrderListView.mass_actions_provider_keyOrderListView.get_toolbarOrderListView.get_querysetOrderListView.format_customer_nameOrderListView.format_order_dateOrderListView.format_taxful_total_priceOrderListView.format_taxless_total_priceOrderListView.labelOrderListView.get_object_abstract
- shuup.admin.modules.orders.views.log module
- shuup.admin.modules.orders.views.payment module
OrderCreatePaymentViewOrderCreatePaymentView.modelOrderCreatePaymentView.template_nameOrderCreatePaymentView.context_object_nameOrderCreatePaymentView.form_classOrderCreatePaymentView.get_querysetOrderCreatePaymentView.get_context_dataOrderCreatePaymentView.get_form_kwargsOrderCreatePaymentView.get_formOrderCreatePaymentView.form_invalidOrderCreatePaymentView.form_valid
OrderSetPaidViewOrderDeletePaymentView
- shuup.admin.modules.orders.views.refund module
RefundFormOrderCreateRefundViewOrderCreateRefundView.modelOrderCreateRefundView.template_nameOrderCreateRefundView.context_object_nameOrderCreateRefundView.form_classOrderCreateRefundView.get_querysetOrderCreateRefundView.get_context_dataOrderCreateRefundView.get_form_kwargsOrderCreateRefundView.get_formOrderCreateRefundView.form_valid
FullRefundConfirmationFormOrderCreateFullRefundViewOrderCreateFullRefundView.modelOrderCreateFullRefundView.template_nameOrderCreateFullRefundView.context_object_nameOrderCreateFullRefundView.form_classOrderCreateFullRefundView.get_querysetOrderCreateFullRefundView.get_context_dataOrderCreateFullRefundView.get_form_kwargsOrderCreateFullRefundView.form_valid
- shuup.admin.modules.orders.views.shipment module
ShipmentFormOrderCreateShipmentViewOrderCreateShipmentView.modelOrderCreateShipmentView.template_nameOrderCreateShipmentView.context_object_nameOrderCreateShipmentView.form_classOrderCreateShipmentView.get_querysetOrderCreateShipmentView.get_context_dataOrderCreateShipmentView.get_form_kwargsOrderCreateShipmentView.get_formOrderCreateShipmentView.form_invalidOrderCreateShipmentView.create_shipmentOrderCreateShipmentView.get_success_urlOrderCreateShipmentView.form_valid
ShipmentDeleteViewShipmentSetSentViewShipmentListViewShipmentListView.modelShipmentListView.template_nameShipmentListView.default_columnsShipmentListView.tracking_code_urlShipmentListView.get_supplierShipmentListView.get_orderShipmentListView.get_contentShipmentListView.create_action_buttonsShipmentListView.__init__ShipmentListView.get_querysetShipmentListView.get_object_abstract
- shuup.admin.modules.orders.views.status module
- Module contents
NewLogEntryViewOrderAddressEditViewOrderDetailViewOrderEditViewOrderEditView.context_object_nameOrderEditView.dispatchOrderEditView.dispatch_commandOrderEditView.fieldsOrderEditView.get_configOrderEditView.get_context_dataOrderEditView.get_customer_dataOrderEditView.get_initial_order_dataOrderEditView.get_request_bodyOrderEditView.get_toolbarOrderEditView.handle_customer_dataOrderEditView.handle_customer_detailsOrderEditView.handle_finalizeOrderEditView.handle_product_dataOrderEditView.handle_source_dataOrderEditView.modelOrderEditView.template_nameOrderEditView.title
OrderListViewOrderListView.default_columnsOrderListView.format_customer_nameOrderListView.format_order_dateOrderListView.format_taxful_total_priceOrderListView.format_taxless_total_priceOrderListView.get_object_abstractOrderListView.get_querysetOrderListView.get_toolbarOrderListView.labelOrderListView.mass_actionsOrderListView.mass_actions_provider_keyOrderListView.modelOrderListView.related_objectsOrderListView.toolbar_buttons_provider_key
OrderCreatePaymentViewOrderCreatePaymentView.context_object_nameOrderCreatePaymentView.form_classOrderCreatePaymentView.form_invalidOrderCreatePaymentView.form_validOrderCreatePaymentView.get_context_dataOrderCreatePaymentView.get_formOrderCreatePaymentView.get_form_kwargsOrderCreatePaymentView.get_querysetOrderCreatePaymentView.modelOrderCreatePaymentView.template_name
OrderCreateFullRefundViewOrderCreateFullRefundView.context_object_nameOrderCreateFullRefundView.form_classOrderCreateFullRefundView.form_validOrderCreateFullRefundView.get_context_dataOrderCreateFullRefundView.get_form_kwargsOrderCreateFullRefundView.get_querysetOrderCreateFullRefundView.modelOrderCreateFullRefundView.template_name
OrderCreateRefundViewOrderCreateRefundView.context_object_nameOrderCreateRefundView.form_classOrderCreateRefundView.form_validOrderCreateRefundView.get_context_dataOrderCreateRefundView.get_formOrderCreateRefundView.get_form_kwargsOrderCreateRefundView.get_querysetOrderCreateRefundView.modelOrderCreateRefundView.template_name
OrderCreateShipmentViewOrderCreateShipmentView.context_object_nameOrderCreateShipmentView.create_shipmentOrderCreateShipmentView.form_classOrderCreateShipmentView.form_invalidOrderCreateShipmentView.form_validOrderCreateShipmentView.get_context_dataOrderCreateShipmentView.get_formOrderCreateShipmentView.get_form_kwargsOrderCreateShipmentView.get_querysetOrderCreateShipmentView.get_success_urlOrderCreateShipmentView.modelOrderCreateShipmentView.template_name
OrderSetPaidViewOrderSetStatusViewOrderStatusEditViewOrderStatusListViewShipmentDeleteViewUpdateAdminCommentViewOrderDeletePaymentViewShipmentSetSentViewShipmentListViewShipmentListView.__init__ShipmentListView.create_action_buttonsShipmentListView.default_columnsShipmentListView.get_contentShipmentListView.get_object_abstractShipmentListView.get_orderShipmentListView.get_querysetShipmentListView.get_supplierShipmentListView.modelShipmentListView.template_nameShipmentListView.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:
OrderCreatorInitialize 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 –
WSGIRequestids – 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 –
WSGIRequestids – 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