shuup.default_tax package

Submodules

shuup.default_tax.models module

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

Bases: django.db.models.query.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: django.db.models.base.Model

Parameters:
  • id (AutoField) – Id
  • enabled (BooleanField) – Check this if this tax rule is active.
  • country_codes_pattern (CharField) – Country codes pattern
  • region_codes_pattern (CharField) – Region codes pattern
  • postal_codes_pattern (TextField) – Postal codes pattern
  • _postal_codes_min (CharField) – postal codes min
  • _postal_codes_max (CharField) – postal codes max
  • priority (IntegerField) – Rules with same priority define added taxes (e.g. US taxes) and rules with different priority define compound taxes (e.g. Canada Quebec PST case)
  • override_group (IntegerField) – If several rules match, only the rules with the highest override group number will be effective. This can be used, for example, to implement tax exemption by adding a rule with very high override group that sets a zero tax.
  • tax (ForeignKey to shuup.core.models.Tax) – The tax to apply when this rule is applied.
  • tax_classes (ManyToManyField to shuup.core.models.TaxClass) – Tax classes of the items to be taxed
  • customer_tax_groups (ManyToManyField to shuup.core.models.CustomerTaxGroup) – The customer tax groups for which this tax rule is limited.
tax_classes
customer_tax_groups
tax
objects = <django.db.models.manager.ManagerFromTaxRuleQuerySet object>
matches(taxing_context)[source]

Check if this tax rule matches given taxing context.

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

Bases: django.core.exceptions.ObjectDoesNotExist

exception TaxRule.MultipleObjectsReturned

Bases: django.core.exceptions.MultipleObjectsReturned

shuup.default_tax.module module

class shuup.default_tax.module.DefaultTaxModule[source]

Bases: shuup.core.taxing.TaxModule

identifier = 'default_tax'
name = <django.utils.functional.lazy.<locals>.__proxy__ object>
get_taxed_price(context, price, tax_class)[source]
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: shuup.apps.AppConfig

name = 'shuup.default_tax'
verbose_name = <django.utils.functional.lazy.<locals>.__proxy__ object>
label = 'default_tax'
provides = {'tax_module': ['shuup.default_tax.module:DefaultTaxModule'], 'admin_module': ['shuup.default_tax.admin_module:TaxRulesAdminModule']}