shoop.core.models package

Module contents

class shoop.core.models.AnonymousContact(id, polymorphic_ctype, created_on, identifier, is_active, default_shipping_address, default_billing_address, default_shipping_method, default_payment_method, language, marketing_permission, phone, www, timezone, prefix, name, suffix, name_ext, email, tax_group, merchant_notes, account_manager, contact_ptr)

Bases: shoop.core.models.Contact

exception DoesNotExist

Bases: shoop.core.models._contacts.DoesNotExist

exception AnonymousContact.MultipleObjectsReturned

Bases: shoop.core.models._contacts.MultipleObjectsReturned

AnonymousContact.base_objects = <django.db.models.manager.Manager object>
AnonymousContact.contact_ptr
AnonymousContact.default_contact_group_identifier = 'default_anonymous_group'
AnonymousContact.default_contact_group_name = <django.utils.functional.lazy.<locals>.__proxy__ object>
AnonymousContact.delete(*args, **kwargs)[source]
AnonymousContact.groups

Contact groups accessor for anonymous contact.

The base class already has a groups property via ContactGroup related_name, but this overrides it for AnonymousContact so that it will return a queryset containing just the anonymous contact group rather than returning the original related manager, which cannot work since AnonymousContact is not in the database.

This allows to use statements like this for all kinds of contacts, even AnonymousContact:

some_contact.groups.all()
Return type:django.db.QuerySet
AnonymousContact.id = None
AnonymousContact.is_anonymous = True
AnonymousContact.objects = <polymorphic.managers.PolymorphicManager object>
AnonymousContact.pk = None
AnonymousContact.polymorphic_primary_key_name = 'id'
AnonymousContact.polymorphic_super_sub_accessors_replaced = False
AnonymousContact.save(*args, **kwargs)[source]
class shoop.core.models.Attribute(id, identifier, searchable, type, visibility_mode)

Bases: parler.models.TranslatableModel

exception DoesNotExist

Bases: django.core.exceptions.ObjectDoesNotExist

exception Attribute.MultipleObjectsReturned

Bases: django.core.exceptions.MultipleObjectsReturned

Attribute.formfield(**kwargs)[source]

Get a form field for this attribute.

Parameters:kwargs – Kwargs to pass for the form field class.
Returns:Form field.
Return type:forms.Field
Attribute.get_type_display(*moreargs, **morekwargs)
Attribute.get_visibility_mode_display(*moreargs, **morekwargs)
Attribute.is_null_value(value)[source]

Find out whether the given value is null from this attribute’s point of view.

Parameters:value (object) – A value
Returns:Nulliness boolean
Return type:bool
Attribute.is_numeric
Attribute.is_stringy
Attribute.is_temporal
Attribute.is_translated
Attribute.name

Descriptor for translated attributes.

This attribute proxies all get/set calls to the translated model.

Attribute.objects = <django.db.models.manager.ManagerFromAttributeQuerySet object>
Attribute.product_types
Attribute.productattribute_set
Attribute.save(*args, **kwargs)[source]
Attribute.translations
Attribute.type

A placeholder class that provides a way to set the attribute on the model.

Attribute.visibility_mode

A placeholder class that provides a way to set the attribute on the model.

class shoop.core.models.AttributeType

Bases: enumfields.enums.Enum

An enumeration.

BOOLEAN = <AttributeType.BOOLEAN: 2>
DATE = <AttributeType.DATE: 11>
DATETIME = <AttributeType.DATETIME: 10>
DECIMAL = <AttributeType.DECIMAL: 3>
INTEGER = <AttributeType.INTEGER: 1>
TIMEDELTA = <AttributeType.TIMEDELTA: 4>
TRANSLATED_STRING = <AttributeType.TRANSLATED_STRING: 20>
UNTRANSLATED_STRING = <AttributeType.UNTRANSLATED_STRING: 21>
class shoop.core.models.AttributeVisibility

Bases: enumfields.enums.Enum

An enumeration.

HIDDEN = <AttributeVisibility.HIDDEN: 0>
NOT_VISIBLE = <AttributeVisibility.NOT_VISIBLE: 3>
SEARCHABLE_FIELD = <AttributeVisibility.SEARCHABLE_FIELD: 2>
SHOW_ON_PRODUCT_PAGE = <AttributeVisibility.SHOW_ON_PRODUCT_PAGE: 1>
class shoop.core.models.Carrier(*args, **kwargs)

Bases: shoop.core.models.ServiceProvider

Service provider interface for shipment processing.

Services provided by a carrier are shipping methods. To create a new shipping method for a carrier, use the create_service method.

Implementers of this interface will provide provide a list of shipping service choices and each related shipping method should have one of those service choices assigned to it.

Note: Carrier objects should never be created on their own but rather through a concrete subclass.

Replace Django’s inheritance accessor member functions for our model (self.__class__) with our own versions. We monkey patch them until a patch can be added to Django (which would probably be very small and make all of this obsolete).

If we have inheritance of the form ModelA -> ModelB ->ModelC then Django creates accessors like this: - ModelA: modelb - ModelB: modela_ptr, modelb, modelc - ModelC: modela_ptr, modelb, modelb_ptr, modelc

These accessors allow Django (and everyone else) to travel up and down the inheritance tree for the db object at hand.

The original Django accessors use our polymorphic manager. But they should not. So we replace them with our own accessors that use our appropriate base_objects manager.

exception DoesNotExist

Bases: shoop.core.models._service_base.DoesNotExist

exception Carrier.MultipleObjectsReturned

Bases: shoop.core.models._service_base.MultipleObjectsReturned

Carrier.base_objects = <parler.managers.TranslatableManager object>
Carrier.customcarrier
Carrier.delete(*args, **kwargs)[source]
Carrier.objects = <shoop.core.models._base._PolyTransManager object>
Carrier.polymorphic_primary_key_name = 'id'
Carrier.polymorphic_super_sub_accessors_replaced = False
Carrier.service_model

alias of ShippingMethod

Carrier.serviceprovider_ptr
Carrier.shippingmethod_set
class shoop.core.models.Category(id, parent, identifier, status, image, ordering, visibility)

Bases: mptt.models.MPTTModel, parler.models.TranslatableModel

exception DoesNotExist

Bases: django.core.exceptions.ObjectDoesNotExist

exception Category.MultipleObjectsReturned

Bases: django.core.exceptions.MultipleObjectsReturned

Category.add_log_entry(message, identifier=None, kind=<LogEntryKind.OTHER: 0>, user=None, extra=None, save=True)
Category.categoryfilter_set
Category.children
Category.description

Descriptor for translated attributes.

This attribute proxies all get/set calls to the translated model.

Category.get_status_display(*moreargs, **morekwargs)
Category.get_visibility_display(*moreargs, **morekwargs)
Category.image
Category.is_visible(customer)[source]
Category.log_entries
Category.name

Descriptor for translated attributes.

This attribute proxies all get/set calls to the translated model.

Category.objects = <shoop.core.models._categories.CategoryManager object>
Category.parent
Category.primary_products
Category.primary_shop_products
Category.save(*args, **kwargs)[source]
Category.shop_products
Category.shops
Category.slug

Descriptor for translated attributes.

This attribute proxies all get/set calls to the translated model.

Category.status

A placeholder class that provides a way to set the attribute on the model.

Category.translations
Category.visibility

A placeholder class that provides a way to set the attribute on the model.

Category.visibility_groups
class shoop.core.models.CategoryStatus

Bases: enumfields.enums.Enum

An enumeration.

DELETED = <CategoryStatus.DELETED: 2>
INVISIBLE = <CategoryStatus.INVISIBLE: 0>
VISIBLE = <CategoryStatus.VISIBLE: 1>
class shoop.core.models.CategoryVisibility

Bases: enumfields.enums.Enum

An enumeration.

VISIBLE_TO_ALL = <CategoryVisibility.VISIBLE_TO_ALL: 1>
VISIBLE_TO_GROUPS = <CategoryVisibility.VISIBLE_TO_GROUPS: 3>
VISIBLE_TO_LOGGED_IN = <CategoryVisibility.VISIBLE_TO_LOGGED_IN: 2>
class shoop.core.models.CompanyContact(id, polymorphic_ctype, created_on, identifier, is_active, default_shipping_address, default_billing_address, default_shipping_method, default_payment_method, language, marketing_permission, phone, www, timezone, prefix, name, suffix, name_ext, email, tax_group, merchant_notes, account_manager, contact_ptr, tax_number)

Bases: shoop.core.models.Contact

exception DoesNotExist

Bases: shoop.core.models._contacts.DoesNotExist

exception CompanyContact.MultipleObjectsReturned

Bases: shoop.core.models._contacts.MultipleObjectsReturned

CompanyContact.base_objects = <django.db.models.manager.Manager object>
CompanyContact.contact_ptr
CompanyContact.default_contact_group_identifier = 'default_company_group'
CompanyContact.default_contact_group_name = <django.utils.functional.lazy.<locals>.__proxy__ object>
CompanyContact.default_tax_group_getter()
CompanyContact.members
CompanyContact.objects = <polymorphic.managers.PolymorphicManager object>
CompanyContact.polymorphic_primary_key_name = 'id'
CompanyContact.polymorphic_super_sub_accessors_replaced = False
class shoop.core.models.ConfigurationItem(id, shop, key, value)

Bases: shoop.core.models.ShoopModel

exception DoesNotExist

Bases: django.core.exceptions.ObjectDoesNotExist

exception ConfigurationItem.MultipleObjectsReturned

Bases: django.core.exceptions.MultipleObjectsReturned

ConfigurationItem.objects = <django.db.models.manager.Manager object>
ConfigurationItem.shop
ConfigurationItem.value

A placeholder class that provides a way to set the attribute on the model.

class shoop.core.models.Contact(id, polymorphic_ctype, created_on, identifier, is_active, default_shipping_address, default_billing_address, default_shipping_method, default_payment_method, language, marketing_permission, phone, www, timezone, prefix, name, suffix, name_ext, email, tax_group, merchant_notes, account_manager)

Bases: shoop.core.models.PolymorphicShoopModel

exception DoesNotExist

Bases: django.core.exceptions.ObjectDoesNotExist

exception Contact.MultipleObjectsReturned

Bases: django.core.exceptions.MultipleObjectsReturned

Contact.account_manager
Contact.anonymouscontact
Contact.base_objects = <django.db.models.manager.Manager object>
Contact.company_memberships
Contact.companycontact
Contact.contactbasketcondition_set
Contact.contactcondition_set
Contact.customer_baskets
Contact.customer_orders
Contact.default_billing_address
Contact.default_contact_group_identifier = None
Contact.default_contact_group_name = None
Contact.default_payment_method
Contact.default_shipping_address
Contact.default_shipping_method
Contact.default_tax_group_getter = None
Contact.full_name
classmethod Contact.get_default_group()[source]

Get or create default contact group for the class.

Identifier of the group is specified by the class property default_contact_group_identifier.

If new group is created, its name is set to value of default_contact_group_name class property.

Return type:core.models.ContactGroup
Contact.get_language_display(*moreargs, **morekwargs)
Contact.get_next_by_created_on(*moreargs, **morekwargs)
Contact.get_previous_by_created_on(*moreargs, **morekwargs)
Contact.get_price_display_options()[source]

Get price display options of the contact.

If the default group (get_default_group) defines price display options and the contact is member of it, return it.

If contact is not (anymore) member of the default group or the default group does not define options, return one of the groups which defines options. If there is more than one such groups, it is undefined which options will be used.

If contact is not a member of any group that defines price display options, return default constructed PriceDisplayOptions.

Subclasses may still override this default behavior.

Return type:PriceDisplayOptions
Contact.get_timezone_display(*moreargs, **morekwargs)
Contact.groups
Contact.is_all_seeing = False
Contact.is_anonymous = False
Contact.objects = <polymorphic.managers.PolymorphicManager object>
Contact.personcontact
Contact.polymorphic_ctype
Contact.polymorphic_primary_key_name = 'id'
Contact.polymorphic_super_sub_accessors_replaced = False
Contact.save(*args, **kwargs)[source]
Contact.savedaddress_set
Contact.shop_set
Contact.tax_group
Contact.timezone

