shuup.default_tax package

Subpackages

Submodules

shuup.default_tax.models module

class shuup.default_tax.models.TaxRuleQuerySet(model=None, query=None, using=None, hints=None)[source]

Bases: QuerySet

may_match_postal_code(postalcode)[source]
class shuup.default_tax.models.TaxRule(id, enabled, country_codes_pattern, region_codes_pattern, postal_codes_pattern, _postal_codes_min, _postal_codes_max, priority, override_group, tax)[source]

Bases: Model

enabled

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

tax_classes

Accessor to the related objects manager on the forward and reverse sides of a many-to-many relation.

In the example:

class Pizza(Model):
    toppings = ManyToManyField(Topping, related_name='pizzas')

Pizza.toppings and Topping.pizzas are ManyToManyDescriptor instances.

Most of the implementation is delegated to a dynamically defined manager class built by create_forward_many_to_many_manager() defined below.

customer_tax_groups

Accessor to the related objects manager on the forward and reverse sides of a many-to-many relation.

In the example:

class Pizza(Model):
    toppings = ManyToManyField(Topping, related_name='pizzas')

Pizza.toppings and Topping.pizzas are ManyToManyDescriptor instances.

Most of the implementation is delegated to a dynamically defined manager class built by create_forward_many_to_many_manager() defined below.

country_codes_pattern

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

region_codes_pattern

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

postal_codes_pattern

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

priority

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

override_group

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

tax

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.

objects = <django.db.models.manager.ManagerFromTaxRuleQuerySet object>
matches(taxing_context)[source]

Check if this tax rule matches given taxing context.

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

id

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

tax_id

shuup.default_tax.module module

class shuup.default_tax.module.DefaultTaxModule[source]

Bases: TaxModule

identifier = 'default_tax'
name = 'Default Taxation'
get_taxed_price(context, price, tax_class)[source]

Get TaxedPrice for price and tax class.

Parameters:
Return type:

shuup.core.taxing.TaxedPrice

shuup.default_tax.module.get_taxes_of_effective_rules(taxing_context, tax_rules)[source]

Get taxes grouped by priority from effective tax rules.

Effective tax rules is determined by first limiting the scope to the rules that match the given taxing context (see TaxRule.match) and then further limiting the matching rules by selecting only the rules in the highest numbered override group.

The Tax objects in the effective rules will be grouped by the priority of the rules. The tax groups are returned as list of tax lists.

Parameters:

tax_rules (Iterable[TaxRule]) – Tax rules to filter from. These should be ordered desceding by override group and then ascending by priority.

Return type:

list[list[shuup.core.models.Tax]]

Module contents

class shuup.default_tax.AppConfig(*args, **kwargs)[source]

Bases: AppConfig

name = 'shuup.default_tax'
verbose_name = 'Shuup Default Tax'
label = 'default_tax'
default_auto_field = 'django.db.models.BigAutoField'
provides = {'admin_module': ['shuup.default_tax.admin_module:TaxRulesAdminModule'], 'tax_module': ['shuup.default_tax.module:DefaultTaxModule']}

See /provides for details about the provides variable.