shuup.customer_group_pricing package

Submodules

shuup.customer_group_pricing.admin_form_part module

class shuup.customer_group_pricing.admin_form_part.CustomerGroupPricingForm(**kwargs)[source]

Bases: Form

__init__(**kwargs)[source]
save()[source]
get_shop_group_field(shop, group)[source]
base_fields = {}
declared_fields = {}
property media

Return all media required to render the widgets on this form.

class shuup.customer_group_pricing.admin_form_part.CustomerGroupDiscountForm(**kwargs)[source]

Bases: Form

__init__(**kwargs)[source]
save()[source]
get_shop_group_field(shop, group)[source]
base_fields = {}
declared_fields = {}
property media

Return all media required to render the widgets on this form.

class shuup.customer_group_pricing.admin_form_part.CustomerGroupPricingFormPart(request, object=None)[source]

Bases: FormPart

priority: int = 10
get_form_defs()[source]
form_valid(form)[source]
class shuup.customer_group_pricing.admin_form_part.CustomerGroupPricingDiscountFormPart(request, object=None)[source]

Bases: FormPart

priority: int = 11
get_form_defs()[source]
form_valid(form)[source]

shuup.customer_group_pricing.models module

class shuup.customer_group_pricing.models.CgpBase(*args, **kwargs)[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 a ForwardManyToOneDescriptor instance.

shop

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.

group

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.

class Meta[source]

Bases: object

abstract = False
unique_together = (('product', 'shop', 'group'),)
group_id
product_id
shop_id
class shuup.customer_group_pricing.models.CgpPrice(id, product, shop, group, price_value)[source]

Bases: MoneyPropped, CgpBase

price

Property for Price object.

Similar to MoneyProperty, but also has includes_tax field.

Operaters with TaxfulPrice and TaxlessPrice objects.

price_value

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

save(*args, **kwargs)[source]

Save the current instance. Override this in a subclass if you want to control the saving process.

The ‘force_insert’ and ‘force_update’ parameters can be used to insist that the “save” must be an SQL insert or update (or equivalent for non-SQL backends), respectively. Normally, they should not be set.

exception DoesNotExist

Bases: ObjectDoesNotExist

exception MultipleObjectsReturned

Bases: MultipleObjectsReturned

group

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.

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

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.

shop

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.

class shuup.customer_group_pricing.models.CgpDiscount(id, product, shop, group, discount_amount_value)[source]

Bases: MoneyPropped, CgpBase

discount_amount

Property for Price object.

Similar to MoneyProperty, but also has includes_tax field.

Operaters with TaxfulPrice and TaxlessPrice objects.

discount_amount_value

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

save(*args, **kwargs)[source]

Save the current instance. Override this in a subclass if you want to control the saving process.

The ‘force_insert’ and ‘force_update’ parameters can be used to insist that the “save” must be an SQL insert or update (or equivalent for non-SQL backends), respectively. Normally, they should not be set.

exception DoesNotExist

Bases: ObjectDoesNotExist

exception MultipleObjectsReturned

Bases: MultipleObjectsReturned

group

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.

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

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.

shop

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.

shuup.customer_group_pricing.module module

class shuup.customer_group_pricing.module.CustomerGroupPricingModule[source]

Bases: PricingModule

identifier = 'customer_group_pricing'
name = 'Customer Group Pricing'
get_price_info(context, product, quantity=1)[source]

Get price info for a given quantity of the product.

Parameters:

product (shuup.core.models.Product|int) – Product object or id of Product.

Return type:

PriceInfo

index_shop_product(shop_product: ShopProduct | int, **kwargs)[source]

Index the prices for the given shop product

class shuup.customer_group_pricing.module.CustomerGroupDiscountModule[source]

Bases: DiscountModule

identifier = 'customer_group_discount'
name = 'Customer Group Discount'
discount_price(context, product, price_info)[source]

Get the best discount amount for context.

index_shop_product(shop_product: ShopProduct | int, **kwargs)[source]

Index the shop product discounts

shuup.customer_group_pricing.signal_handers module

shuup.customer_group_pricing.signal_handers.handle_cgp_discount_post_save(sender, instance, **kwargs)[source]
shuup.customer_group_pricing.signal_handers.handle_cgp_price_post_save(sender, instance, **kwargs)[source]
shuup.customer_group_pricing.signal_handers.handle_contact_group_m2m_changed(sender, instance, **kwargs)[source]
shuup.customer_group_pricing.signal_handers.handle_product_copy(sender, shop, copied, copy, **kwargs)[source]

Module contents

class shuup.customer_group_pricing.CustomerGroupPricingAppConfig(*args, **kwargs)[source]

Bases: AppConfig

name = 'shuup.customer_group_pricing'
verbose_name = 'Shuup Customer Group Pricing'
label = 'shuup_customer_group_pricing'
default_auto_field = 'django.db.models.BigAutoField'
provides = {'admin_product_form_part': ['shuup.customer_group_pricing.admin_form_part:CustomerGroupPricingFormPart', 'shuup.customer_group_pricing.admin_form_part:CustomerGroupPricingDiscountFormPart'], 'discount_module': ['shuup.customer_group_pricing.module:CustomerGroupDiscountModule'], 'pricing_module': ['shuup.customer_group_pricing.module:CustomerGroupPricingModule']}

See /provides for details about the provides variable.

ready()[source]

Override this method in subclasses to run code when Django starts.