A placeholder class that provides a way to set the attribute on the model.

class shoop.core.models.ContactGroup(id, identifier, show_pricing, show_prices_including_taxes, hide_prices)

Bases: shoop.core.models.TranslatableShoopModel

exception DoesNotExist

Bases: django.core.exceptions.ObjectDoesNotExist

exception ContactGroup.MultipleObjectsReturned

Bases: django.core.exceptions.MultipleObjectsReturned

ContactGroup.can_delete()[source]
ContactGroup.cgpprice_set
ContactGroup.contactgroupbasketcondition_set
ContactGroup.contactgroupcondition_set
ContactGroup.delete(*args, **kwargs)[source]
ContactGroup.get_price_display_options()[source]
ContactGroup.groupavailabilitybehaviorcomponent_set
ContactGroup.members
ContactGroup.name

Descriptor for translated attributes.

This attribute proxies all get/set calls to the translated model.

ContactGroup.objects = <django.db.models.manager.ManagerFromContactGroupQuerySet object>
ContactGroup.translations
ContactGroup.visible_categories
ContactGroup.visible_products
class shoop.core.models.GroupAvailabilityBehaviorComponent(id, polymorphic_ctype, servicebehaviorcomponent_ptr)

Bases: shoop.core.models.ServiceBehaviorComponent

exception DoesNotExist

Bases: shoop.core.models._service_base.DoesNotExist

exception GroupAvailabilityBehaviorComponent.MultipleObjectsReturned

Bases: shoop.core.models._service_base.MultipleObjectsReturned

GroupAvailabilityBehaviorComponent.base_objects = <django.db.models.manager.Manager object>
GroupAvailabilityBehaviorComponent.get_unavailability_reasons(service, source)[source]
GroupAvailabilityBehaviorComponent.groups
GroupAvailabilityBehaviorComponent.help_text = <django.utils.functional.lazy.<locals>.__proxy__ object>
GroupAvailabilityBehaviorComponent.name = <django.utils.functional.lazy.<locals>.__proxy__ object>
GroupAvailabilityBehaviorComponent.objects = <polymorphic.managers.PolymorphicManager object>
GroupAvailabilityBehaviorComponent.polymorphic_primary_key_name = 'id'
GroupAvailabilityBehaviorComponent.polymorphic_super_sub_accessors_replaced = False
GroupAvailabilityBehaviorComponent.servicebehaviorcomponent_ptr
class shoop.core.models.Counter(id, value)

Bases: django.db.models.base.Model

exception DoesNotExist

Bases: django.core.exceptions.ObjectDoesNotExist

exception Counter.MultipleObjectsReturned

Bases: django.core.exceptions.MultipleObjectsReturned

classmethod Counter.get_and_increment(id)[source]
Counter.get_id_display(*moreargs, **morekwargs)
Counter.id

A placeholder class that provides a way to set the attribute on the model.

Counter.objects = <django.db.models.manager.Manager object>
class shoop.core.models.CounterType

Bases: enumfields.enums.Enum

An enumeration.

ORDER_REFERENCE = <CounterType.ORDER_REFERENCE: 1>
class shoop.core.models.CustomCarrier(*args, **kwargs)

Bases: shoop.core.models.Carrier

Carrier without any integration or special processing.

Replace Django’s inheritance accessor member functions for our model (self.__class__) with our own versions. We monkey patch them until a patch can be added to Django (which would probably be very small and make all of this obsolete).

If we have inheritance of the form ModelA -> ModelB ->ModelC then Django creates accessors like this: - ModelA: modelb - ModelB: modela_ptr, modelb, modelc - ModelC: modela_ptr, modelb, modelb_ptr, modelc

These accessors allow Django (and everyone else) to travel up and down the inheritance tree for the db object at hand.

The original Django accessors use our polymorphic manager. But they should not. So we replace them with our own accessors that use our appropriate base_objects manager.

exception DoesNotExist

Bases: shoop.core.models._service_shipping.DoesNotExist

exception CustomCarrier.MultipleObjectsReturned

Bases: shoop.core.models._service_shipping.MultipleObjectsReturned

CustomCarrier.base_objects = <parler.managers.TranslatableManager object>
CustomCarrier.carrier_ptr
CustomCarrier.carrierwithcheckoutphase
CustomCarrier.get_service_choices()[source]
CustomCarrier.objects = <shoop.core.models._base._PolyTransManager object>
CustomCarrier.polymorphic_primary_key_name = 'id'
CustomCarrier.polymorphic_super_sub_accessors_replaced = False
class shoop.core.models.CustomerTaxGroup(id, identifier, enabled)

Bases: shoop.core.models.TranslatableShoopModel

exception DoesNotExist

Bases: django.core.exceptions.ObjectDoesNotExist

exception CustomerTaxGroup.MultipleObjectsReturned

Bases: django.core.exceptions.MultipleObjectsReturned

CustomerTaxGroup.contact_set
classmethod CustomerTaxGroup.get_default_company_group()[source]
classmethod CustomerTaxGroup.get_default_person_group()[source]
CustomerTaxGroup.name

Descriptor for translated attributes.

This attribute proxies all get/set calls to the translated model.

CustomerTaxGroup.objects = <parler.managers.TranslatableManager object>
CustomerTaxGroup.taxrule_set
CustomerTaxGroup.translations
class shoop.core.models.CustomPaymentProcessor(*args, **kwargs)

Bases: shoop.core.models.PaymentProcessor

Payment processor without any integration or special processing.

Can be used for payment methods whose payments are processed manually.

Replace Django’s inheritance accessor member functions for our model (self.__class__) with our own versions. We monkey patch them until a patch can be added to Django (which would probably be very small and make all of this obsolete).

If we have inheritance of the form ModelA -> ModelB ->ModelC then Django creates accessors like this: - ModelA: modelb - ModelB: modela_ptr, modelb, modelc - ModelC: modela_ptr, modelb, modelb_ptr, modelc

These accessors allow Django (and everyone else) to travel up and down the inheritance tree for the db object at hand.

The original Django accessors use our polymorphic manager. But they should not. So we replace them with our own accessors that use our appropriate base_objects manager.

exception DoesNotExist

Bases: shoop.core.models._service_payment.DoesNotExist

exception CustomPaymentProcessor.MultipleObjectsReturned

Bases: shoop.core.models._service_payment.MultipleObjectsReturned

CustomPaymentProcessor.base_objects = <parler.managers.TranslatableManager object>
CustomPaymentProcessor.get_service_choices()[source]
CustomPaymentProcessor.objects = <shoop.core.models._base._PolyTransManager object>
CustomPaymentProcessor.paymentprocessor_ptr
CustomPaymentProcessor.paymentwithcheckoutphase
CustomPaymentProcessor.polymorphic_primary_key_name = 'id'
CustomPaymentProcessor.polymorphic_super_sub_accessors_replaced = False
CustomPaymentProcessor.process_payment_return_request(service, order, request)[source]
class shoop.core.models.FixedCostBehaviorComponent(id, polymorphic_ctype, servicebehaviorcomponent_ptr, price_value)

Bases: shoop.core.models._service_base.TranslatableServiceBehaviorComponent

exception DoesNotExist

Bases: django.core.exceptions.ObjectDoesNotExist

exception FixedCostBehaviorComponent.MultipleObjectsReturned

Bases: django.core.exceptions.MultipleObjectsReturned

FixedCostBehaviorComponent.base_objects = <parler.managers.TranslatableManager object>
FixedCostBehaviorComponent.description

Descriptor for translated attributes.

This attribute proxies all get/set calls to the translated model.

FixedCostBehaviorComponent.get_costs(service, source)[source]
FixedCostBehaviorComponent.help_text = <django.utils.functional.lazy.<locals>.__proxy__ object>
FixedCostBehaviorComponent.name = <django.utils.functional.lazy.<locals>.__proxy__ object>
FixedCostBehaviorComponent.objects = <shoop.core.models._base._PolyTransManager object>
FixedCostBehaviorComponent.polymorphic_primary_key_name = 'id'
FixedCostBehaviorComponent.polymorphic_super_sub_accessors_replaced = False
FixedCostBehaviorComponent.servicebehaviorcomponent_ptr
FixedCostBehaviorComponent.translations
shoop.core.models.get_company_contact(user)

Get preferred CompanyContact of given user.

If user has associated PersonContact which is member of CompanyContact, return CompanyContact. Otherwise, return None.

Parameters:user (django.contrib.auth.models.User|None) – User object (or None) to get contact for
Returns:CompanyContact (or none) of which user’s PersonContact is a member
Return type:CompanyContact|None
shoop.core.models.get_person_contact(user)

Get PersonContact of given user.

If given user is non-zero (evaluates true as bool) and not anonymous, return the PersonContact of the user. If there is no PersonContact for the user yet, create it first. When this creation happens, details (name, email, is_active) are copied from the user.

If given user is None (or otherwise evaluates as false) or anonymous, return the AnonymousContact.

Parameters:user (django.contrib.auth.models.User|None) – User object (or None) to get contact for
Returns:PersonContact of the user or AnonymousContact
Return type:PersonContact|AnonymousContact
class shoop.core.models.Gender

Bases: enumfields.enums.Enum

An enumeration.

FEMALE = <Gender.FEMALE: 'f'>
MALE = <Gender.MALE: 'm'>
OTHER = <Gender.OTHER: 'o'>
UNDISCLOSED = <Gender.UNDISCLOSED: 'u'>
class shoop.core.models.ImmutableAddress(*args, **kwargs)

Bases: shoop.core.models._base.ChangeProtected, shoop.core.models._addresses.Address

An address that can not be changed.

Immutable addresses are used for orders, etc., where subsequent edits to the original address (for example an user’s default address) must not affect past business data.

Immutable addresses can be created directly, with the from_data() method, or by creating an immutable copy of an existing MutableAddress with the Address.to_immutable() method.

exception DoesNotExist

Bases: django.core.exceptions.ObjectDoesNotExist

exception ImmutableAddress.MultipleObjectsReturned

Bases: django.core.exceptions.MultipleObjectsReturned

ImmutableAddress.billing_orders
ImmutableAddress.country

A descriptor for country fields on a model instance. Returns a Country when accessed so you can do things like:

>>> from people import Person
>>> person = Person.object.get(name='Chris')

>>> person.country.name
'New Zealand'

>>> person.country.flag
'/static/flags/nz.gif'
classmethod ImmutableAddress.from_data(data)[source]

Get or create immutable address with given data.

Parameters:data (dict[str,str]) – data for address
Returns:Saved immutable address
Return type:ImmutableAddress
ImmutableAddress.get_country_display(*moreargs, **morekwargs)
ImmutableAddress.objects = <django.db.models.manager.Manager object>
ImmutableAddress.shipping_orders
ImmutableAddress.to_immutable()[source]
class shoop.core.models.Manufacturer(id, created_on, identifier, name, url)

Bases: django.db.models.base.Model

exception DoesNotExist

Bases: django.core.exceptions.ObjectDoesNotExist

exception Manufacturer.MultipleObjectsReturned

Bases: django.core.exceptions.MultipleObjectsReturned

Manufacturer.get_next_by_created_on(*moreargs, **morekwargs)
Manufacturer.get_previous_by_created_on(*moreargs, **morekwargs)
Manufacturer.objects = <django.db.models.manager.Manager object>
Manufacturer.product_set
class shoop.core.models.MutableAddress(*args, **kwargs)

Bases: shoop.core.models._addresses.Address

An address that can be changed.

Mutable addresses are used for e.g. contact’s saved addresses. They are saved as new immutable addresses when used in e.g. orders.

Mutable addresses can be created with MutableAddress.from_data or with the to_mutable method of Address objects.

exception DoesNotExist

Bases: django.core.exceptions.ObjectDoesNotExist

exception MutableAddress.MultipleObjectsReturned

Bases: django.core.exceptions.MultipleObjectsReturned

MutableAddress.country

A descriptor for country fields on a model instance. Returns a Country when accessed so you can do things like:

