1. bjunix
  2. satchmo


satchmo / satchmo / apps / tax / config.py

from django.conf import settings
from django.utils.translation import ugettext_lazy as _
from livesettings import *
from satchmo_utils import is_string_like, load_module
from satchmo_store.shop import get_satchmo_setting

TAX_GROUP = ConfigurationGroup('TAX', _('Tax Settings'))
TAX_MODULE = config_register(StringValue(TAX_GROUP,
    description=_("Active tax module"),
    help_text=_("Select a module, save and reload to set any module-specific settings."),
    choices=[('tax.modules.no', _('No Tax')),

DEFAULT_VIEW_TAX = config_register(BooleanValue(TAX_GROUP,
    description=_("Show with tax included"),
    help_text=_("If yes, then all products and the cart will display with tax included."),

PRODUCTS_TAXABLE_BY_DEFAULT = config_register(BooleanValue(TAX_GROUP,
    description=_("New products are automatically made taxable"),
    help_text=_("Whether newly created products should be taxable by default."),

INCLUDE_TAX_ON_DISCOUNTS = config_register(BooleanValue(TAX_GROUP,
    description=_("Include taxes when calculating product discount"),
    help_text=_("If true, will consider price with taxes to calculate discount."),

TAX_AREA_ADDRESS = config_register(
        description=_("Should tax be calculated based on shipping or billing address?"),
        help_text=_("This will only be used if tax is calculated based on an address."),
        choices = (
            (('ship', 'Shipping')),
            (('bill', 'Billing')),
        default = 'ship')

# --- Load any extra tax modules. ---
extra_tax = get_satchmo_setting('CUSTOM_TAX_MODULES')
for extra in extra_tax:
        load_module("%s.config" % extra)
    except ImportError:
        log.warn('Could not load tax module configuration: %s' % extra)