예제 #1
0
# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
# ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
# LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
# CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
# POSSIBILITY OF SUCH DAMAGE.

from django.db import models
from django.utils.translation import ugettext_lazy as _

from sellmo.contrib.settings import settings_manager

from .constants import MAX_TIER_ATTRIBUTES

group = _("Tiered Shipping")

for i in range(MAX_TIER_ATTRIBUTES):
    settings_manager.add_setting(
        'shipping_tier_attribute{0}'.format(i + 1),
        models.ForeignKey(
            'attribute.Attribute',
            null=True,
            blank=True,
            related_name='+'
        ),
        group
    )
예제 #2
0
                        DISPLAY_PRICES_INCLUDING_EXCLUDING_TAX,
                        POLICY_CUSTOMER_ADDRESS)

group = _("Taxes")

POLICY_CHOICES = tuple(
    (underscore_concat(POLICY_CUSTOMER_ADDRESS, address_type),
     _("%s address") % address_type) for address_type in ADDRESS_TYPES)

POLICY_DEFAULT = POLICY_CHOICES[0][0] if POLICY_CHOICES else None

settings_manager.add_setting(
    'tax_policy',
    models.CharField(
        max_length=80,
        null=POLICY_DEFAULT is None,
        blank=POLICY_DEFAULT is None,
        default=POLICY_DEFAULT,
        choices=POLICY_CHOICES,
        verbose_name=_("tax policy"),
    ), group)

settings_manager.add_setting(
    'tax_inclusive',
    models.BooleanField(
        default=False,
        verbose_name=_("tax inclusive"),
    ), group)

settings_manager.add_setting(
    'tax_breakdown',
    models.BooleanField(
예제 #3
0
# specific prior written permission.

# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
# ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
# LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
# CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
# POSSIBILITY OF SUCH DAMAGE.

from django.db import models
from django.utils.translation import ugettext_lazy as _

from sellmo.contrib.settings import settings_manager

from .constants import MAX_TIER_ATTRIBUTES

group = _("Tiered Shipping")

for i in range(MAX_TIER_ATTRIBUTES):
    settings_manager.add_setting(
        'shipping_tier_attribute{0}'.format(i + 1),
        models.ForeignKey('attribute.Attribute',
                          null=True,
                          blank=True,
                          related_name='+'), group)
예제 #4
0
                order=order, mail_message__message_type=mail, mail_message__delivered=True
            )
            if send_mails.count() > 0:
                # Do not send
                continue

        mailer.send_mail(message_type, {"order": order})


def on_order_paid(sender, order, **kwargs):
    send_order_mails(order, {"on_paid": True})


def on_order_state_changed(sender, order, new_state, old_state=None, **kwargs):
    send_order_mails(order, **{"state": new_state, "on_{0}".format(new_state): True})


def on_order_status_changed(sender, order, new_status, old_status=None, **kwargs):
    send_order_mails(order, {"status": new_status})


order_paid.connect(on_order_paid)
order_state_changed.connect(on_order_state_changed)
order_status_changed.connect(on_order_status_changed)

group = _("Checkout")

settings_manager.add_setting(
    "send_order_mails", models.BooleanField(default=True, verbose_name=_("send order mails")), group
)
예제 #5
0
# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
# CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
# POSSIBILITY OF SUCH DAMAGE.

from django.db import models
from django.utils.translation import ugettext_lazy as _

from sellmo.contrib.settings import settings_manager

group = _("Store Information")


settings_manager.add_setting(
    'store_name',
    models.CharField(
        max_length=100,
        verbose_name=_("store name"),
    ), group)


settings_manager.add_setting(
    'store_email',
    models.EmailField(
        verbose_name=_("contact email address"),
        blank=True,
    ), group)


settings_manager.add_setting(
    'store_phone_number',
    models.CharField(
예제 #6
0
def on_order_state_changed(sender, order, new_state, old_state=None, **kwargs):
    send_order_mails(
        order, **{
            'state': new_state,
            'on_{0}'.format(new_state): True,
        })


def on_order_status_changed(sender,
                            order,
                            new_status,
                            old_status=None,
                            **kwargs):
    send_order_mails(order, {
        'status': new_status,
    })


order_paid.connect(on_order_paid)
order_state_changed.connect(on_order_state_changed)
order_status_changed.connect(on_order_status_changed)

group = _("Checkout")

settings_manager.add_setting(
    'send_order_mails',
    models.BooleanField(
        default=True,
        verbose_name=_("send order mails"),
    ), group)
예제 #7
0
# specific prior written permission.

# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
# ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
# LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
# CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
# POSSIBILITY OF SUCH DAMAGE.

from django.db import models
from django.utils.translation import ugettext_lazy as _

from sellmo.contrib.settings import settings_manager

group = _("Mollie")

settings_manager.add_setting(
    'mollie_api_key',
    models.CharField(
        max_length=255,
        blank=True,
        verbose_name=_("mollie api key"),
    ),
    group
)
예제 #8
0
# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
# CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
# POSSIBILITY OF SUCH DAMAGE.

from django.db import models
from django.utils.translation import ugettext_lazy as _

from sellmo.contrib.settings import settings_manager

group = _("Cash Payment")

settings_manager.add_setting(
    'cash_payment_name',
    models.CharField(
        max_length=80,
        default=_("cash payment"),
        verbose_name=_("cash payment name")
    ),
    group
)

settings_manager.add_setting(
    'cash_payment_instructions',
    models.TextField(
        default=_("Payment instructions for amount {order.remaining}."),
        verbose_name=_("cash payment instructions"),
    ),
    group
)
예제 #9
0
# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
# CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
# POSSIBILITY OF SUCH DAMAGE.

from django.db import models
from django.utils.translation import ugettext_lazy as _

from sellmo.contrib.settings import settings_manager

group = _("Bank Transfer")

settings_manager.add_setting(
    'bank_transfer_name',
    models.CharField(
        max_length=80,
        default=_("bank transfer"),
        verbose_name=_("bank transfer name")
    ),
    group
)

settings_manager.add_setting(
    'bank_transfer_instructions',
    models.TextField(
        default=_("Payment instructions for amount {order.remaining}."),
        verbose_name=_("bank transfer instructions")
    ),
    group
)
예제 #10
0
POLICY_CHOICES = tuple(
    (
        underscore_concat(POLICY_CUSTOMER_ADDRESS, address_type),
        _("%s address") % address_type
    ) for address_type in ADDRESS_TYPES
)

POLICY_DEFAULT = POLICY_CHOICES[0][0] if POLICY_CHOICES else None

settings_manager.add_setting(
    'tax_policy',
    models.CharField(
        max_length=80,
        null=POLICY_DEFAULT is None,
        blank=POLICY_DEFAULT is None,
        default=POLICY_DEFAULT,
        choices=POLICY_CHOICES,
        verbose_name=_("tax policy"),
    ),
    group
)

settings_manager.add_setting(
    'tax_inclusive',
    models.BooleanField(
        default=False,
        verbose_name=_("tax inclusive"),
    ),
    group
)