>>> from people import Person
>>> person = Person.object.get(name='Chris')

>>> person.country.name
'New Zealand'

>>> person.country.flag
'/static/flags/nz.gif'
classmethod MutableAddress.from_data(data)[source]

Construct mutable address from a data dictionary.

Parameters:data (dict[str,str]) – data for address
Returns:Unsaved mutable address
Return type:MutableAddress
MutableAddress.get_country_display(*moreargs, **morekwargs)
MutableAddress.objects = <django.db.models.manager.Manager object>
MutableAddress.saved_addresses
MutableAddress.shop_set
class shoop.core.models.Order(id, shop, created_on, modified_on, identifier, label, key, reference_number, customer, orderer, billing_address, shipping_address, tax_number, phone, email, creator, modified_by, deleted, status, payment_status, shipping_status, payment_method, payment_method_name, payment_data, shipping_method, shipping_method_name, shipping_data, extra_data, taxful_total_price_value, taxless_total_price_value, currency, prices_include_tax, display_currency, display_currency_rate, ip_address, order_date, payment_date, language, customer_comment, admin_comment, require_verification, all_verified, marketing_permission, _codes)

Bases: shoop.utils.properties.MoneyPropped, django.db.models.base.Model

exception DoesNotExist

Bases: django.core.exceptions.ObjectDoesNotExist

exception Order.MultipleObjectsReturned

Bases: django.core.exceptions.MultipleObjectsReturned

Order.add_log_entry(message, identifier=None, kind=<LogEntryKind.OTHER: 0>, user=None, extra=None, save=True)
Order.billing_address
Order.cache_prices()[source]
Order.can_create_refund()[source]
Order.can_edit()[source]
Order.can_set_canceled()[source]
Order.can_set_complete()[source]
Order.check_all_verified()[source]
Order.codes
Order.coupon_usages
Order.create_full_refund(restock_products=False)[source]

Create a full for entire order contents, with the option of restocking stocked products.

Parameters:restock_products (bool|False) – Boolean indicating whether to restock products
Order.create_payment(amount, payment_identifier=None, description='')[source]

Create a payment with given amount for this order.

If the order already has payments and sum of their amounts is equal or greater than self.taxful_total_price, an exception is raised.

If the end sum of all payments is equal or greater than self.taxful_total_price, then the order is marked as paid.

Parameters:
  • amount (Money) – Amount of the payment to be created
  • payment_identifier (str|None) – Identifier of the created payment. If not set, default value of “gateway_id:order_id:number” will be used (where number is number of payments in the order).
  • description (str) – Description of the payment. Will be set to method property of the created payment.
Returns:

The created Payment object

Return type:

shoop.core.models.Payment

Order.create_refund(refund_data, created_by=None)[source]

Create a refund if passed a list of refund line data.

Refund line data is simply a list of dictionaries where each dictionary contains data for a particular refund line.

If refund line data includes a parent line, the refund is associated with that line and cannot exceed the line amount.

Additionally, if the parent line is of enum type OrderLineType.PRODUCT and the restock_products boolean flag is set to True, the products will be restocked with the order’s supplier the exact amount of the value of the quantity field.

Parameters:
  • refund_data ([dict]) – List of dicts containing refund data.
  • created_by (django.contrib.auth.User|None) – Refund creator’s user instance, used for adjusting supplier stock.
Order.create_shipment(product_quantities, supplier=None, shipment=None)[source]

Create a shipment for this order from product_quantities. product_quantities is expected to be a dict mapping Product instances to quantities.

Only quantities over 0 are taken into account, and if the mapping is empty or has no quantity value over 0, NoProductsToShipException will be raised.

Parameters:
  • product_quantities (dict[shoop.shop.models.Product, decimal.Decimal]) – a dict mapping Product instances to quantities to ship
  • supplier – Optional Supplier for this product. No validation is made as to whether the given supplier supplies the products.
  • shipment – Optional unsaved Shipment for ShipmentProduct’s. If not given Shipment is created based on supplier parameter.
Raises:

NoProductsToShipException

Returns:

Saved, complete Shipment object

Return type:

shoop.core.models.Shipment

Order.create_shipment_of_all_products(supplier=None)[source]

Create a shipment of all the products in this Order, no matter whether or not any have been previously marked as shipped or not.

See the documentation for create_shipment.

Parameters:supplier – The Supplier to use. If None, the first supplier in the order is used. (If several are in the order, this fails.)
Returns:Saved, complete Shipment object
Return type:shoop.shop.models.Shipment
Order.creator
Order.customer
Order.delete(using=None)[source]
Order.extra_data

A placeholder class that provides a way to set the attribute on the model.

Order.full_clean(exclude=None, validate_unique=True)[source]
Order.get_known_additional_data()[source]

Get a list of “known additional data” in this order’s payment_data, shipping_data and extra_data. The list is returned in the order the fields are specified in the settings entries for said known keys. dict(that_list) can of course be used to “flatten” the list into a dict. :return: list of 2-tuples.

Order.get_language_display(*moreargs, **morekwargs)
Order.get_next_by_created_on(*moreargs, **morekwargs)
Order.get_next_by_modified_on(*moreargs, **morekwargs)
Order.get_next_by_order_date(*moreargs, **morekwargs)
Order.get_payment_status_display(*moreargs, **morekwargs)
Order.get_previous_by_created_on(*moreargs, **morekwargs)
Order.get_previous_by_modified_on(*moreargs, **morekwargs)
Order.get_previous_by_order_date(*moreargs, **morekwargs)
Order.get_product_ids_and_quantities()[source]
Order.get_product_summary()[source]

Return a dict of product IDs -> {ordered, unshipped, shipped}

Order.get_purchased_attachments()[source]
Order.get_shipping_status_display(*moreargs, **morekwargs)
Order.get_status_display()[source]
Order.get_tax_summary()[source]
Return type:taxing.TaxSummary
Order.get_total_paid_amount()[source]
Order.get_total_refunded_amount()[source]
Order.get_total_unpaid_amount()[source]
Order.get_total_unrefunded_amount()[source]
Order.get_tracking_codes()[source]
Order.get_unshipped_products()[source]
Order.has_refunds()[source]
Order.is_canceled()[source]
Order.is_complete()[source]
Order.is_paid()[source]
Order.lines
Order.log_entries
Order.modified_by
Order.objects = <django.db.models.manager.ManagerFromOrderQuerySet object>
Order.orderer
Order.payment_data

A placeholder class that provides a way to set the attribute on the model.

Order.payment_method
Order.payment_status

A placeholder class that provides a way to set the attribute on the model.

Order.payments
Order.save(*args, **kwargs)[source]
Order.set_canceled()[source]
Order.shipments
Order.shipping_address
Order.shipping_data

A placeholder class that provides a way to set the attribute on the model.

Order.shipping_method
Order.shipping_status

A placeholder class that provides a way to set the attribute on the model.

Order.shop
Order.status
Order.taxful_total_price
Order.taxless_total_price
Order.update_shipping_status()[source]
class shoop.core.models.OrderLine(id, order, product, supplier, parent_line, ordering, type, sku, text, accounting_identifier, require_verification, verified, extra_data, quantity, base_unit_price_value, discount_amount_value)

Bases: shoop.utils.properties.MoneyPropped, django.db.models.base.Model, shoop.core.pricing.Priceful

exception DoesNotExist

Bases: django.core.exceptions.ObjectDoesNotExist

exception OrderLine.MultipleObjectsReturned

Bases: django.core.exceptions.MultipleObjectsReturned

OrderLine.base_unit_price

Property for Price object.

Similar to MoneyProperty but also has includes_tax field.

Operaters with TaxfulPrice and TaxlessPrice objects.

OrderLine.child_lines
OrderLine.discount_amount

Property for Price object.

Similar to MoneyProperty but also has includes_tax field.

Operaters with TaxfulPrice and TaxlessPrice objects.

OrderLine.extra_data

A placeholder class that provides a way to set the attribute on the model.

OrderLine.get_type_display(*moreargs, **morekwargs)
OrderLine.max_refundable_amount
Return type:shoop.utils.money.Money
OrderLine.objects = <shoop.core.models._order_lines.OrderLineManager object>
OrderLine.order
OrderLine.parent_line
OrderLine.product
OrderLine.save(*args, **kwargs)[source]
OrderLine.supplier
OrderLine.tax_amount
Return type:shoop.utils.money.Money
OrderLine.taxes
OrderLine.type

A placeholder class that provides a way to set the attribute on the model.

class shoop.core.models.OrderLineTax(id, order_line, tax, name, amount_value, base_amount_value, ordering)

Bases: shoop.utils.properties.MoneyPropped, shoop.core.models.ShoopModel, shoop.core.taxing.LineTax

exception DoesNotExist

Bases: django.core.exceptions.ObjectDoesNotExist

exception OrderLineTax.MultipleObjectsReturned

Bases: django.core.exceptions.MultipleObjectsReturned

OrderLineTax.amount

Property for a Money amount.

Will return Money objects when the property is being get and accepts Money objects on set. Value and currency are read/written from/to other fields.

Fields are given as locators, that is a string in dotted format, e.g. locator "foo.bar" points to instance.foo.bar where instance is an instance of the class owning the MoneyProperty.

Setting value of this property to a Money object with different currency that is currently set (in the field pointed by the currency locator), will raise an UnitMixupError.

OrderLineTax.base_amount

Property for a Money amount.

Will return Money objects when the property is being get and accepts Money objects on set. Value and currency are read/written from/to other fields.

Fields are given as locators, that is a string in dotted format, e.g. locator "foo.bar" points to instance.foo.bar where instance is an instance of the class owning the MoneyProperty.

Setting value of this property to a Money object with different currency that is currently set (in the field pointed by the currency locator), will raise an UnitMixupError.

OrderLineTax.objects = <django.db.models.manager.Manager object>
OrderLineTax.order_line
OrderLineTax.tax
class shoop.core.models.OrderLineType

Bases: enumfields.enums.Enum

An enumeration.

DISCOUNT = <OrderLineType.DISCOUNT: 4>
OTHER = <OrderLineType.OTHER: 5>
PAYMENT = <OrderLineType.PAYMENT: 3>
PRODUCT = <OrderLineType.PRODUCT: 1>
REFUND = <OrderLineType.REFUND: 6>
SHIPPING = <OrderLineType.SHIPPING: 2>
class shoop.core.models.OrderLogEntry(id, created_on, user, message, identifier, kind, extra, target)

Bases: shoop.utils.analog.BaseLogEntry

exception DoesNotExist

Bases: django.core.exceptions.ObjectDoesNotExist

exception OrderLogEntry.MultipleObjectsReturned

Bases: django.core.exceptions.MultipleObjectsReturned

OrderLogEntry.extra

A placeholder class that provides a way to set the attribute on the model.

OrderLogEntry.get_kind_display(*moreargs, **morekwargs)
OrderLogEntry.get_next_by_created_on(*moreargs, **morekwargs)
OrderLogEntry.get_previous_by_created_on(*moreargs, **morekwargs)
OrderLogEntry.kind

A placeholder class that provides a way to set the attribute on the model.

OrderLogEntry.logged_model

alias of Order

OrderLogEntry.objects = <django.db.models.manager.Manager object>
OrderLogEntry.target
OrderLogEntry.user
class shoop.core.models.OrderStatus(id, identifier, ordering, role, default)

Bases: parler.models.TranslatableModel

exception DoesNotExist

Bases: django.core.exceptions.ObjectDoesNotExist

exception OrderStatus.MultipleObjectsReturned

Bases: django.core.exceptions.MultipleObjectsReturned

OrderStatus.get_role_display(*moreargs, **morekwargs)
OrderStatus.name

Descriptor for translated attributes.

This attribute proxies all get/set calls to the translated model.

OrderStatus.objects = <django.db.models.manager.ManagerFromOrderStatusQuerySet object>
OrderStatus.order_set
OrderStatus.role

A placeholder class that provides a way to set the attribute on the model.

OrderStatus.save(*args, **kwargs)[source]
OrderStatus.translations
class shoop.core.models.OrderStatusRole

Bases: enumfields.enums.Enum

