shuup.simple_supplier package

Submodules

shuup.simple_supplier.forms module

class shuup.simple_supplier.forms.StockAdjustmentForm(*args, **kwargs)[source]

Bases: django.forms.forms.Form

clean_delta()[source]
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 a ForwardManyToOneDescriptor 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 a ForwardManyToOneDescriptor 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 a ForwardManyToOneDescriptor 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 has includes_tax field.

Operaters with TaxfulPrice and TaxlessPrice 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.10 SubfieldBase 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:
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 a ForwardManyToOneDescriptor 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 a ForwardManyToOneDescriptor 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 has includes_tax field.

Operaters with TaxfulPrice and TaxlessPrice objects.

stock_unit_price

Property for Price object.

Similar to MoneyProperty, but also has includes_tax field.

Operaters with TaxfulPrice and TaxlessPrice 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

System Message: WARNING/2 (/home/docs/checkouts/readthedocs.org/user_builds/shuup/checkouts/latest/doc/api/shuup.simple_supplier.rst, line 33)

error while formatting arguments for shuup.simple_supplier.module.SimpleSupplierModule: name ‘Supplier’ is not defined
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:
Return type:

iterable[ValidationError]

get_stock_statuses(product_ids, *args, **kwargs)[source]
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.

ship_products(shipment, product_quantities, *args, **kwargs)[source]

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'
run(shop)[source]
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

get_script_steps(form)[source]
get_initial()[source]
can_edit_script()[source]
We can only edit the script when:
  • the event is AlertLimitReached
  • has a single SendMail action in steps (oterwise we don’t know which to edit)

shuup.simple_supplier.product_copy_signal_handler module

shuup.simple_supplier.product_copy_signal_handler.handle_product_copy(sender, shop, copied, copy, supplier=None, **kwargs)[source]

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:

dict

shuup.simple_supplier.utils.get_stock_information_div_id(supplier, product)[source]
shuup.simple_supplier.utils.get_stock_information_html(supplier, product)[source]

Get html string to show current stock information for product

Parameters:
Returns:

html div as a string

Return type:

str

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:
Returns:

html div as a string

Return type:

str

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']}
ready()[source]