mirror of
https://github.com/inventree/InvenTree
synced 2024-08-30 18:33:04 +00:00
commit
8301eb3be3
@ -703,7 +703,7 @@ class PriceBreak(models.Model):
|
||||
price = MoneyField(
|
||||
max_digits=19,
|
||||
decimal_places=4,
|
||||
default_currency='USD',
|
||||
default_currency=currency_code_default(),
|
||||
null=True,
|
||||
verbose_name=_('Price'),
|
||||
help_text=_('Unit price at specified quantity'),
|
||||
|
@ -14,7 +14,7 @@ import django.forms
|
||||
import djmoney.settings
|
||||
from djmoney.forms.fields import MoneyField
|
||||
|
||||
import common.settings
|
||||
from common.settings import currency_code_default
|
||||
|
||||
from .models import Company
|
||||
from .models import ManufacturerPart
|
||||
@ -38,7 +38,7 @@ class EditCompanyForm(HelperForm):
|
||||
label=_('Currency'),
|
||||
help_text=_('Default currency used for this company'),
|
||||
choices=[('', '----------')] + djmoney.settings.CURRENCY_CHOICES,
|
||||
initial=common.settings.currency_code_default,
|
||||
initial=currency_code_default,
|
||||
)
|
||||
|
||||
class Meta:
|
||||
@ -116,7 +116,7 @@ class EditSupplierPartForm(HelperForm):
|
||||
|
||||
single_pricing = MoneyField(
|
||||
label=_('Single Price'),
|
||||
default_currency='USD',
|
||||
default_currency=currency_code_default(),
|
||||
help_text=_('Single quantity price'),
|
||||
decimal_places=4,
|
||||
max_digits=19,
|
||||
|
@ -17,6 +17,8 @@ from django.contrib.auth.models import User
|
||||
from django.urls import reverse
|
||||
from django.utils.translation import ugettext_lazy as _
|
||||
|
||||
from common.settings import currency_code_default
|
||||
|
||||
from markdownx.models import MarkdownxField
|
||||
|
||||
from djmoney.models.fields import MoneyField
|
||||
@ -664,7 +666,7 @@ class PurchaseOrderLineItem(OrderLineItem):
|
||||
purchase_price = MoneyField(
|
||||
max_digits=19,
|
||||
decimal_places=4,
|
||||
default_currency='USD',
|
||||
default_currency=currency_code_default(),
|
||||
null=True, blank=True,
|
||||
verbose_name=_('Purchase Price'),
|
||||
help_text=_('Unit purchase price'),
|
||||
@ -693,7 +695,7 @@ class SalesOrderLineItem(OrderLineItem):
|
||||
sale_price = MoneyField(
|
||||
max_digits=19,
|
||||
decimal_places=4,
|
||||
default_currency='USD',
|
||||
default_currency=currency_code_default(),
|
||||
null=True, blank=True,
|
||||
verbose_name=_('Sale Price'),
|
||||
help_text=_('Unit sale price'),
|
||||
|
@ -13,7 +13,7 @@
|
||||
{% endblock %}
|
||||
|
||||
{% block details %}
|
||||
{% settings_value "INVENTREE_DEFAULT_CURRENCY" as currency %}
|
||||
{% default_currency as currency %}
|
||||
|
||||
{% crispy form %}
|
||||
|
||||
@ -130,7 +130,7 @@ the part single price shown is the current price for that supplier part"></i></h
|
||||
{% block js_ready %}
|
||||
{{ block.super }}
|
||||
|
||||
{% settings_value "INVENTREE_DEFAULT_CURRENCY" as currency %}
|
||||
{% default_currency as currency %}
|
||||
{% if price_history %}
|
||||
var pricedata = {
|
||||
labels: [
|
||||
|
@ -1,8 +1,9 @@
|
||||
{% extends "modal_form.html" %}
|
||||
|
||||
{% load i18n %}
|
||||
{% load i18n inventree_extras %}
|
||||
|
||||
{% block pre_form_content %}
|
||||
{% default_currency as currency %}
|
||||
<table class='table table-striped table-condensed table-price-two'>
|
||||
<tr>
|
||||
<td><b>{% trans 'Part' %}</b></td>
|
||||
|
@ -18,6 +18,7 @@ from InvenTree import version, settings
|
||||
import InvenTree.helpers
|
||||
|
||||
from common.models import InvenTreeSetting, ColorTheme
|
||||
from common.settings import currency_code_default
|
||||
|
||||
register = template.Library()
|
||||
|
||||
@ -161,6 +162,12 @@ def inventree_credits_url(*args, **kwargs):
|
||||
return "https://inventree.readthedocs.io/en/latest/credits/"
|
||||
|
||||
|
||||
@register.simple_tag()
|
||||
def default_currency(*args, **kwargs):
|
||||
""" Returns the default currency code """
|
||||
return currency_code_default()
|
||||
|
||||
|
||||
@register.simple_tag()
|
||||
def setting_object(key, *args, **kwargs):
|
||||
"""
|
||||
|
@ -20,6 +20,8 @@ from django.contrib.auth.models import User
|
||||
from django.db.models.signals import pre_delete
|
||||
from django.dispatch import receiver
|
||||
|
||||
from common.settings import currency_code_default
|
||||
|
||||
from markdownx.models import MarkdownxField
|
||||
|
||||
from mptt.models import MPTTModel, TreeForeignKey
|
||||
@ -534,7 +536,7 @@ class StockItem(MPTTModel):
|
||||
purchase_price = MoneyField(
|
||||
max_digits=19,
|
||||
decimal_places=4,
|
||||
default_currency='USD',
|
||||
default_currency=currency_code_default(),
|
||||
blank=True,
|
||||
null=True,
|
||||
verbose_name=_('Purchase Price'),
|
||||
|
@ -1 +1,2 @@
|
||||
{% if currency %}{{ currency.symbol }}{% endif %}{{ price }}{% if currency %} {{ currency.suffix }}{% endif %}
|
||||
{% load djmoney %}
|
||||
{% money_localize price currency %}
|
Loading…
Reference in New Issue
Block a user