shuup.simple_supplier package
Subpackages
- shuup.simple_supplier.admin_module package
Submodules
shuup.simple_supplier.forms module
- class shuup.simple_supplier.forms.StockAdjustmentForm(sales_unit: SalesUnit | None = None, *args, **kwargs)[source]
Bases:
Form
- base_fields = {'delta': <shuup.core.fields.FormattedDecimalFormField object>, 'purchase_price': <django.forms.fields.DecimalField object>}
- declared_fields = {'delta': <shuup.core.fields.FormattedDecimalFormField object>, 'purchase_price': <django.forms.fields.DecimalField object>}
- property media
Return all media required to render the widgets on this form.
- class shuup.simple_supplier.forms.AlertLimitForm(sales_unit: SalesUnit | None = None, *args, **kwargs)[source]
Bases:
Form
- base_fields = {'alert_limit': <django.forms.fields.DecimalField object>}
- declared_fields = {'alert_limit': <django.forms.fields.DecimalField object>}
- property media
Return all media required to render the widgets on this form.
- 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:
Form
- base_fields = {'stock_managed': <django.forms.fields.BooleanField object>}
- declared_fields = {'stock_managed': <django.forms.fields.BooleanField object>}
- property media
Return all media required to render the widgets on this form.
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:
Model
- 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
- currency
- includes_tax
- exception DoesNotExist
Bases:
ObjectDoesNotExist
- exception MultipleObjectsReturned
Bases:
MultipleObjectsReturned
- created_by_id
- 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
- supplier_id
- class shuup.simple_supplier.models.StockCount(id, alert_limit, stock_managed, product, supplier, logical_count, physical_count, stock_value_value)[source]
Bases:
Model
- 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
- property stock_unit_price_value
- exception DoesNotExist
Bases:
ObjectDoesNotExist
- exception MultipleObjectsReturned
Bases:
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
- supplier_id
shuup.simple_supplier.module module
- class shuup.simple_supplier.module.SimpleSupplierModule(supplier: Supplier, options: Dict)[source]
Bases:
BaseSupplierModule
- 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]
- get_stock_statuses(product_ids, *args, **kwargs)[source]
- Parameters:
product_ids – Iterable of product IDs.
- Returns:
Dict of {product_id: ProductStockStatus}.
- adjust_stock(product_id, delta, purchase_price=0, created_by=None, type=StockAdjustmentType.INVENTORY, *args, **kwargs)[source]
Adjusts the stock for the given
product_id
.
- 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:
Event
- cache_key_fmt = 'stock_alert_%s_%s'
- identifier = 'alert_limit_reached'
- name = 'Alert Limit Reached'
- bindings = {}
- variables = {'dispatched_last_24hs': <shuup.notify.base.Variable object>, 'product': <shuup.notify.base.Variable object>, 'shop_email': <shuup.notify.base.Variable object>, 'supplier': <shuup.notify.base.Variable object>, 'supplier_email': <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:
Form
- base_fields = {'last24hrs': <django.forms.fields.BooleanField object>, 'recipient': <django.forms.fields.EmailField object>}
- declared_fields = {'last24hrs': <django.forms.fields.BooleanField object>, 'recipient': <django.forms.fields.EmailField object>}
- property media
Return all media required to render the widgets on this form.
- class shuup.simple_supplier.notify_script_template.StockLimitEmailScriptTemplate(script_instance=None)[source]
Bases:
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]
Returns a list of Steps to use in the script.
- Parameters:
form (django.forms.Form|None) – validated form to use or None
- Returns:
list of steps
- Return type:
list[shuup.notify.Step]
- get_initial()[source]
Returns the initial data to use for configuration form.
Note: You must also check for the bound
script_instance
attribute. One can edit the Script created by the template editor through the form this instance provides. This way, when a script instance is bound, you must return the the representantion of the Script as the initial form data.- Returns:
initial data to to use in configuration form
- Return type:
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:
AppConfig
- name = 'shuup.simple_supplier'
- verbose_name = 'Shuup Simple Supplier'
- label = 'simple_supplier'
- default_auto_field = 'django.db.models.BigAutoField'
- provides = {'admin_module': ['shuup.simple_supplier.admin_module:StocksAdminModule'], 'admin_product_form_part': ['shuup.simple_supplier.admin_module.forms:SimpleSupplierFormPart'], 'notify_event': ['shuup.simple_supplier.notify_events:AlertLimitReached'], 'notify_script_template': ['shuup.simple_supplier.notify_script_template:StockLimitEmailScriptTemplate'], 'supplier_module': ['shuup.simple_supplier.module:SimpleSupplierModule']}
See /provides for details about the
provides
variable.