Skip to content

Commit

Permalink
Merge branch 'vendor-card-mapping' into disable-sage-fields
Browse files Browse the repository at this point in the history
  • Loading branch information
Hrishabh17 authored Jun 6, 2024
2 parents 555a72c + 56ddf07 commit 05a8a02
Show file tree
Hide file tree
Showing 8 changed files with 29 additions and 25 deletions.
2 changes: 1 addition & 1 deletion apps/accounting_exports/serializers.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ class ExpenseSerializer(serializers.ModelSerializer):

class Meta:
model = Expense
fields = ['updated_at', 'claim_number', 'employee_email', 'employee_name', 'fund_source', 'expense_number', 'payment_number', 'vendor', 'category', 'amount', 'report_id', 'settlement_id', 'expense_id', 'org_id']
fields = ['updated_at', 'claim_number', 'employee_email', 'employee_name', 'fund_source', 'expense_number', 'payment_number', 'vendor', 'category', 'amount', 'report_id', 'expense_id', 'org_id']


class AccountingExportSerializer(serializers.ModelSerializer):
Expand Down
17 changes: 17 additions & 0 deletions apps/fyle/migrations/0004_remove_expense_settlement_id.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
# Generated by Django 4.1.2 on 2024-05-29 16:54

from django.db import migrations


class Migration(migrations.Migration):

dependencies = [
('fyle', '0003_alter_expensefilter_custom_field_type'),
]