An enumeration.

CANCELED = <OrderStatusRole.CANCELED: 3>
COMPLETE = <OrderStatusRole.COMPLETE: 2>
INITIAL = <OrderStatusRole.INITIAL: 1>
NONE = <OrderStatusRole.NONE: 0>
class shoop.core.models.Payment(id, order, created_on, gateway_id, payment_identifier, amount_value, foreign_amount_value, foreign_currency, description)

Bases: shoop.utils.properties.MoneyPropped, django.db.models.base.Model

exception DoesNotExist

Bases: django.core.exceptions.ObjectDoesNotExist

exception Payment.MultipleObjectsReturned

Bases: django.core.exceptions.MultipleObjectsReturned

Payment.amount

Property for a Money amount.

Will return Money objects when the property is being get and accepts Money objects on set. Value and currency are read/written from/to other fields.

Fields are given as locators, that is a string in dotted format, e.g. locator "foo.bar" points to instance.foo.bar where instance is an instance of the class owning the MoneyProperty.

Setting value of this property to a Money object with different currency that is currently set (in the field pointed by the currency locator), will raise an UnitMixupError.

Payment.foreign_amount

Property for a Money amount.

Will return Money objects when the property is being get and accepts Money objects on set. Value and currency are read/written from/to other fields.

Fields are given as locators, that is a string in dotted format, e.g. locator "foo.bar" points to instance.foo.bar where instance is an instance of the class owning the MoneyProperty.

Setting value of this property to a Money object with different currency that is currently set (in the field pointed by the currency locator), will raise an UnitMixupError.

Payment.get_next_by_created_on(*moreargs, **morekwargs)
Payment.get_previous_by_created_on(*moreargs, **morekwargs)
Payment.objects = <django.db.models.manager.Manager object>
Payment.order
class shoop.core.models.PaymentMethod(id, identifier, enabled, shop, choice_identifier, old_module_identifier, old_module_data, logo, tax_class, payment_processor)

Bases: shoop.core.models.Service

exception DoesNotExist

Bases: django.core.exceptions.ObjectDoesNotExist

exception PaymentMethod.MultipleObjectsReturned

Bases: django.core.exceptions.MultipleObjectsReturned

PaymentMethod.behavior_components
PaymentMethod.can_delete()[source]
PaymentMethod.contact_set
PaymentMethod.description

Descriptor for translated attributes.

This attribute proxies all get/set calls to the translated model.

PaymentMethod.get_payment_process_response(order, urls)[source]
PaymentMethod.line_type = <OrderLineType.PAYMENT: 3>
PaymentMethod.name

Descriptor for translated attributes.

This attribute proxies all get/set calls to the translated model.

PaymentMethod.objects = <django.db.models.manager.ManagerFromServiceQuerySet object>
PaymentMethod.old_module_data

A placeholder class that provides a way to set the attribute on the model.

PaymentMethod.payment_orders
PaymentMethod.payment_processor
PaymentMethod.payment_products
PaymentMethod.process_payment_return_request(order, request)[source]
PaymentMethod.provider_attr = 'payment_processor'
PaymentMethod.shop
PaymentMethod.shop_product_m2m = 'payment_methods'
PaymentMethod.tax_class
PaymentMethod.translations
class shoop.core.models.PaymentProcessor(*args, **kwargs)

Bases: shoop.core.models.ServiceProvider

Service provider interface for payment processing.

Services provided by a payment processor are payment methods. To create a new payment method for a payment processor, use the create_service method.

Implementers of this interface will provide provide a list of payment service choices and each related payment method should have one of those service choices assigned to it.

Payment processing is handled with get_payment_process_response and process_payment_return_request methods.

Note: PaymentProcessor objects should never be created on their own but rather through a concrete subclass.

Replace Django’s inheritance accessor member functions for our model (self.__class__) with our own versions. We monkey patch them until a patch can be added to Django (which would probably be very small and make all of this obsolete).

If we have inheritance of the form ModelA -> ModelB ->ModelC then Django creates accessors like this: - ModelA: modelb - ModelB: modela_ptr, modelb, modelc - ModelC: modela_ptr, modelb, modelb_ptr, modelc

These accessors allow Django (and everyone else) to travel up and down the inheritance tree for the db object at hand.

The original Django accessors use our polymorphic manager. But they should not. So we replace them with our own accessors that use our appropriate base_objects manager.

exception DoesNotExist

Bases: shoop.core.models._service_base.DoesNotExist

exception PaymentProcessor.MultipleObjectsReturned

Bases: shoop.core.models._service_base.MultipleObjectsReturned

PaymentProcessor.base_objects = <parler.managers.TranslatableManager object>
PaymentProcessor.custompaymentprocessor
PaymentProcessor.delete(*args, **kwargs)[source]
PaymentProcessor.get_payment_process_response(service, order, urls)[source]

Get payment process response for given order.

Return type:django.http.HttpResponse|None
PaymentProcessor.objects = <shoop.core.models._base._PolyTransManager object>
PaymentProcessor.paymentmethod_set
PaymentProcessor.polymorphic_primary_key_name = 'id'
PaymentProcessor.polymorphic_super_sub_accessors_replaced = False
PaymentProcessor.process_payment_return_request(service, order, request)[source]

Process payment return request for given order.

Should set order.payment_status. Default implementation just sets it to DEFERRED if it is NOT_PAID.

Return type:None
PaymentProcessor.pseudopaymentprocessor
PaymentProcessor.service_model

alias of PaymentMethod

PaymentProcessor.serviceprovider_ptr
class shoop.core.models.PaymentStatus

Bases: enumfields.enums.Enum

An enumeration.

CANCELED = <PaymentStatus.CANCELED: 3>
DEFERRED = <PaymentStatus.DEFERRED: 4>
FULLY_PAID = <PaymentStatus.FULLY_PAID: 2>
NOT_PAID = <PaymentStatus.NOT_PAID: 0>
PARTIALLY_PAID = <PaymentStatus.PARTIALLY_PAID: 1>
class shoop.core.models.PaymentUrls(payment_url, return_url, cancel_url)

Bases: object

Container for URLs used in payment processing.

class shoop.core.models.PersistentCacheEntry(id, module, key, time, data)

Bases: django.db.models.base.Model

exception DoesNotExist

Bases: django.core.exceptions.ObjectDoesNotExist

exception PersistentCacheEntry.MultipleObjectsReturned

Bases: django.core.exceptions.MultipleObjectsReturned

PersistentCacheEntry.data

A placeholder class that provides a way to set the attribute on the model.

PersistentCacheEntry.get_next_by_time(*moreargs, **morekwargs)
PersistentCacheEntry.get_previous_by_time(*moreargs, **morekwargs)
PersistentCacheEntry.objects = <django.db.models.manager.Manager object>
class shoop.core.models.PersonContact(id, polymorphic_ctype, created_on, identifier, is_active, default_shipping_address, default_billing_address, default_shipping_method, default_payment_method, language, marketing_permission, phone, www, timezone, prefix, name, suffix, name_ext, email, tax_group, merchant_notes, account_manager, contact_ptr, user, gender, birth_date, first_name, last_name)

Bases: shoop.core.models.Contact

exception DoesNotExist

Bases: shoop.core.models._contacts.DoesNotExist

exception PersonContact.MultipleObjectsReturned

Bases: shoop.core.models._contacts.MultipleObjectsReturned

PersonContact.base_objects = <django.db.models.manager.Manager object>
PersonContact.contact_ptr
PersonContact.contact_set
PersonContact.default_contact_group_identifier = 'default_person_group'
PersonContact.default_contact_group_name = <django.utils.functional.lazy.<locals>.__proxy__ object>
PersonContact.default_tax_group_getter()
PersonContact.gender

A placeholder class that provides a way to set the attribute on the model.

PersonContact.get_gender_display(*moreargs, **morekwargs)
PersonContact.is_all_seeing
PersonContact.name
PersonContact.objects = <polymorphic.managers.PolymorphicManager object>
PersonContact.orderer_baskets
PersonContact.orderer_orders
PersonContact.polymorphic_primary_key_name = 'id'
PersonContact.polymorphic_super_sub_accessors_replaced = False
PersonContact.save(*args, **kwargs)[source]
PersonContact.user
class shoop.core.models.PolymorphicShoopModel(*args, **kwargs)

Bases: polymorphic.models.PolymorphicModel, shoop.core.models.ShoopModel

Replace Django’s inheritance accessor member functions for our model (self.__class__) with our own versions. We monkey patch them until a patch can be added to Django (which would probably be very small and make all of this obsolete).

If we have inheritance of the form ModelA -> ModelB ->ModelC then Django creates accessors like this: - ModelA: modelb - ModelB: modela_ptr, modelb, modelc - ModelC: modela_ptr, modelb, modelb_ptr, modelc

These accessors allow Django (and everyone else) to travel up and down the inheritance tree for the db object at hand.

The original Django accessors use our polymorphic manager. But they should not. So we replace them with our own accessors that use our appropriate base_objects manager.

class Meta[source]

Bases: object

abstract = False
PolymorphicShoopModel.base_objects
PolymorphicShoopModel.objects
PolymorphicShoopModel.polymorphic_ctype
PolymorphicShoopModel.polymorphic_super_sub_accessors_replaced = False
class shoop.core.models.PolymorphicTranslatableShoopModel(*args, **kwargs)

Bases: shoop.core.models.PolymorphicShoopModel, shoop.core.models.TranslatableShoopModel

Replace Django’s inheritance accessor member functions for our model (self.__class__) with our own versions. We monkey patch them until a patch can be added to Django (which would probably be very small and make all of this obsolete).

If we have inheritance of the form ModelA -> ModelB ->ModelC then Django creates accessors like this: - ModelA: modelb - ModelB: modela_ptr, modelb, modelc - ModelC: modela_ptr, modelb, modelb_ptr, modelc

These accessors allow Django (and everyone else) to travel up and down the inheritance tree for the db object at hand.

The original Django accessors use our polymorphic manager. But they should not. So we replace them with our own accessors that use our appropriate base_objects manager.

class Meta[source]

Bases: object

abstract = False
PolymorphicTranslatableShoopModel.base_objects
PolymorphicTranslatableShoopModel.objects
PolymorphicTranslatableShoopModel.polymorphic_ctype
PolymorphicTranslatableShoopModel.polymorphic_super_sub_accessors_replaced = False
class shoop.core.models.Product(id, created_on, modified_on, deleted, mode, variation_parent, stock_behavior, shipping_mode, sales_unit, tax_class, type, sku, gtin, barcode, accounting_identifier, profit_center, cost_center, category, width, height, depth, net_weight, gross_weight, manufacturer, primary_image)

Bases: shoop.core.taxing.TaxableItem, shoop.core.models._attributes.AttributableMixin, parler.models.TranslatableModel

exception DoesNotExist

Bases: django.core.exceptions.ObjectDoesNotExist

exception Product.MultipleObjectsReturned

Bases: django.core.exceptions.MultipleObjectsReturned

Product.add_log_entry(message, identifier=None, kind=<LogEntryKind.OTHER: 0>, user=None, extra=None, save=True)
Product.attributes
Product.category
Product.clear_variation()[source]

Fully remove variation information.

Make this product a non-variation parent.

Product.cross_sell_1
Product.cross_sell_2
Product.delete(using=None)[source]
Product.description

Descriptor for translated attributes.

This attribute proxies all get/set calls to the translated model.

Product.discountfromproduct_set
Product.freeproductline_set
Product.get_all_available_combinations()[source]

Generate all available combinations of variation variables.

If the product is not a variable variation parent, the iterator is empty.

Because of possible combinatorial explosion this is a generator function. (For example 6 variables with 5 options each explodes to 15,625 combinations.)

Returns:Iterable of combination information dicts.
Return type:Iterable[dict]
Product.get_all_package_children()[source]
Product.get_all_package_parents()[source]
Product.get_available_attribute_queryset()[source]
Product.get_available_variation_results()[source]

Get a dict of combination_hash to product ID of variable variation results.

Returns:Mapping of combination hashes to product IDs
Return type:dict[str, int]
Product.get_base_price(context, quantity=1)[source]

Get base price of the product within given context.

Base price differs from the (effective) price when there are discounts in effect.

Return type:shoop.core.pricing.Price
Product.get_cheapest_child_price(context, quantity=1)[source]
Product.get_cheapest_child_price_info(context, quantity=1)[source]

Get the PriceInfo of the cheapest variation child

The attribute used for sorting is PriceInfo.price.

Return None if self.variation_children do not exist. This is because we cannot return anything sensible.

Return type:shoop.core.pricing.PriceInfo
Product.get_child_price_range(context, quantity=1)[source]

Get the prices for cheapest and the most expensive child

The attribute used for sorting is PriceInfo.price.

Return (None, None) if self.variation_children do not exist. This is because we cannot return anything sensible.

Returns:a tuple of prices
Return type:(shoop.core.pricing.Price, shoop.core.pricing.Price)
Product.get_mode_display(*moreargs, **morekwargs)
Product.get_next_by_created_on(*moreargs, **morekwargs)
Product.get_next_by_modified_on(*moreargs, **morekwargs)
Product.get_package_child_to_quantity_map()[source]
Product.get_previous_by_created_on(*moreargs, **morekwargs)
Product.get_previous_by_modified_on(*moreargs, **morekwargs)
Product.get_price(context, quantity=1)[source]

Get price of the product within given context.

Note

When the current pricing module implements pricing steps, it is possible that p.get_price(ctx) * 123 is not equal to p.get_price(ctx, quantity=123), since there could be quantity discounts in effect, but usually they are equal.

Return type:shoop.core.pricing.Price
Product.get_price_info(context, quantity=1)[source]

Get PriceInfo object for the product in given context.

Returned PriceInfo object contains calculated price and base_price. The calculation of prices is handled in the current pricing module.

Return type:shoop.core.pricing.PriceInfo
Product.get_priced_children(context, quantity=1)[source]

Get child products with price infos sorted by price.

Return type:list[(Product,PriceInfo)]
Returns:List of products and their price infos sorted from cheapest to most expensive.
Product.get_public_media()[source]
Product.get_shipping_mode_display(*moreargs, **morekwargs)
Product.get_shop_instance(shop)[source]
Return type:shoop.core.models.ShopProduct
Product.get_stock_behavior_display(*moreargs, **morekwargs)
Product.get_variation_siblings()[source]
Product.is_package_child()[source]
Product.is_package_parent()[source]
Product.is_stocked()[source]
Product.is_variation_child()[source]
Product.is_variation_parent()[source]
Product.keywords

Descriptor for translated attributes.

This attribute proxies all get/set calls to the translated model.

Parameters:
  • parent (Product) – The parent to link to.
  • variables (dict|None) – Optional dict of {variable identifier: value identifier} for complex variable linkage
  • combination_hash (str|None) – Optional combination hash (for variable variations), if precomputed. Mutually exclusive with variables
Product.log_entries
Product.make_package(package_def)[source]
Product.manufacturer
Product.media
Product.mode

A placeholder class that provides a way to set the attribute on the model.

Product.name

Descriptor for translated attributes.

This attribute proxies all get/set calls to the translated model.

Product.objects = <django.db.models.manager.ManagerFromProductQuerySet object>
Product.order_lines
Product.primary_image
Product.productfilter_set
Product.productsinbasketcondition_set
Product.sales_unit
Product.save(*args, **kwargs)[source]
Product.shipments
Product.shipping_mode

A placeholder class that provides a way to set the attribute on the model.

Product.shop_products
Product.simplify_variation()[source]

Remove variation variables from the given variation parent, turning it into a simple variation (or a normal product, if it has no children).

Parameters:product (shoop.core.models.Product) – Variation parent to not be variable any longer.
Product.slug

Descriptor for translated attributes.

This attribute proxies all get/set calls to the translated model.

Product.soft_delete(user=None)[source]
Product.status_text

Descriptor for translated attributes.

This attribute proxies all get/set calls to the translated model.

Product.stock_behavior

A placeholder class that provides a way to set the attribute on the model.

Product.storedbasket_set
Product.suppliedproduct_set
Product.tax_class
Product.translations
Product.type
Product.variation_children
Product.variation_name

Descriptor for translated attributes.

This attribute proxies all get/set calls to the translated model.

Product.variation_parent
Product.variation_result_subs
Product.variation_result_supers
Product.variation_variables
Product.verify_mode()[source]
class shoop.core.models.Product(id, created_on, modified_on, deleted, mode, variation_parent, stock_behavior, shipping_mode, sales_unit, tax_class, type, sku, gtin, barcode, accounting_identifier, profit_center, cost_center, category, width, height, depth, net_weight, gross_weight, manufacturer, primary_image)

Bases: shoop.core.taxing.TaxableItem, shoop.core.models._attributes.AttributableMixin, parler.models.TranslatableModel

COMMON_SELECT_RELATED = ('type', 'primary_image', 'tax_class')
exception DoesNotExist

Bases: django.core.exceptions.ObjectDoesNotExist

exception Product.MultipleObjectsReturned

Bases: django.core.exceptions.MultipleObjectsReturned

Product.add_log_entry(message, identifier=None, kind=<LogEntryKind.OTHER: 0>, user=None, extra=None, save=True)
Product.attributes
Product.category
Product.clear_variation()[source]

Fully remove variation information.

Make this product a non-variation parent.

Product.cross_sell_1
Product.cross_sell_2
Product.delete(using=None)[source]
Product.description

Descriptor for translated attributes.

This attribute proxies all get/set calls to the translated model.

Product.discountfromproduct_set
Product.freeproductline_set
Product.get_all_available_combinations()[source]

Generate all available combinations of variation variables.

If the product is not a variable variation parent, the iterator is empty.

Because of possible combinatorial explosion this is a generator function. (For example 6 variables with 5 options each explodes to 15,625 combinations.)

Returns:Iterable of combination information dicts.
Return type:Iterable[dict]
Product.get_all_package_children()[source]
Product.get_all_package_parents()[source]
Product.get_available_attribute_queryset()[source]
Product.get_available_variation_results()[source]

Get a dict of combination_hash to product ID of variable variation results.

Returns:Mapping of combination hashes to product IDs
Return type:dict[str, int]
Product.get_base_price(context, quantity=1)[source]

Get base price of the product within given context.

Base price differs from the (effective) price when there are discounts in effect.

Return type:shoop.core.pricing.Price
Product.get_cheapest_child_price(context, quantity=1)[source]
Product.get_cheapest_child_price_info(context, quantity=1)[source]

Get the PriceInfo of the cheapest variation child

The attribute used for sorting is PriceInfo.price.

Return None if self.variation_children do not exist. This is because we cannot return anything sensible.

Return type:shoop.core.pricing.PriceInfo
Product.get_child_price_range(context, quantity=1)[source]

Get the prices for cheapest and the most expensive child

The attribute used for sorting is PriceInfo.price.

Return (None, None) if self.variation_children do not exist. This is because we cannot return anything sensible.

Returns:a tuple of prices
Return type:(shoop.core.pricing.Price, shoop.core.pricing.Price)
Product.get_mode_display(*moreargs, **morekwargs)
Product.get_next_by_created_on(*moreargs, **morekwargs)
Product.get_next_by_modified_on(*moreargs, **morekwargs)
Product.get_package_child_to_quantity_map()[source]
Product.get_previous_by_created_on(*moreargs, **morekwargs)
Product.get_previous_by_modified_on(*moreargs, **morekwargs)
Product.get_price(context, quantity=1)[source]

Get price of the product within given context.

Note

When the current pricing module implements pricing steps, it is possible that p.get_price(ctx) * 123 is not equal to p.get_price(ctx, quantity=123), since there could be quantity discounts in effect, but usually they are equal.

Return type:shoop.core.pricing.Price
Product.get_price_info(context, quantity=1)[source]

Get PriceInfo object for the product in given context.

Returned PriceInfo object contains calculated price and base_price. The calculation of prices is handled in the current pricing module.

Return type:shoop.core.pricing.PriceInfo
Product.get_priced_children(context, quantity=1)[source]

Get child products with price infos sorted by price.

Return type:list[(Product,PriceInfo)]
Returns:List of products and their price infos sorted from cheapest to most expensive.
Product.get_public_media()[source]
Product.get_shipping_mode_display(*moreargs, **morekwargs)
Product.get_shop_instance(shop)[source]
Return type:shoop.core.models.ShopProduct
Product.get_stock_behavior_display(*moreargs, **morekwargs)
Product.get_variation_siblings()[source]
Product.is_package_child()[source]
Product.is_package_parent()[source]
Product.is_stocked()[source]
Product.is_variation_child()[source]
Product.is_variation_parent()[source]
Product.keywords

Descriptor for translated attributes.

This attribute proxies all get/set calls to the translated model.

Product.link_to_parent(parent, variables=None, combination_hash=None)[source]
Parameters:
  • parent (Product) – The parent to link to.
  • variables (dict|None) – Optional dict of {variable identifier: value identifier} for complex variable linkage
  • combination_hash (str|None) – Optional combination hash (for variable variations), if precomputed. Mutually exclusive with variables
Product.log_entries
Product.make_package(package_def)[source]
Product.manufacturer
Product.media
Product.mode

A placeholder class that provides a way to set the attribute on the model.

Product.name

Descriptor for translated attributes.

This attribute proxies all get/set calls to the translated model.

Product.objects = <django.db.models.manager.ManagerFromProductQuerySet object>
Product.order_lines
Product.primary_image
Product.productfilter_set
Product.productsinbasketcondition_set
Product.sales_unit
Product.save(*args, **kwargs)[source]
Product.shipments
Product.shipping_mode

A placeholder class that provides a way to set the attribute on the model.

Product.shop_products
Product.simplify_variation()[source]

Remove variation variables from the given variation parent, turning it into a simple variation (or a normal product, if it has no children).

Parameters:product (shoop.core.models.Product) – Variation parent to not be variable any longer.
Product.slug

Descriptor for translated attributes.

This attribute proxies all get/set calls to the translated model.

Product.soft_delete(user=None)[source]
Product.status_text

Descriptor for translated attributes.

This attribute proxies all get/set calls to the translated model.

Product.stock_behavior

A placeholder class that provides a way to set the attribute on the model.

Product.storedbasket_set
Product.suppliedproduct_set
Product.tax_class
Product.translations
Product.type
Product.unlink_from_parent()[source]
Product.variation_children
Product.variation_name

Descriptor for translated attributes.

This attribute proxies all get/set calls to the translated model.

Product.variation_parent
Product.variation_result_subs
Product.variation_result_supers
Product.variation_variables
Product.verify_mode()[source]
class shoop.core.models.ProductAttribute(id, attribute, numeric_value, datetime_value, untranslated_string_value, product)

Bases: shoop.core.models._attributes.AppliedAttribute

exception DoesNotExist

Bases: django.core.exceptions.ObjectDoesNotExist

exception ProductAttribute.MultipleObjectsReturned

Bases: django.core.exceptions.MultipleObjectsReturned

ProductAttribute.attribute
ProductAttribute.objects = <parler.managers.TranslatableManager object>
ProductAttribute.product
ProductAttribute.translated_string_value

Descriptor for translated attributes.

This attribute proxies all get/set calls to the translated model.

ProductAttribute.translations
class shoop.core.models.ProductCrossSell(id, product1, product2, weight, type)

Bases: django.db.models.base.Model

exception DoesNotExist

Bases: django.core.exceptions.ObjectDoesNotExist

exception ProductCrossSell.MultipleObjectsReturned

Bases: django.core.exceptions.MultipleObjectsReturned

ProductCrossSell.get_type_display(*moreargs, **morekwargs)
ProductCrossSell.objects = <django.db.models.manager.Manager object>
ProductCrossSell.product1
ProductCrossSell.product2
ProductCrossSell.type

A placeholder class that provides a way to set the attribute on the model.

class shoop.core.models.ProductCrossSellType

Bases: enumfields.enums.Enum

An enumeration.

