Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

added field export_url in expense group and util to generate URL #457

Merged
merged 9 commits into from
Nov 29, 2023

Conversation

Ashutosh619-sudo
Copy link
Contributor

No description provided.

Copy link

Tests Skipped Failures Errors Time
210 0 💤 63 ❌ 15 🔥 35.080s ⏱️

Copy link

Tests Skipped Failures Errors Time
210 0 💤 0 ❌ 0 🔥 19.977s ⏱️

Copy link

codecov bot commented Nov 22, 2023

Codecov Report

Merging #457 (4cd1765) into employee_in_expense_new (64f108a) will decrease coverage by 0.05%.
The diff coverage is 86.95%.

Additional details and impacted files

Impacted file tree graph

@@                     Coverage Diff                     @@
##           employee_in_expense_new     #457      +/-   ##
===========================================================
- Coverage                    95.09%   95.04%   -0.05%     
===========================================================
  Files                           49       49              
  Lines                         4665     4679      +14     
===========================================================
+ Hits                          4436     4447      +11     
- Misses                         229      232       +3     
Files Coverage Δ
apps/fyle/models.py 97.34% <100.00%> (+0.02%) ⬆️
apps/fyle/serializers.py 100.00% <100.00%> (ø)
apps/fyle/tasks.py 100.00% <100.00%> (ø)
apps/netsuite/tasks.py 95.10% <100.00%> (+0.01%) ⬆️
apps/fyle/views.py 87.79% <50.00%> (-1.44%) ⬇️

url = generate_netsuite_export_url(response_logs=expense_group.response_logs, ns_account_id=netsuite_cred.ns_account_id)
expense_group.export_url = url
expense_group.save()
print('Export URl updated for expense group id {}'.format(expense_group.id))
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

remove loggers

expense_group.save()
print('Export URl updated for expense group id {}'.format(expense_group.id))
except Exception as exception:
print('Something went wrong during updating export_url for workspace_id {}'.format(expense_group.workspace_id))
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

add valid exceptions here

@@ -71,6 +72,13 @@
}


def add_export_url(response_logs, ns_account_id, expense_group):
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

generate_export_url

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

actually, remove this whole func, call generate_netsuite_export_url directly

def add_export_url(response_logs, ns_account_id, expense_group):
try:
url = generate_netsuite_export_url(response_logs, ns_account_id)
expense_group.export_url = url
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

return url from this func and assign value there

@@ -23,3 +23,22 @@ def filter_queryset(self, queryset):
filter_kwargs = {self.lookup_field: lookup_value}
queryset = queryset.filter(**filter_kwargs)
return super().filter_queryset(queryset)


export_type_redirection = {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

declare const at top, all caps variable.


expense_groups = ExpenseGroup.objects.all()

for expense_group in expense_groups:
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

let's iterate through workspaces (prod only - exclude workspaces that has name like test / fyle / sandbox). Iterate through workspace and filter expense groups that has response logs != null and do it in batches. https://github.com/fylein/fyle-integration-scripts/blob/master/qbo/batched-fill.py check this out on how to do it in batches

Copy link

Tests Skipped Failures Errors Time
210 0 💤 4 ❌ 4 🔥 21.236s ⏱️

Copy link

Tests Skipped Failures Errors Time
210 0 💤 0 ❌ 0 🔥 21.689s ⏱️

url = f'https://{ns_account_id}.app.netsuite.com/app/accounting/transactions/${redirection}.nl?id={internal_id}'
return url
except Exception as exception:
logger.info({'error': exception})
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

logger.exception

from fyle_netsuite_api.utils import generate_netsuite_export_url


folder_created_workspace_ids = []
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

not needed


prod_workspaces = Workspace.objects.exclude(
name__iregex=r'(fyle|test)',
id__in=folder_created_workspace_ids
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

not needed

Copy link

Tests Skipped Failures Errors Time
210 0 💤 0 ❌ 0 🔥 20.467s ⏱️

@Ashutosh619-sudo Ashutosh619-sudo changed the base branch from employee_in_expense to employee_in_expense_new November 29, 2023 11:14
@Ashutosh619-sudo Ashutosh619-sudo changed the base branch from employee_in_expense_new to employee_in_expense November 29, 2023 11:27
@Ashutosh619-sudo Ashutosh619-sudo changed the base branch from employee_in_expense to employee_in_expense_new November 29, 2023 11:48
Ashutosh619-sudo and others added 2 commits November 29, 2023 03:52
* added more fields in expense serializer

* Sync import API (#459)

* added expense group sync API

* minor changes

* added url for expense group sync view
Copy link

Tests Skipped Failures Errors Time
216 0 💤 0 ❌ 0 🔥 20.788s ⏱️

@Ashutosh619-sudo Ashutosh619-sudo merged commit 36dd0f9 into employee_in_expense_new Nov 29, 2023
1 of 3 checks passed
Ashutosh619-sudo added a commit that referenced this pull request Nov 29, 2023
* employee email added to expense group

* added field export_url in expense group and util to generate URL (#457)

* add employee name in expense and script to populate data

* test fixture changes

* added field export_url in expense group and util to generate URL

* updated test and fixtures

* changed scripts to batch update export url

* bug fix

* comment resolved

* added more fields in expense serializer for redirection (#458)

* added more fields in expense serializer

* Sync import API (#459)

* added expense group sync API

* minor changes

* added url for expense group sync view

* remove redundant script
Ashutosh619-sudo added a commit that referenced this pull request Nov 29, 2023
…PI (#454)

* exportable expense API and date range filter for expense group view  API

* test added

* filter for date range

* comment resolved

* comment resolved

* employee email added to expense group (#463)

* employee email added to expense group

* added field export_url in expense group and util to generate URL (#457)

* add employee name in expense and script to populate data

* test fixture changes

* added field export_url in expense group and util to generate URL

* updated test and fixtures

* changed scripts to batch update export url

* bug fix

* comment resolved

* added more fields in expense serializer for redirection (#458)

* added more fields in expense serializer

* Sync import API (#459)

* added expense group sync API

* minor changes

* added url for expense group sync view

* remove redundant script

* added upload_attachments and update exports
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants