shuup.simple_supplier package¶
Subpackages¶
Submodules¶
shuup.simple_supplier.forms module¶
-
class
shuup.simple_supplier.forms.
StockAdjustmentForm
(*args, **kwargs)[source]¶ Bases:
django.forms.forms.Form
-
base_fields
= OrderedDict([('purchase_price', <django.forms.fields.DecimalField object>), ('delta', <django.forms.fields.DecimalField object>)])¶
-
declared_fields
= OrderedDict([('purchase_price', <django.forms.fields.DecimalField object>), ('delta', <django.forms.fields.DecimalField object>)])¶
-
media
¶
-
-
class
shuup.simple_supplier.forms.
AlertLimitForm
(data=None, files=None, auto_id='id_%s', prefix=None, initial=None, error_class=<class 'django.forms.utils.ErrorList'>, label_suffix=None, empty_permitted=False, field_order=None, use_required_attribute=None, renderer=None)[source]¶ Bases:
django.forms.forms.Form
-
base_fields
= OrderedDict([('alert_limit', <django.forms.fields.DecimalField object>)])¶
-
declared_fields
= OrderedDict([('alert_limit', <django.forms.fields.DecimalField object>)])¶
-
media
¶
-
-
class
shuup.simple_supplier.forms.
StockManagedForm
(data=None, files=None, auto_id='id_%s', prefix=None, initial=None, error_class=<class 'django.forms.utils.ErrorList'>, label_suffix=None, empty_permitted=False, field_order=None, use_required_attribute=None, renderer=None)[source]¶ Bases:
django.forms.forms.Form
-
base_fields
= OrderedDict([('stock_managed', <django.forms.fields.BooleanField object>)])¶
-
declared_fields
= OrderedDict([('stock_managed', <django.forms.fields.BooleanField object>)])¶
-
media
¶
-
shuup.simple_supplier.models module¶
-
class
shuup.simple_supplier.models.
StockAdjustment
(id, product, supplier, created_on, created_by, delta, purchase_price_value, type)[source]¶ Bases:
django.db.models.base.Model
Parameters: - id (AutoField) – Id
- product (ForeignKey to
shuup.core.models.Product
) – Product - supplier (ForeignKey to
shuup.core.models.Supplier
) – Supplier - created_on (DateTimeField) – Created on
- created_by (ForeignKey to
django.contrib.auth.models.User
) – Created by - delta (QuantityField) – Delta
- purchase_price_value (MoneyValueField) – Purchase price value
- type (EnumIntegerField) – Type
-
product
¶ Accessor to the related object on the forward side of a many-to-one or one-to-one (via ForwardOneToOneDescriptor subclass) relation.
In the example:
class Child(Model): parent = ForeignKey(Parent, related_name='children')
Child.parent
is aForwardManyToOneDescriptor
instance.
-
supplier
¶ Accessor to the related object on the forward side of a many-to-one or one-to-one (via ForwardOneToOneDescriptor subclass) relation.
In the example:
class Child(Model): parent = ForeignKey(Parent, related_name='children')
Child.parent
is aForwardManyToOneDescriptor
instance.
-
created_on
¶ A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
-
created_by
¶ Accessor to the related object on the forward side of a many-to-one or one-to-one (via ForwardOneToOneDescriptor subclass) relation.
In the example:
class Child(Model): parent = ForeignKey(Parent, related_name='children')
Child.parent
is aForwardManyToOneDescriptor
instance.
-
delta
¶ A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
-
purchase_price_value
¶ A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
-
purchase_price
¶ Property for Price object.
Similar to
MoneyProperty
, but also hasincludes_tax
field.Operaters with
TaxfulPrice
andTaxlessPrice
objects.
-
type
¶ A property descriptor which ensures that
field.to_python()
is called on _every_ assignment to the field.This used to be provided by the
django.db.models.subclassing.Creator
class, which in turn was used by the deprecated-in-Django-1.10SubfieldBase
class, hence the reimplementation here.
-
currency
¶
-
includes_tax
¶
-
exception
DoesNotExist
¶ Bases:
django.core.exceptions.ObjectDoesNotExist
-
exception
MultipleObjectsReturned
¶ Bases:
django.core.exceptions.MultipleObjectsReturned
-
created_by_id
¶ A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
-
get_next_by_created_on
(*, field=<django.db.models.fields.DateTimeField: created_on>, is_next=True, **kwargs)¶
-
get_previous_by_created_on
(*, field=<django.db.models.fields.DateTimeField: created_on>, is_next=False, **kwargs)¶
-
get_type_display
(*, field=<enumfields.fields.EnumIntegerField: type>)¶
-
id
¶ A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
-
objects
= <django.db.models.manager.Manager object>¶
-
product_id
¶ A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
-
supplier_id
¶ A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
-
class
shuup.simple_supplier.models.
StockCount
(id, alert_limit, stock_managed, product, supplier, logical_count, physical_count, stock_value_value)[source]¶ Bases:
django.db.models.base.Model
Parameters: - id (AutoField) – Id
- alert_limit (QuantityField) – Alert limit
- stock_managed (BooleanField) – Use this to override the supplier default stock behavior per product.
- product (ForeignKey to
shuup.core.models.Product
) – Product - supplier (ForeignKey to
shuup.core.models.Supplier
) – Supplier - logical_count (QuantityField) – Logical count
- physical_count (QuantityField) – Physical count
- stock_value_value (MoneyValueField) – Stock value value
-
alert_limit
¶ A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
-
stock_managed
¶ A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
-
product
¶ Accessor to the related object on the forward side of a many-to-one or one-to-one (via ForwardOneToOneDescriptor subclass) relation.
In the example:
class Child(Model): parent = ForeignKey(Parent, related_name='children')
Child.parent
is aForwardManyToOneDescriptor
instance.
-
supplier
¶ Accessor to the related object on the forward side of a many-to-one or one-to-one (via ForwardOneToOneDescriptor subclass) relation.
In the example:
class Child(Model): parent = ForeignKey(Parent, related_name='children')
Child.parent
is aForwardManyToOneDescriptor
instance.
-
logical_count
¶ A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
-
physical_count
¶ A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
-
stock_value_value
¶ A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
-
stock_value
¶ Property for Price object.
Similar to
MoneyProperty
, but also hasincludes_tax
field.Operaters with
TaxfulPrice
andTaxlessPrice
objects.
-
stock_unit_price
¶ Property for Price object.
Similar to
MoneyProperty
, but also hasincludes_tax
field.Operaters with
TaxfulPrice
andTaxlessPrice
objects.
-
currency
¶
-
includes_tax
¶
-
stock_unit_price_value
¶
-
exception
DoesNotExist
¶ Bases:
django.core.exceptions.ObjectDoesNotExist
-
exception
MultipleObjectsReturned
¶ Bases:
django.core.exceptions.MultipleObjectsReturned
-
id
¶ A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
-
objects
= <django.db.models.manager.Manager object>¶
-
product_id
¶ A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
-
supplier_id
¶ A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
shuup.simple_supplier.module module¶
-
class
shuup.simple_supplier.module.
SimpleSupplierModule
[source]¶ Bases:
shuup.core.suppliers.base.BaseSupplierModule
-
identifier
= 'simple_supplier'¶
-
name
= 'Simple Supplier'¶
-
get_orderability_errors
(shop_product, quantity, customer, *args, **kwargs)[source]¶ Parameters: - shop_product (shuup.core.models.ShopProduct) – Shop Product.
- quantity (decimal.Decimal) – Quantity to order.
- customer – Contact.
Return type: iterable[ValidationError]
-
adjust_stock
(product_id, delta, purchase_price=0, created_by=None, type=<StockAdjustmentType.INVENTORY: 1>, *args, **kwargs)[source]¶
-
update_stock
(product_id, *args, **kwargs)[source]¶ Supplier module update stock should always bump product cache and send
shuup.core.signals.stocks_updated
signal.
-
shuup.simple_supplier.notify_events module¶
-
class
shuup.simple_supplier.notify_events.
AlertLimitReached
(**variable_values)[source]¶ Bases:
shuup.notify.base.Event
-
cache_key_fmt
= 'stock_alert_%s_%s'¶
-
identifier
= 'alert_limit_reached'¶
-
name
= 'Alert Limit Reached'¶
-
bindings
= {}¶
-
variables
= {'supplier': <shuup.notify.base.Variable object>, 'product': <shuup.notify.base.Variable object>, 'supplier_email': <shuup.notify.base.Variable object>, 'shop_email': <shuup.notify.base.Variable object>, 'dispatched_last_24hs': <shuup.notify.base.Variable object>}¶
-
shuup.simple_supplier.notify_script_template module¶
-
class
shuup.simple_supplier.notify_script_template.
StockLimitEmailForm
(data=None, files=None, auto_id='id_%s', prefix=None, initial=None, error_class=<class 'django.forms.utils.ErrorList'>, label_suffix=None, empty_permitted=False, field_order=None, use_required_attribute=None, renderer=None)[source]¶ Bases:
django.forms.forms.Form
-
base_fields
= OrderedDict([('recipient', <django.forms.fields.EmailField object>), ('last24hrs', <django.forms.fields.BooleanField object>)])¶
-
declared_fields
= OrderedDict([('recipient', <django.forms.fields.EmailField object>), ('last24hrs', <django.forms.fields.BooleanField object>)])¶
-
media
¶
-
-
class
shuup.simple_supplier.notify_script_template.
StockLimitEmailScriptTemplate
(script_instance=None)[source]¶ Bases:
shuup.notify.script_template.generic.GenericSendEmailScriptTemplate
Parameters: script_instance (shuup.notify.models.script.Script|None) – script instance to change or None -
identifier
= 'stocks_limit_email'¶
-
event
¶ alias of
AlertLimitReached
-
name
= 'Send Stock Limit Alert Email'¶
-
description
= 'Send me an email when a product stock is lower than the configured limit.'¶
-
help_text
= "This script will send an email to the configured destination alerting about the a product's low stock of a supplier. You can configure to not send the same email multiple times in a period of 24 hours. Every time a product's stock reach its configured limit, this notification will be fired and the email sent."¶
-
extra_js_template_name
= None¶
-
base_form_class
¶ alias of
StockLimitEmailForm
-
shuup.simple_supplier.product_copy_signal_handler module¶
shuup.simple_supplier.utils module¶
-
shuup.simple_supplier.utils.
get_current_stock_value
(supplier_id, product_id)[source]¶ Count stock values for supplier and product combination
Logical count is events minus orders bought (not cancelled) describing how many products is currently orderable Physical count is events minus orders actually sent describing how many products is currently in stock
Parameters: - supplier_id – supplier_id to count stock values for
- product_id – product_id to count stock values for
Returns: logical and physical count for product
Return type:
-
shuup.simple_supplier.utils.
get_stock_information_html
(supplier, product)[source]¶ Get html string to show current stock information for product
Parameters: - supplier (shuup.core.models.Supplier) – shuup Supplier
- product (shuup.core.models.Product) – shuup Product
Returns: html div as a string
Return type:
-
shuup.simple_supplier.utils.
get_stock_adjustment_div
(request, supplier, product)[source]¶ Get html string to adjust stock values
Contains inputs for purchase_price_value and delta
Parameters: - request (django.http.HttpRequest) – HTTP request
- supplier (shuup.core.models.Supplier) – shuup Supplier
- product (shuup.core.models.Product) – shuup Product
Returns: html div as a string
Return type:
Module contents¶
-
class
shuup.simple_supplier.
ShuupSimpleSupplierAppConfig
(*args, **kwargs)[source]¶ Bases:
shuup.apps.AppConfig
-
name
= 'shuup.simple_supplier'¶
-
verbose_name
= 'Shuup Simple Supplier'¶
-
label
= 'simple_supplier'¶
-
provides
= {'supplier_module': ['shuup.simple_supplier.module:SimpleSupplierModule'], 'admin_product_form_part': ['shuup.simple_supplier.admin_module.forms:SimpleSupplierFormPart'], 'admin_module': ['shuup.simple_supplier.admin_module:StocksAdminModule'], 'notify_event': ['shuup.simple_supplier.notify_events:AlertLimitReached'], 'notify_script_template': ['shuup.simple_supplier.notify_script_template:StockLimitEmailScriptTemplate']}¶
-