2
0
mirror of https://github.com/inventree/InvenTree.git synced 2025-06-17 12:35:46 +00:00

replace MoneyFields with inherited classes

This commit is contained in:
2021-07-01 00:13:38 +02:00
parent 56b23389d3
commit 3a57093b4e
6 changed files with 20 additions and 18 deletions

View File

@ -10,10 +10,8 @@ from django.utils.translation import ugettext_lazy as _
from mptt.fields import TreeNodeChoiceField
from djmoney.forms.fields import MoneyField
from InvenTree.forms import HelperForm
from InvenTree.fields import RoundingDecimalFormField
from InvenTree.fields import InvenTreeMoneyField, RoundingDecimalFormField
from InvenTree.fields import DatePickerFormField
from InvenTree.helpers import clean_decimal
@ -321,7 +319,7 @@ class OrderMatchItemForm(MatchItemForm):
)
# set price field
elif 'price' in col_guess.lower():
return MoneyField(
return InvenTreeMoneyField(
label=_(col_guess),
default_currency=InvenTreeSetting.get_setting('INVENTREE_DEFAULT_CURRENCY'),
decimal_places=5,

View File

@ -22,14 +22,12 @@ from common.settings import currency_code_default
from markdownx.models import MarkdownxField
from mptt.models import TreeForeignKey
from djmoney.models.fields import MoneyField
from users import models as UserModels
from part import models as PartModels
from stock import models as stock_models
from company.models import Company, SupplierPart
from InvenTree.fields import RoundingDecimalField
from InvenTree.fields import InvenTreeModelMoneyField, RoundingDecimalField
from InvenTree.helpers import decimal2string, increment, getSetting
from InvenTree.status_codes import PurchaseOrderStatus, SalesOrderStatus, StockStatus, StockHistoryCode
from InvenTree.models import InvenTreeAttachment
@ -664,7 +662,7 @@ class PurchaseOrderLineItem(OrderLineItem):
received = models.DecimalField(decimal_places=5, max_digits=15, default=0, verbose_name=_('Received'), help_text=_('Number of items received'))
purchase_price = MoneyField(
purchase_price = InvenTreeModelMoneyField(
max_digits=19,
decimal_places=4,
default_currency=currency_code_default(),
@ -716,7 +714,7 @@ class SalesOrderLineItem(OrderLineItem):
part = models.ForeignKey('part.Part', on_delete=models.SET_NULL, related_name='sales_order_line_items', null=True, verbose_name=_('Part'), help_text=_('Part'), limit_choices_to={'salable': True})
sale_price = MoneyField(
sale_price = InvenTreeModelMoneyField(
max_digits=19,
decimal_places=4,
default_currency=currency_code_default(),