operations = [
migrations.RemoveField(
model_name='expense',
name='settlement_id',
),
]
2 changes: 0 additions & 2 deletions apps/fyle/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,6 @@ class Expense(BaseForeignWorkspaceModel):
currency = StringNotNullField(max_length=5, help_text='Home Currency')
foreign_amount = FloatNullField(help_text='Foreign Amount')
foreign_currency = StringNullField(max_length=5, help_text='Foreign Currency')
settlement_id = StringNullField(help_text='Settlement ID')
reimbursable = BooleanFalseField(help_text='Expense reimbursable or not')
state = StringNotNullField(help_text='Expense state')
vendor = StringNullField(help_text='Vendor')
Expand Down Expand Up @@ -148,7 +147,6 @@ def create_expense_objects(expenses: List[Dict], workspace_id: int):
'foreign_currency': expense['foreign_currency'],
'tax_amount': expense['tax_amount'],
'tax_group_id': expense['tax_group_id'],
'settlement_id': expense['settlement_id'],
'reimbursable': expense['reimbursable'],
'billable': expense['billable'] if expense['billable'] else False,
'state': expense['state'],
Expand Down
4 changes: 2 additions & 2 deletions apps/sage300/exports/purchase_invoice/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ def create_or_update_object(self, accounting_export: AccountingExport, advance_s
purchase_invoice, _ = PurchaseInvoice.objects.update_or_create(
accounting_export=accounting_export,
defaults={
'amount': amount,
'amount': round(amount, 2),
'vendor_id': vendor_id,
'description': description,
'invoice_date': invoice_date,
Expand Down Expand Up @@ -143,7 +143,7 @@ def create_or_update_object(self, accounting_export: AccountingExport, advance_s
purchase_invoice_id=purchase_invoice.id,
expense_id=lineitem.id,
defaults={
'amount': lineitem.amount,
'amount': round(lineitem.amount, 2),
'accounts_payable_account_id': account.destination_account.destination_id,
'job_id': job_id,
'commitment_id': commitment_id,
Expand Down
14 changes: 7 additions & 7 deletions apps/workspaces/tasks.py
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
from typing import List
import logging
from datetime import datetime, timedelta
from typing import List

from django_q.models import Schedule

from apps.workspaces.models import ExportSetting, AdvancedSetting, FyleCredential
from apps.accounting_exports.models import AccountingExport, AccountingExportSummary
from apps.sage300.exports.purchase_invoice.tasks import ExportPurchaseInvoice
from apps.fyle.queue import queue_import_credit_card_expenses, queue_import_reimbursable_expenses
from apps.sage300.exports.direct_cost.tasks import ExportDirectCost
from apps.fyle.queue import queue_import_reimbursable_expenses, queue_import_credit_card_expenses

from apps.sage300.exports.purchase_invoice.tasks import ExportPurchaseInvoice
from apps.workspaces.models import AdvancedSetting, ExportSetting, FyleCredential

logger = logging.getLogger(__name__)

Expand Down Expand Up @@ -51,7 +51,7 @@ def run_import_export(workspace_id: int, export_mode = None):

if accounting_export.status == 'COMPLETE':
accounting_export_ids = AccountingExport.objects.filter(
fund_source='PERSONAL', exported_at__isnull=True).values_list('id', flat=True)
fund_source='PERSONAL', exported_at__isnull=True, workspace_id=workspace_id).values_list('id', flat=True)

if len(accounting_export_ids):
is_expenses_exported = True
Expand All @@ -67,7 +67,7 @@ def run_import_export(workspace_id: int, export_mode = None):
)
if accounting_export.status == 'COMPLETE':
accounting_export_ids = AccountingExport.objects.filter(
fund_source='CCC', exported_at__isnull=True).values_list('id', flat=True)
fund_source='CCC', exported_at__isnull=True, workspace_id=workspace_id).values_list('id', flat=True)

if len(accounting_export_ids):
is_expenses_exported = True
Expand Down
2 changes: 2 additions & 0 deletions requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -28,9 +28,11 @@ fyle==0.36.1

# Reusable Fyle Packages
fyle-rest-auth==1.7.2

fyle-accounting-mappings==1.33.0
fyle-integrations-platform-connector==1.36.3


# Postgres Dependincies
psycopg2-binary==2.9.9

Expand Down
6 changes: 0 additions & 6 deletions tests/test_fyle/fixtures.py
Original file line number Diff line number Diff line change
Expand Up @@ -363,7 +363,6 @@
'currency': 'USD',
'foreign_amount': None,
'foreign_currency': None,
'settlement_id': 'seteYqkAfuWOS',
'reimbursable': True,
'billable': False,
'state': 'PAID',
Expand Down Expand Up @@ -409,7 +408,6 @@
'currency': 'USD',
'foreign_amount': None,
'foreign_currency': None,
'settlement_id': 'seteYqkAfuWOS',
'reimbursable': True,
'billable': False,
'state': 'PAID',
Expand Down Expand Up @@ -453,7 +451,6 @@
'currency': 'USD',
'foreign_amount': None,
'foreign_currency': None,
'settlement_id': 'seteYqkAfuWOS',
'reimbursable': True,
'billable': False,
'state': 'PAID',
Expand Down Expand Up @@ -495,7 +492,6 @@
'currency': 'USD',
'foreign_amount': None,
'foreign_currency': None,
'settlement_id': 'seteYqkAfuWOS',
'reimbursable': True,
'billable': False,
'state': 'PAID',
Expand Down Expand Up @@ -539,7 +535,6 @@
'currency': 'USD',
'foreign_amount': None,
'foreign_currency': None,
'settlement_id': 'seteYqkAfuWOS',
'reimbursable': True,
'billable': False,
'state': 'PAID',
Expand Down Expand Up @@ -581,7 +576,6 @@
'currency': 'USD',
'foreign_amount': None,
'foreign_currency': None,
'settlement_id': 'seteYqkAfuWOS',
'reimbursable': True,
'billable': False,
'state': 'PAID',
Expand Down
7 changes: 0 additions & 7 deletions tests/test_mappings/fixtures.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@
"currency": "USD",
"foreign_amount": None,
"foreign_currency": None,
"settlement_id": "seteYqkAfuWOS",
"reimbursable": True,
"billable": False,
"state": "PAID",
Expand Down Expand Up @@ -70,7 +69,6 @@
"currency": "USD",
"foreign_amount": None,
"foreign_currency": None,
"settlement_id": "seteYqkAfuWOS",
"reimbursable": True,
"billable": False,
"state": "PAID",
Expand Down Expand Up @@ -151,7 +149,6 @@
"paid_at": None,
"purpose": "C/2022/01/R/2;Ashwin",
"reimbursement_number": "P/2022/01/R/2",
"settlement_id": "setgCxsr2vTmZ",
"updated_at": "2022-01-20T16:30:44.584100",
"user_id": "usqywo0f3nBY",
}
Expand Down Expand Up @@ -256,7 +253,6 @@
"category": "Food",
"amount": 21.0,
"report_id": "dummy_report_id",
"settlement_id": "dummy_settlement_id",
"expense_id": "dummy_expense_id",
}
],
Expand Down Expand Up @@ -581,7 +577,6 @@
"paid_at": None,
"purpose": "C/2022/05/R/6;Ashwin",
"reimbursement_number": "P/2022/05/R/6",
"settlement_id": "set0mrwTTgoHA",
"updated_at": "2022-05-06T06:32:51.665316",
"user_id": "usqywo0f3nBY",
}
Expand Down Expand Up @@ -746,7 +741,6 @@
"foreign_amount": None,
"foreign_currency": None,
"report_title": "report title 11",
"settlement_id": "seteYqkAfuWOSs",
"reimbursable": True,
"billable": False,
"state": "PAID",
Expand Down Expand Up @@ -786,7 +780,6 @@
"foreign_amount": None,
"foreign_currency": None,
"report_title": "report 21",
"settlement_id": "set5PSfKaloaCs",
"employee_name": "Naruto",
"reimbursable": True,
"billable": False,
Expand Down

0 comments on commit 05a8a02

Please sign in to comment.