Skip to content

Commit

Permalink
Error changes
Browse files Browse the repository at this point in the history
  • Loading branch information
devenderbutani21 committed May 1, 2024
1 parent 64bffe9 commit 901bfb3
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 11 deletions.
7 changes: 2 additions & 5 deletions backend/views/core/clients/create.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,12 +36,9 @@ def create_client(request: HtmxHttpRequest):


def create_client_instance(user, client_details):
kwargs = {"organization": user.logged_in_as_team} if user.logged_in_as_team else {"user": user}
organization = user.logged_in_as_team if user.logged_in_as_team else None
try:
client = Client.objects.create(**kwargs)
for model_field, new_value in client_details.items():
setattr(client, model_field, new_value)
client.save()
client = Client.objects.create(organization=organization, **client_details)
return client
except Exception as e:
print(f"Failed to create client: {e}")
Expand Down
2 changes: 1 addition & 1 deletion backend/views/core/invoices/edit.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ def invoice_get_existing_data(invoice_obj):
stored_data.update({
"to_name": client_to.name,
"to_company": client_to.company,
"is_represntative": client_to.representative,
"is_representative": client_to.representative,
# "to_address": client_to.address,
# "to_city": client_to.city,
# "to_county": client_to.county,
Expand Down
7 changes: 2 additions & 5 deletions backend/views/core/invoices/view.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,10 @@

from django.contrib import messages
from django.contrib.auth.models import AnonymousUser
from django.shortcuts import redirect
from django.shortcuts import render
from django.shortcuts import redirect, render
from login_required import login_not_required

from backend.models import Invoice
from backend.models import InvoiceURL
from backend.models import UserSettings
from backend.models import Invoice, InvoiceURL, UserSettings


def preview(request, invoice_id):
Expand Down

0 comments on commit 901bfb3

Please sign in to comment.