Skip to content

Commit

Permalink
Fix Netsuite Custom Link (#594)
Browse files Browse the repository at this point in the history
* Fix Netsuite Custom Link

* Fix tests
  • Loading branch information
ruuushhh authored Jun 14, 2024
1 parent b57b328 commit 436268a
Show file tree
Hide file tree
Showing 2 changed files with 104 additions and 0 deletions.
71 changes: 71 additions & 0 deletions apps/netsuite/connector.py
Original file line number Diff line number Diff line change
Expand Up @@ -1082,6 +1082,13 @@ def construct_bill_lineitems(
'value': attachment_links[expense.expense_id]
}
)
netsuite_custom_segments.append(
{
'scriptId': 'custcolfyle_receipt_link_2',
'type': 'String',
'value': attachment_links[expense.expense_id]
}
)

netsuite_custom_segments.append(
{
Expand All @@ -1094,6 +1101,17 @@ def construct_bill_lineitems(
)
}
)
netsuite_custom_segments.append(
{
'scriptId': 'custcolfyle_expense_url_2',
'type': 'String',
'value': '{}/app/admin/#/enterprise/view_expense/{}?org_id={}'.format(
settings.FYLE_EXPENSE_URL,
expense.expense_id,
org_id
)
}
)

lineitem = {
'orderDoc': None,
Expand Down Expand Up @@ -1378,6 +1396,13 @@ def construct_credit_card_charge_lineitems(
'value': attachment_links[expense.expense_id]
}
)
netsuite_custom_segments.append(
{
'scriptId': 'custcolfyle_receipt_link_2',
'type': 'String',
'value': attachment_links[expense.expense_id]
}
)

netsuite_custom_segments.append(
{
Expand All @@ -1389,6 +1414,16 @@ def construct_credit_card_charge_lineitems(
)
}
)
netsuite_custom_segments.append(
{
'scriptId': 'custcolfyle_expense_url_2',
'value': '{}/app/admin/#/enterprise/view_expense/{}?org_id={}'.format(
settings.FYLE_EXPENSE_URL,
expense.expense_id,
org_id
)
}
)