BOUGHT_WITH = <ProductCrossSellType.BOUGHT_WITH: 4>
COMPUTED = <ProductCrossSellType.COMPUTED: 3>
RECOMMENDED = <ProductCrossSellType.RECOMMENDED: 1>
RELATED = <ProductCrossSellType.RELATED: 2>
class shoop.core.models.ProductMedia(id, identifier, product, kind, file, external_url, ordering, enabled, public, purchased)

Bases: parler.models.TranslatableModel

exception DoesNotExist

Bases: django.core.exceptions.ObjectDoesNotExist

exception ProductMedia.MultipleObjectsReturned

Bases: django.core.exceptions.MultipleObjectsReturned

ProductMedia.description

Descriptor for translated attributes.

This attribute proxies all get/set calls to the translated model.

ProductMedia.easy_thumbnails_thumbnailer

Get Thumbnailer instance.

Will return None if file cannot be thumbnailed.

:rtype:easy_thumbnails.files.Thumbnailer|None

ProductMedia.effective_title
ProductMedia.file
ProductMedia.get_kind_display(*moreargs, **morekwargs)
ProductMedia.get_thumbnail(**kwargs)[source]

Get thumbnail for image

This will return None if there is no file or kind is not ProductMediaKind.IMAGE

Return type:easy_thumbnails.files.ThumbnailFile|None
ProductMedia.kind

A placeholder class that provides a way to set the attribute on the model.

ProductMedia.objects = <parler.managers.TranslatableManager object>
ProductMedia.primary_image_for_products
ProductMedia.primary_image_for_shop_products
ProductMedia.product
ProductMedia.shops
ProductMedia.title

Descriptor for translated attributes.

This attribute proxies all get/set calls to the translated model.

ProductMedia.translations
ProductMedia.url
class shoop.core.models.ProductMediaKind

Bases: enumfields.enums.Enum

An enumeration.

DOCUMENTATION = <ProductMediaKind.DOCUMENTATION: 3>
GENERIC_FILE = <ProductMediaKind.GENERIC_FILE: 1>
IMAGE = <ProductMediaKind.IMAGE: 2>
SAMPLE = <ProductMediaKind.SAMPLE: 4>
class shoop.core.models.ProductMode

Bases: enumfields.enums.Enum

An enumeration.

NORMAL = <ProductMode.NORMAL: 0>
PACKAGE_PARENT = <ProductMode.PACKAGE_PARENT: 1>
SIMPLE_VARIATION_PARENT = <ProductMode.SIMPLE_VARIATION_PARENT: 2>
VARIABLE_VARIATION_PARENT = <ProductMode.VARIABLE_VARIATION_PARENT: 3>
VARIATION_CHILD = <ProductMode.VARIATION_CHILD: 4>

Bases: django.db.models.base.Model

exception DoesNotExist

Bases: django.core.exceptions.ObjectDoesNotExist

exception ProductPackageLink.MultipleObjectsReturned

Bases: django.core.exceptions.MultipleObjectsReturned

ProductPackageLink.child
ProductPackageLink.objects = <django.db.models.manager.Manager object>
ProductPackageLink.parent
class shoop.core.models.ProductType(id, identifier)

Bases: parler.models.TranslatableModel

exception DoesNotExist

Bases: django.core.exceptions.ObjectDoesNotExist

exception ProductType.MultipleObjectsReturned

Bases: django.core.exceptions.MultipleObjectsReturned

ProductType.attributes
ProductType.name

Descriptor for translated attributes.

This attribute proxies all get/set calls to the translated model.

ProductType.objects = <parler.managers.TranslatableManager object>
ProductType.products
ProductType.producttypefilter_set
ProductType.translations
class shoop.core.models.ProductVariationLinkStatus

Bases: enumfields.enums.Enum

An enumeration.

INVISIBLE = <ProductVariationLinkStatus.INVISIBLE: 0>
VISIBLE = <ProductVariationLinkStatus.VISIBLE: 1>
class shoop.core.models.ProductVariationResult(id, product, combination_hash, result, status)

Bases: django.db.models.base.Model

exception DoesNotExist

Bases: django.core.exceptions.ObjectDoesNotExist

exception ProductVariationResult.MultipleObjectsReturned

Bases: django.core.exceptions.MultipleObjectsReturned

ProductVariationResult.get_status_display(*moreargs, **morekwargs)
ProductVariationResult.objects = <django.db.models.manager.Manager object>
ProductVariationResult.product
classmethod ProductVariationResult.resolve(parent_product, combination)[source]
ProductVariationResult.result
ProductVariationResult.status

A placeholder class that provides a way to set the attribute on the model.

class shoop.core.models.ProductVariationVariable(id, product, identifier)

Bases: parler.models.TranslatableModel

exception DoesNotExist

Bases: django.core.exceptions.ObjectDoesNotExist

exception ProductVariationVariable.MultipleObjectsReturned

Bases: django.core.exceptions.MultipleObjectsReturned

ProductVariationVariable.name

Descriptor for translated attributes.

This attribute proxies all get/set calls to the translated model.

ProductVariationVariable.objects = <parler.managers.TranslatableManager object>
ProductVariationVariable.product
ProductVariationVariable.translations
ProductVariationVariable.values
class shoop.core.models.ProductVariationVariableValue(id, variable, identifier)

Bases: parler.models.TranslatableModel

exception DoesNotExist

Bases: django.core.exceptions.ObjectDoesNotExist

exception ProductVariationVariableValue.MultipleObjectsReturned

Bases: django.core.exceptions.MultipleObjectsReturned

ProductVariationVariableValue.objects = <parler.managers.TranslatableManager object>
ProductVariationVariableValue.translations
ProductVariationVariableValue.value

Descriptor for translated attributes.

This attribute proxies all get/set calls to the translated model.

ProductVariationVariableValue.variable
class shoop.core.models.ProductVisibility

Bases: enumfields.enums.Enum

An enumeration.

VISIBLE_TO_ALL = <ProductVisibility.VISIBLE_TO_ALL: 1>
VISIBLE_TO_GROUPS = <ProductVisibility.VISIBLE_TO_GROUPS: 3>
VISIBLE_TO_LOGGED_IN = <ProductVisibility.VISIBLE_TO_LOGGED_IN: 2>
class shoop.core.models.RoundingMode

Bases: enumfields.enums.Enum

An enumeration.

ROUND_DOWN = <RoundingMode.ROUND_DOWN: 'ROUND_DOWN'>
ROUND_HALF_DOWN = <RoundingMode.ROUND_HALF_DOWN: 'ROUND_HALF_DOWN'>
ROUND_HALF_UP = <RoundingMode.ROUND_HALF_UP: 'ROUND_HALF_UP'>
ROUND_UP = <RoundingMode.ROUND_UP: 'ROUND_UP'>
class shoop.core.models.RoundingBehaviorComponent(id, polymorphic_ctype, servicebehaviorcomponent_ptr, quant, mode)

Bases: shoop.core.models.ServiceBehaviorComponent

exception DoesNotExist

Bases: shoop.core.models._service_base.DoesNotExist

exception RoundingBehaviorComponent.MultipleObjectsReturned

Bases: shoop.core.models._service_base.MultipleObjectsReturned

RoundingBehaviorComponent.base_objects = <django.db.models.manager.Manager object>
RoundingBehaviorComponent.get_costs(service, source)[source]
RoundingBehaviorComponent.get_mode_display(*moreargs, **morekwargs)
RoundingBehaviorComponent.help_text = <django.utils.functional.lazy.<locals>.__proxy__ object>
RoundingBehaviorComponent.mode

A placeholder class that provides a way to set the attribute on the model.

RoundingBehaviorComponent.name = <django.utils.functional.lazy.<locals>.__proxy__ object>
RoundingBehaviorComponent.objects = <polymorphic.managers.PolymorphicManager object>
RoundingBehaviorComponent.polymorphic_primary_key_name = 'id'
RoundingBehaviorComponent.polymorphic_super_sub_accessors_replaced = False
RoundingBehaviorComponent.servicebehaviorcomponent_ptr
class shoop.core.models.SalesUnit(id, identifier, decimals)

Bases: parler.models.TranslatableModel

exception DoesNotExist

Bases: django.core.exceptions.ObjectDoesNotExist

exception SalesUnit.MultipleObjectsReturned

Bases: django.core.exceptions.MultipleObjectsReturned

SalesUnit.allow_fractions
SalesUnit.name

Descriptor for translated attributes.

This attribute proxies all get/set calls to the translated model.

SalesUnit.objects = <parler.managers.TranslatableManager object>
SalesUnit.product_set
SalesUnit.quantity_step

Get the quantity increment for the amount of decimals this unit allows.

For 0 decimals, this will be 1; for 1 decimal, 0.1; etc.

Returns:Decimal in (0..1]
Return type:Decimal
SalesUnit.round(value)[source]
SalesUnit.short_name

Descriptor for translated attributes.

This attribute proxies all get/set calls to the translated model.

SalesUnit.translations
class shoop.core.models.SavedAddress(*args, **kwargs)

Bases: shoop.core.models.ShoopModel

Model for saving multiple addresses in an ‘address book’ of sorts.

exception DoesNotExist

Bases: django.core.exceptions.ObjectDoesNotExist

exception SavedAddress.MultipleObjectsReturned

Bases: django.core.exceptions.MultipleObjectsReturned

SavedAddress.address
SavedAddress.get_role_display(*moreargs, **morekwargs)
SavedAddress.get_status_display(*moreargs, **morekwargs)
SavedAddress.get_title()[source]

Returns the display title for this SavedAddress instance. Defaults to a short representation of the address.

This method should be used instead of accessing the title field directly when displaying SavedAddress objects.

SavedAddress.objects = <shoop.core.models._addresses.SavedAddressManager object>
SavedAddress.owner
SavedAddress.role

A placeholder class that provides a way to set the attribute on the model.

SavedAddress.status

A placeholder class that provides a way to set the attribute on the model.

class shoop.core.models.SavedAddressRole

Bases: enumfields.enums.Enum

An enumeration.

BILLING = <SavedAddressRole.BILLING: 2>
SHIPPING = <SavedAddressRole.SHIPPING: 1>
class shoop.core.models.SavedAddressStatus

Bases: enumfields.enums.Enum

An enumeration.

DISABLED = <SavedAddressStatus.DISABLED: 0>
ENABLED = <SavedAddressStatus.ENABLED: 1>
class shoop.core.models.Service(*args, **kwargs)

Bases: shoop.core.models.TranslatableShoopModel

Abstract base model for services.

Each enabled service should be linked to a service provider and should have a choice identifier specified in its choice_identifier field. The choice identifier should be valid for the service provider, i.e. it should be one of the ServiceChoice.identifier values returned by the ServiceProvider.get_service_choices method.

class Meta[source]

Bases: object

abstract = False
Service.behavior_components
Service.description

Descriptor for translated attributes.

This attribute proxies all get/set calls to the translated model.

Service.get_costs(source)[source]

Get costs of this service for items in given source.

Returns:description, price and tax class of the costs
Return type:Iterable[ServiceCost]
Service.get_effective_name(source)[source]

Get effective name of the service for given order source.

By default, effective name is the same as name of this service, but if there is a service provider with a custom implementation for get_effective_name method, then this can be different.

Return type:str
Service.get_lines(source)[source]

Get lines for given source.

Lines are created based on costs. Costs without description are combined to single line.

Return type:Iterable[shoop.core.order_creator.SourceLine]
Service.get_total_cost(source)[source]

Get total cost of this service for items in given source.

Return type:PriceInfo
Service.get_unavailability_reasons(source)[source]

Get reasons of being unavailable for given source.

Return type:Iterable[ValidationError]
Service.is_available_for(source)[source]

Return true if service is available for given source.

Return type:bool
Service.name

Descriptor for translated attributes.

This attribute proxies all get/set calls to the translated model.

Service.objects
Service.old_module_data

A placeholder class that provides a way to set the attribute on the model.

Service.provider
Return type:shoop.core.models.ServiceProvider
Service.shop
Service.tax_class
class shoop.core.models.ServiceBehaviorComponent(id, polymorphic_ctype)

