Skip to content

Commit 140616d

Browse files
committed
Fix
1 parent 52e8537 commit 140616d

3 files changed

Lines changed: 10 additions & 1 deletion

File tree

landolfio/inventory_frontend/views.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
from django.conf import settings
12
from django.contrib import messages
23
from django.shortcuts import redirect, get_object_or_404
34
from django.urls import reverse
@@ -785,7 +786,11 @@ def form_valid(self, form):
785786

786787
# Try to create on Moneybird if required fields are present
787788
asset = self.object
788-
if asset.start_date and asset.purchase_value_asset:
789+
if (
790+
settings.AUTO_CREATE_ASSET_ON_MONEYBIRD
791+
and asset.start_date
792+
and asset.purchase_value_asset
793+
):
789794
try:
790795
asset.create_on_moneybird()
791796
messages.success(

landolfio/website/settings/development.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,3 +57,5 @@
5757

5858
MONEYBIRD_MARGIN_ASSETS_LEDGER_ACCOUNT_ID = "340246234795083709"
5959
MONEYBIRD_NOT_MARGIN_ASSETS_LEDGER_ACCOUNT_ID = "340246538381952245"
60+
61+
AUTO_CREATE_ASSET_ON_MONEYBIRD = True

landolfio/website/settings/production.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -106,3 +106,5 @@
106106
EMAIL_DEFAULT_SENDER = os.environ.get("SMTP_FROM", None)
107107
DEFAULT_FROM_EMAIL = os.environ.get("SMTP_FROM_EMAIL", None)
108108
SERVER_EMAIL = os.environ.get("SMTP_FROM", None)
109+
110+
AUTO_CREATE_ASSET_ON_MONEYBIRD = False

0 commit comments

Comments
 (0)