line = {
'account': {
Expand Down Expand Up @@ -1574,6 +1609,13 @@ def construct_expense_report_lineitems(
'value': attachment_links[expense.expense_id]
}
)
netsuite_custom_segments.append(
{
'scriptId': 'custcolfyle_receipt_link_2',
'type': 'String',
'value': attachment_links[expense.expense_id]
}
)

netsuite_custom_segments.append(
{
Expand All @@ -1586,6 +1628,17 @@ def construct_expense_report_lineitems(
)
}
)
netsuite_custom_segments.append(
{
'scriptId': 'custcolfyle_expense_url_2',
'type': 'String',
'value': '{}/app/admin/#/enterprise/view_expense/{}?org_id={}'.format(
settings.FYLE_EXPENSE_URL,
expense.expense_id,
org_id
)
}
)

lineitem = {
'amount': line.amount - line.tax_amount if (line.tax_item_id and line.tax_amount is not None) else line.amount,
Expand Down Expand Up @@ -1821,6 +1874,13 @@ def construct_journal_entry_lineitems(self, journal_entry_lineitems: List[Journa
'value': attachment_links[expense.expense_id]
}
)
netsuite_custom_segments.append(
{
'scriptId': 'custcolfyle_receipt_link_2',
'type': 'String',
'value': attachment_links[expense.expense_id]
}
)

if debit:
netsuite_custom_segments.append(
Expand All @@ -1834,6 +1894,17 @@ def construct_journal_entry_lineitems(self, journal_entry_lineitems: List[Journa
)
}
)
netsuite_custom_segments.append(
{
'scriptId': 'custcolfyle_expense_url_2',
'type': 'String',
'value': '{}/app/admin/#/enterprise/view_expense/{}?org_id={}'.format(
settings.FYLE_EXPENSE_URL,
expense.expense_id,
org_id
)
}
)

tax_inclusive_amount = round((line.amount - line.tax_amount), 2) if (line.tax_amount is not None and line.tax_item_id ) else line.amount
lineitem = {
Expand Down
33 changes: 33 additions & 0 deletions tests/test_netsuite/fixtures.py
Original file line number Diff line number Diff line change
Expand Up @@ -241,6 +241,11 @@
"scriptId": "custcolfyle_expense_url",
"type": "String",
"value": "https://staging1.fyle.tech/app/admin/#/enterprise/view_expense/txy6folbrG2j?org_id=or79Cob97KSh",
},
{
"scriptId": "custcolfyle_expense_url_2",
"type": "String",
"value": "https://staging1.fyle.tech/app/admin/#/enterprise/view_expense/txy6folbrG2j?org_id=or79Cob97KSh",
}
],
"isBillable": None,
Expand Down Expand Up @@ -395,6 +400,11 @@
"scriptId": "custcolfyle_expense_url",
"type": "String",
"value": "https://staging1.fyle.tech/app/admin/#/enterprise/view_expense/txT4kpMbHdKn1?org_id=or79Cob97KSh",
},
{
"scriptId": "custcolfyle_expense_url_2",
"type": "String",
"value": "https://staging1.fyle.tech/app/admin/#/enterprise/view_expense/txT4kpMbHdKn1?org_id=or79Cob97KSh",
}
],
"isBillable": None,
Expand Down Expand Up @@ -552,6 +562,11 @@
"scriptId": "custcolfyle_expense_url",
"type": "String",
"value": "https://staging1.fyle.tech/app/admin/#/enterprise/view_expense/txT4kpMbHdKn12?org_id=or79Cob97KSh",
},
{
"scriptId": "custcolfyle_expense_url_2",
"type": "String",
"value": "https://staging1.fyle.tech/app/admin/#/enterprise/view_expense/txT4kpMbHdKn12?org_id=or79Cob97KSh",
}
],
"isBillable": None,
Expand Down Expand Up @@ -617,6 +632,11 @@
"scriptId": "custcolfyle_expense_url",
"type": "String",
"value": "https://staging1.fyle.tech/app/admin/#/enterprise/view_expense/txT4kpMbHdKn1?org_id=or79Cob97KSh",
},
{
"scriptId": "custcolfyle_expense_url_2",
"type": "String",
"value": "https://staging1.fyle.tech/app/admin/#/enterprise/view_expense/txT4kpMbHdKn1?org_id=or79Cob97KSh",
}
],
"isBillable": None,
Expand Down Expand Up @@ -785,6 +805,9 @@
'type': 'classification',
},
'customFieldList': [{'scriptId': 'custcolfyle_expense_url',
'type': 'String',
'value': 'None/app/admin/#/enterprise/view_expense/txjvDntD9ZXR?org_id=or79Cob97KSh'
}, {'scriptId': 'custcolfyle_expense_url_2',
'type': 'String',
'value': 'None/app/admin/#/enterprise/view_expense/txjvDntD9ZXR?org_id=or79Cob97KSh'
}],
Expand Down Expand Up @@ -887,6 +910,9 @@
'credit': 120.0,
'creditTax': None,
'customFieldList': [{'scriptId': 'custcolfyle_expense_url',
'type': 'String',
'value': 'None/app/admin/#/enterprise/view_expense/tx7A5QpesrV5?org_id=orHe8CpW2hyN'
},{'scriptId': 'custcolfyle_expense_url_2',
'type': 'String',
'value': 'None/app/admin/#/enterprise/view_expense/tx7A5QpesrV5?org_id=orHe8CpW2hyN'
}],
Expand Down Expand Up @@ -945,6 +971,9 @@
'credit': None,
'creditTax': None,
'customFieldList': [{'scriptId': 'custcolfyle_expense_url',
'type': 'String',
'value': 'None/app/admin/#/enterprise/view_expense/tx7A5QpesrV5?org_id=orHe8CpW2hyN'
},{'scriptId': 'custcolfyle_expense_url_2',
'type': 'String',
'value': 'None/app/admin/#/enterprise/view_expense/tx7A5QpesrV5?org_id=orHe8CpW2hyN'
}],
Expand Down Expand Up @@ -1017,6 +1046,8 @@
'location': {'internalId': None},
'customer': {'internalId': None},
'customFieldList': [{'scriptId': 'custcolfyle_expense_url',
'value': 'None/app/admin/#/enterprise/view_expense/txcKVVELn1Vl?org_id=orHe8CpW2hyN'
},{'scriptId': 'custcolfyle_expense_url_2',
'value': 'None/app/admin/#/enterprise/view_expense/txcKVVELn1Vl?org_id=orHe8CpW2hyN'
}],
'isBillable': False,
Expand Down Expand Up @@ -1053,6 +1084,8 @@
'location': {'internalId': None},
'customer': {'internalId': None},
'customFieldList': [{'scriptId': 'custcolfyle_expense_url',
'value': 'None/app/admin/#/enterprise/view_expense/txcKVVELn1Vl?org_id=orHe8CpW2hyN'
},{'scriptId': 'custcolfyle_expense_url_2',
'value': 'None/app/admin/#/enterprise/view_expense/txcKVVELn1Vl?org_id=orHe8CpW2hyN'
}],
'isBillable': False,
Expand Down

0 comments on commit 436268a

Please sign in to comment.