Bases: shoop.core.models.PolymorphicShoopModel

exception DoesNotExist

Bases: django.core.exceptions.ObjectDoesNotExist

exception ServiceBehaviorComponent.MultipleObjectsReturned

Bases: django.core.exceptions.MultipleObjectsReturned

ServiceBehaviorComponent.base_objects = <django.db.models.manager.Manager object>
ServiceBehaviorComponent.expensiveswedenbehaviorcomponent
ServiceBehaviorComponent.fixedcostbehaviorcomponent
ServiceBehaviorComponent.get_costs(service, source)[source]

Return costs for for this object. This should be implemented in subclass. This method is used to calculate price for ShippingMethod and PaymentMethod objects.

Return type:Iterable[ServiceCost]
ServiceBehaviorComponent.get_delivery_time(service, source)[source]
Return type:shoop.utils.dates.DurationRange|None
ServiceBehaviorComponent.get_unavailability_reasons(service, source)[source]
Return type:Iterable[ValidationError]
ServiceBehaviorComponent.groupavailabilitybehaviorcomponent
ServiceBehaviorComponent.help_text = None
ServiceBehaviorComponent.name = None
ServiceBehaviorComponent.objects = <polymorphic.managers.PolymorphicManager object>
ServiceBehaviorComponent.paymentmethod_set
ServiceBehaviorComponent.polymorphic_ctype
ServiceBehaviorComponent.polymorphic_primary_key_name = 'id'
ServiceBehaviorComponent.polymorphic_super_sub_accessors_replaced = False
ServiceBehaviorComponent.roundingbehaviorcomponent
ServiceBehaviorComponent.shippingmethod_set
ServiceBehaviorComponent.staffonlybehaviorcomponent
ServiceBehaviorComponent.waivingcostbehaviorcomponent
ServiceBehaviorComponent.weightbasedpricingbehaviorcomponent
ServiceBehaviorComponent.weightlimitsbehaviorcomponent
class shoop.core.models.ServiceChoice(identifier, name)

Bases: object

Choice of service provided by a service provider.

Initialize service choice.

Parameters:
  • identifier (str) – Internal identifier for the service. Should be unique within a single ServiceProvider.
  • name (str) – Descriptive name of the service in currently active language.
class shoop.core.models.ServiceCost(price, description=None, tax_class=None, base_price=None)

Bases: object

A cost of a service.

One service might have several costs.

Initialize cost from values.

Note: If tax_class is specified, also description must be given.

price_info
class shoop.core.models.ServiceProvider(*args, **kwargs)

Bases: shoop.core.models.PolymorphicTranslatableShoopModel

Entity that provides services.

Good examples of service providers are Carrier and PaymentProcessor.

When subclassing ServiceProvider, set value for service_model class attribute. It should be a model class which is subclass of Service.

Replace Django’s inheritance accessor member functions for our model (self.__class__) with our own versions. We monkey patch them until a patch can be added to Django (which would probably be very small and make all of this obsolete).

If we have inheritance of the form ModelA -> ModelB ->ModelC then Django creates accessors like this: - ModelA: modelb - ModelB: modela_ptr, modelb, modelc - ModelC: modela_ptr, modelb, modelb_ptr, modelc

These accessors allow Django (and everyone else) to travel up and down the inheritance tree for the db object at hand.

The original Django accessors use our polymorphic manager. But they should not. So we replace them with our own accessors that use our appropriate base_objects manager.

exception DoesNotExist

Bases: django.core.exceptions.ObjectDoesNotExist

exception ServiceProvider.MultipleObjectsReturned

Bases: django.core.exceptions.MultipleObjectsReturned

ServiceProvider.base_objects = <parler.managers.TranslatableManager object>
ServiceProvider.base_translations
ServiceProvider.carrier
ServiceProvider.create_service(choice_identifier, **kwargs)[source]

Create a service for given choice identifier.

Subclass implementation may attach some behavior components to the created service.

Subclasses should provide implementation for _create_service or override this. Base class implementation calls the _create_service method with resolved choice_identifier.

Parameters:choice_identifier (str|None) – Identifier of the service choice to use. If None, use the default service choice.
Return type:shoop.core.models.Service
ServiceProvider.get_effective_name(service, source)[source]

Get effective name of the service for given order source.

Base class implementation will just return name of the given service, but that may be changed in a subclass.

Return type:str
ServiceProvider.get_service_choices()[source]

Get all service choices of this provider.

Subclasses should implement this method.

Return type:list[ServiceChoice]
ServiceProvider.name

Descriptor for translated attributes.

This attribute proxies all get/set calls to the translated model.

ServiceProvider.objects = <shoop.core.models._base._PolyTransManager object>
ServiceProvider.paymentprocessor
ServiceProvider.polymorphic_ctype
ServiceProvider.polymorphic_primary_key_name = 'id'
ServiceProvider.polymorphic_super_sub_accessors_replaced = False
ServiceProvider.service_model = None
class shoop.core.models.Shipment(id, order, supplier, created_on, status, tracking_code, description, volume, weight, identifier)

Bases: django.db.models.base.Model

exception DoesNotExist

Bases: django.core.exceptions.ObjectDoesNotExist

exception Shipment.MultipleObjectsReturned

Bases: django.core.exceptions.MultipleObjectsReturned

Shipment.cache_values()[source]

(Re)cache volume and weight for this Shipment from the ShipmentProducts within.

Shipment.get_next_by_created_on(*moreargs, **morekwargs)
Shipment.get_previous_by_created_on(*moreargs, **morekwargs)
Shipment.get_status_display(*moreargs, **morekwargs)
Shipment.objects = <django.db.models.manager.Manager object>
Shipment.order
Shipment.products
Shipment.save(*args, **kwargs)[source]
Shipment.status

A placeholder class that provides a way to set the attribute on the model.

Shipment.supplier
Shipment.total_products
class shoop.core.models.ShipmentProduct(id, shipment, product, quantity, unit_volume, unit_weight)

Bases: django.db.models.base.Model

exception DoesNotExist

Bases: django.core.exceptions.ObjectDoesNotExist

exception ShipmentProduct.MultipleObjectsReturned

Bases: django.core.exceptions.MultipleObjectsReturned

ShipmentProduct.cache_values()[source]
ShipmentProduct.objects = <django.db.models.manager.Manager object>
ShipmentProduct.product
ShipmentProduct.shipment
class shoop.core.models.ShippingMethod(id, identifier, enabled, shop, choice_identifier, old_module_identifier, old_module_data, logo, tax_class, carrier)

Bases: shoop.core.models.Service

exception DoesNotExist

Bases: django.core.exceptions.ObjectDoesNotExist

exception ShippingMethod.MultipleObjectsReturned

Bases: django.core.exceptions.MultipleObjectsReturned

ShippingMethod.behavior_components
ShippingMethod.can_delete()[source]
ShippingMethod.carrier
ShippingMethod.contact_set
ShippingMethod.description

Descriptor for translated attributes.

This attribute proxies all get/set calls to the translated model.

ShippingMethod.get_shipping_time(source)[source]

Get shipping time for items in given source.

Return type:shoop.utils.dates.DurationRange|None
ShippingMethod.line_type = <OrderLineType.SHIPPING: 2>
ShippingMethod.name

Descriptor for translated attributes.

This attribute proxies all get/set calls to the translated model.

ShippingMethod.objects = <django.db.models.manager.ManagerFromServiceQuerySet object>
ShippingMethod.old_module_data

A placeholder class that provides a way to set the attribute on the model.

ShippingMethod.provider_attr = 'carrier'
ShippingMethod.shipping_orders
ShippingMethod.shipping_products
ShippingMethod.shop
ShippingMethod.shop_product_m2m = 'shipping_methods'
ShippingMethod.tax_class
ShippingMethod.translations
class shoop.core.models.ShippingMode

Bases: enumfields.enums.Enum

An enumeration.

NOT_SHIPPED = <ShippingMode.NOT_SHIPPED: 0>
SHIPPED = <ShippingMode.SHIPPED: 1>
class shoop.core.models.ShippingStatus

Bases: enumfields.enums.Enum

An enumeration.

FULLY_SHIPPED = <ShippingStatus.FULLY_SHIPPED: 2>
NOT_SHIPPED = <ShippingStatus.NOT_SHIPPED: 0>
PARTIALLY_SHIPPED = <ShippingStatus.PARTIALLY_SHIPPED: 1>
class shoop.core.models.ShoopModel(*args, **kwargs)

Bases: django.db.models.base.Model

Shoop Model.

class Meta[source]

Bases: object

abstract = False
ShoopModel.identifier_attr = 'identifier'
class shoop.core.models.Shop(id, identifier, domain, status, owner, options, currency, prices_include_tax, logo, maintenance_mode, contact_address)

Bases: shoop.core.models._base.ChangeProtected, shoop.core.models.TranslatableShoopModel

exception DoesNotExist

Bases: django.core.exceptions.ObjectDoesNotExist

exception Shop.MultipleObjectsReturned

Bases: django.core.exceptions.MultipleObjectsReturned

Shop.basketcampaign_set
Shop.catalogcampaign_set
Shop.categories
Shop.cgpprice_set
Shop.change_protect_message = <django.utils.functional.lazy.<locals>.__proxy__ object>
Shop.contact_address
Shop.create_price(value)[source]

Create a price with given value and settings of this shop.

Takes the prices_include_tax and currency settings of this Shop into account.

Return type:shoop.core.pricing.Price
Shop.get_status_display(*moreargs, **morekwargs)
Shop.maintenance_message

Descriptor for translated attributes.

This attribute proxies all get/set calls to the translated model.

Shop.name

Descriptor for translated attributes.

This attribute proxies all get/set calls to the translated model.

Shop.objects = <parler.managers.TranslatableManager object>
Shop.options

A placeholder class that provides a way to set the attribute on the model.

Shop.order_set
Shop.owner
Shop.paymentmethod_set
Shop.product_media
Shop.protected_fields = ['currency', 'prices_include_tax']
Shop.public_name

Descriptor for translated attributes.

This attribute proxies all get/set calls to the translated model.

Shop.shippingmethod_set
Shop.shop_products
Shop.status

A placeholder class that provides a way to set the attribute on the model.

Shop.storedbasket_set
Shop.translations
class shoop.core.models.ShopProduct(id, shop, product, visible, listed, purchasable, searchable, visibility_limit, purchase_multiple, minimum_purchase_quantity, limit_shipping_methods, limit_payment_methods, primary_category, shop_primary_image, default_price_value, minimum_price_value)

Bases: shoop.utils.properties.MoneyPropped, django.db.models.base.Model

exception DoesNotExist

Bases: django.core.exceptions.ObjectDoesNotExist

exception ShopProduct.MultipleObjectsReturned

Bases: django.core.exceptions.MultipleObjectsReturned

ShopProduct.categories
ShopProduct.default_price

Property for Price object.

Similar to MoneyProperty but also has includes_tax field.

Operaters with TaxfulPrice and TaxlessPrice objects.

ShopProduct.get_orderability_errors(supplier, quantity, customer, ignore_minimum=False)[source]

Yield ValidationErrors that would cause this product to not be orderable.

Parameters:
  • supplier (shoop.core.models.Supplier) – Supplier to order this product from. May be None.
  • quantity (int|Decimal) – Quantity to order.
  • customer (shoop.core.models.Contact) – Customer contact.
  • ignore_minimum (bool) – Ignore any limitations caused by quantity minimums.
Returns:

Iterable[ValidationError]

ShopProduct.get_visibility_errors(customer)[source]
ShopProduct.get_visibility_limit_display(*moreargs, **morekwargs)
ShopProduct.images
ShopProduct.is_list_visible()[source]

Return True if this product should be visible in listings in general, without taking into account any other visibility limitations. :rtype: bool

ShopProduct.is_orderable(supplier, customer, quantity)[source]
ShopProduct.is_visible(customer)[source]
ShopProduct.minimum_price

Property for Price object.

Similar to MoneyProperty but also has includes_tax field.

Operaters with TaxfulPrice and TaxlessPrice objects.

ShopProduct.objects = <django.db.models.manager.Manager object>
ShopProduct.payment_methods
ShopProduct.primary_category
ShopProduct.primary_image
ShopProduct.product
ShopProduct.quantity_step

Quantity step for purchasing this product.

Return type:decimal.Decimal
Example:
<input type=”number” step=”{{ shop_product.quantity_step }}”>
ShopProduct.raise_if_not_orderable(supplier, customer, quantity, ignore_minimum=False)[source]
ShopProduct.raise_if_not_visible(customer)[source]
ShopProduct.rounded_minimum_purchase_quantity

The minimum purchase quantity, rounded to the sales unit’s precision.

Return type:decimal.Decimal
Example:
<input type=”number”
min=”{{ shop_product.rounded_minimum_purchase_quantity }}” value=”{{ shop_product.rounded_minimum_purchase_quantity }}”>
ShopProduct.save(*args, **kwargs)[source]
ShopProduct.shipping_methods
ShopProduct.shop
ShopProduct.shop_primary_image
ShopProduct.suppliers
ShopProduct.visibility_groups
ShopProduct.visibility_limit

A placeholder class that provides a way to set the attribute on the model.

class shoop.core.models.ShopStatus

Bases: enumfields.enums.Enum

An enumeration.

DISABLED = <ShopStatus.DISABLED: 0>
ENABLED = <ShopStatus.ENABLED: 1>
class shoop.core.models.StaffOnlyBehaviorComponent(id, polymorphic_ctype, servicebehaviorcomponent_ptr)

Bases: shoop.core.models.ServiceBehaviorComponent

exception DoesNotExist

Bases: shoop.core.models._service_base.DoesNotExist

exception StaffOnlyBehaviorComponent.MultipleObjectsReturned

Bases: shoop.core.models._service_base.MultipleObjectsReturned

StaffOnlyBehaviorComponent.base_objects = <django.db.models.manager.Manager object>
StaffOnlyBehaviorComponent.get_unavailability_reasons(service, source)[source]
StaffOnlyBehaviorComponent.help_text = <django.utils.functional.lazy.<locals>.__proxy__ object>
StaffOnlyBehaviorComponent.name = <django.utils.functional.lazy.<locals>.__proxy__ object>
StaffOnlyBehaviorComponent.objects = <polymorphic.managers.PolymorphicManager object>
StaffOnlyBehaviorComponent.polymorphic_primary_key_name = 'id'
StaffOnlyBehaviorComponent.polymorphic_super_sub_accessors_replaced = False
StaffOnlyBehaviorComponent.servicebehaviorcomponent_ptr
class shoop.core.models.StockBehavior

Bases: enumfields.enums.Enum

An enumeration.

STOCKED = <StockBehavior.STOCKED: 1>
UNSTOCKED = <StockBehavior.UNSTOCKED: 0>
class shoop.core.models.SuppliedProduct(id, supplier, product, sku, alert_limit, physical_count, logical_count)

Bases: django.db.models.base.Model

exception DoesNotExist

Bases: django.core.exceptions.ObjectDoesNotExist

exception SuppliedProduct.MultipleObjectsReturned

Bases: django.core.exceptions.MultipleObjectsReturned

SuppliedProduct.objects = <django.db.models.manager.Manager object>
SuppliedProduct.product
SuppliedProduct.supplier
class shoop.core.models.Supplier(id, identifier, name, type, stock_managed, module_identifier, module_data)

Bases: shoop.core.modules.interface.ModuleInterface, shoop.core.models.ShoopModel

exception DoesNotExist

Bases: django.core.exceptions.ObjectDoesNotExist

exception Supplier.MultipleObjectsReturned

Bases: django.core.exceptions.MultipleObjectsReturned

Supplier.adjust_stock(product_id, delta, created_by=None)[source]
Supplier.default_module_spec = 'shoop.core.suppliers:BaseSupplierModule'
Supplier.get_orderability_errors(shop_product, quantity, customer)[source]
Parameters:
Return type:

iterable[ValidationError]

Supplier.get_stock_status(product_id)[source]
Parameters:product_id (int) – Product ID
Return type:shoop.core.stocks.ProductStockStatus
Supplier.get_stock_statuses(product_ids)[source]
Parameters:product_ids – Iterable of product IDs
Returns:Dict of {product_id: ProductStockStatus}
Return type:dict[int, shoop.core.stocks.ProductStockStatus]
Supplier.get_suppliable_products(shop, customer)[source]
Parameters:
Return type:

list[int]

Supplier.get_type_display(*moreargs, **morekwargs)
Supplier.module_data

A placeholder class that provides a way to set the attribute on the model.

Supplier.module_provides_key = 'supplier_module'
Supplier.objects = <django.db.models.manager.Manager object>
Supplier.order_lines
Supplier.shipments
Supplier.shop_products
Supplier.stockadjustment_set
Supplier.stockcount_set
Supplier.suppliedproduct_set
Supplier.type

A placeholder class that provides a way to set the attribute on the model.

Supplier.update_stock(product_id)[source]
Supplier.update_stocks(product_ids)[source]
class shoop.core.models.SupplierType

Bases: enumfields.enums.Enum

An enumeration.

EXTERNAL = <SupplierType.EXTERNAL: 2>
INTERNAL = <SupplierType.INTERNAL: 1>
class shoop.core.models.Tax(id, code, rate, amount_value, currency, enabled)

Bases: shoop.utils.properties.MoneyPropped, shoop.core.models._base.ChangeProtected, shoop.core.models.TranslatableShoopModel

exception DoesNotExist

Bases: django.core.exceptions.ObjectDoesNotExist

exception Tax.MultipleObjectsReturned

Bases: django.core.exceptions.MultipleObjectsReturned

Tax.amount

Property for a Money amount.

Will return Money objects when the property is being get and accepts Money objects on set. Value and currency are read/written from/to other fields.

Fields are given as locators, that is a string in dotted format, e.g. locator "foo.bar" points to instance.foo.bar where instance is an instance of the class owning the MoneyProperty.

Setting value of this property to a Money object with different currency that is currently set (in the field pointed by the currency locator), will raise an UnitMixupError.

Tax.calculate_amount(base_amount)[source]

Calculate tax amount with this tax for given base amount.

Return type:shoop.utils.money.Money
Tax.change_protect_message = <django.utils.functional.lazy.<locals>.__proxy__ object>
Tax.clean()[source]
Tax.identifier_attr = 'code'
Tax.name

Descriptor for translated attributes.

This attribute proxies all get/set calls to the translated model.

Tax.objects = <parler.managers.TranslatableManager object>
Tax.order_line_taxes
Tax.taxrule_set
Tax.translations
Tax.unprotected_fields = ['enabled']
class shoop.core.models.TaxClass(id, identifier, enabled)

Bases: shoop.core.models.TranslatableShoopModel

exception DoesNotExist

Bases: django.core.exceptions.ObjectDoesNotExist

exception TaxClass.MultipleObjectsReturned

Bases: django.core.exceptions.MultipleObjectsReturned

TaxClass.name

Descriptor for translated attributes.

This attribute proxies all get/set calls to the translated model.

TaxClass.objects = <parler.managers.TranslatableManager object>
TaxClass.paymentmethod_set
TaxClass.product_set
TaxClass.shippingmethod_set
TaxClass.taxrule_set
TaxClass.translations
class shoop.core.models.TranslatableShoopModel(*args, **kwargs)

Bases: shoop.core.models.ShoopModel, parler.models.TranslatableModel

class Meta[source]

Bases: object

abstract = False
TranslatableShoopModel.name_attr = 'name'
TranslatableShoopModel.objects
class shoop.core.models.WaivingCostBehaviorComponent(id, polymorphic_ctype, servicebehaviorcomponent_ptr, price_value, waive_limit_value)

Bases: shoop.core.models._service_base.TranslatableServiceBehaviorComponent

exception DoesNotExist

Bases: django.core.exceptions.ObjectDoesNotExist

exception WaivingCostBehaviorComponent.MultipleObjectsReturned

Bases: django.core.exceptions.MultipleObjectsReturned

WaivingCostBehaviorComponent.base_objects = <parler.managers.TranslatableManager object>
WaivingCostBehaviorComponent.description

Descriptor for translated attributes.

This attribute proxies all get/set calls to the translated model.

WaivingCostBehaviorComponent.get_costs(service, source)[source]
WaivingCostBehaviorComponent.help_text = <django.utils.functional.lazy.<locals>.__proxy__ object>
WaivingCostBehaviorComponent.name = <django.utils.functional.lazy.<locals>.__proxy__ object>
WaivingCostBehaviorComponent.objects = <shoop.core.models._base._PolyTransManager object>
WaivingCostBehaviorComponent.polymorphic_primary_key_name = 'id'
WaivingCostBehaviorComponent.polymorphic_super_sub_accessors_replaced = False
WaivingCostBehaviorComponent.servicebehaviorcomponent_ptr
WaivingCostBehaviorComponent.translations
class shoop.core.models.WeightBasedPriceRange(id, component, min_value, max_value, price_value)

Bases: parler.models.TranslatableModel

exception DoesNotExist

Bases: django.core.exceptions.ObjectDoesNotExist

exception WeightBasedPriceRange.MultipleObjectsReturned

Bases: django.core.exceptions.MultipleObjectsReturned

WeightBasedPriceRange.component
WeightBasedPriceRange.description

Descriptor for translated attributes.

This attribute proxies all get/set calls to the translated model.

WeightBasedPriceRange.matches_to_value(value)[source]
WeightBasedPriceRange.objects = <parler.managers.TranslatableManager object>
WeightBasedPriceRange.translations
class shoop.core.models.WeightBasedPricingBehaviorComponent(id, polymorphic_ctype, servicebehaviorcomponent_ptr)

Bases: shoop.core.models.ServiceBehaviorComponent

exception DoesNotExist

Bases: shoop.core.models._service_base.DoesNotExist

exception WeightBasedPricingBehaviorComponent.MultipleObjectsReturned

Bases: shoop.core.models._service_base.MultipleObjectsReturned

WeightBasedPricingBehaviorComponent.base_objects = <django.db.models.manager.Manager object>
WeightBasedPricingBehaviorComponent.get_costs(service, source)[source]
WeightBasedPricingBehaviorComponent.get_unavailability_reasons(service, source)[source]
WeightBasedPricingBehaviorComponent.help_text = <django.utils.functional.lazy.<locals>.__proxy__ object>
WeightBasedPricingBehaviorComponent.name = <django.utils.functional.lazy.<locals>.__proxy__ object>
WeightBasedPricingBehaviorComponent.objects = <polymorphic.managers.PolymorphicManager object>
WeightBasedPricingBehaviorComponent.polymorphic_primary_key_name = 'id'
WeightBasedPricingBehaviorComponent.polymorphic_super_sub_accessors_replaced = False
WeightBasedPricingBehaviorComponent.ranges
WeightBasedPricingBehaviorComponent.servicebehaviorcomponent_ptr
class shoop.core.models.WeightLimitsBehaviorComponent(id, polymorphic_ctype, servicebehaviorcomponent_ptr, min_weight, max_weight)

Bases: shoop.core.models.ServiceBehaviorComponent

exception DoesNotExist

Bases: shoop.core.models._service_base.DoesNotExist

exception WeightLimitsBehaviorComponent.MultipleObjectsReturned

Bases: shoop.core.models._service_base.MultipleObjectsReturned

WeightLimitsBehaviorComponent.base_objects = <django.db.models.manager.Manager object>
WeightLimitsBehaviorComponent.get_unavailability_reasons(service, source)[source]
WeightLimitsBehaviorComponent.help_text = <django.utils.functional.lazy.<locals>.__proxy__ object>
WeightLimitsBehaviorComponent.name = <django.utils.functional.lazy.<locals>.__proxy__ object>
WeightLimitsBehaviorComponent.objects = <polymorphic.managers.PolymorphicManager object>
WeightLimitsBehaviorComponent.polymorphic_primary_key_name = 'id'
WeightLimitsBehaviorComponent.polymorphic_super_sub_accessors_replaced = False
WeightLimitsBehaviorComponent.servicebehaviorcomponent_ptr