Conversation
Diff Coverage
|
📝 WalkthroughWalkthroughThe pull request modifies the journal entries export module to improve date handling. It introduces formatting of the journal entry date using a Poem
🚥 Pre-merge checks | ✅ 2 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (2 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Inline comments:
In `@apps/sage_intacct/exports/journal_entries.py`:
- Line 50: format_transaction_date will raise when passed None because it calls
.strftime; update the call site and/or the formatter to safely handle nullable
JournalEntry.transaction_date: check JournalEntry.transaction_date for None
before calling format_transaction_date (or modify format_transaction_date to
accept Optional[datetime] and return None/empty string when input is None), then
assign transaction_date accordingly so exports do not crash; reference symbols:
JournalEntry.transaction_date, format_transaction_date, and the local variable
transaction_date.
| general_mappings=general_mappings | ||
| ) | ||
|
|
||
| transaction_date = format_transaction_date(journal_entry.transaction_date) |
There was a problem hiding this comment.
🧩 Analysis chain
🏁 Script executed:
#!/bin/bash
# Find the JournalEntry model definition
fd -e py -x rg -l "class JournalEntry" {} \;Repository: fylein/fyle-intacct-api
Length of output: 96
🏁 Script executed:
#!/bin/bash
# Search for transaction_date field definition in models
rg -n "transaction_date" --type py -B5 -A5Repository: fylein/fyle-intacct-api
Length of output: 50379
🏁 Script executed:
#!/bin/bash
# Check the format_transaction_date function in helpers.py
cat -n apps/sage_intacct/exports/helpers.pyRepository: fylein/fyle-intacct-api
Length of output: 7234
format_transaction_date will crash if transaction_date is None.
The function has no guard against None input — it will raise AttributeError on None.strftime(...). Since JournalEntry.transaction_date is defined as nullable (DateTimeField(null=True)), this is a runtime crash waiting to happen on any export with a null transaction date.
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.
In `@apps/sage_intacct/exports/journal_entries.py` at line 50,
format_transaction_date will raise when passed None because it calls .strftime;
update the call site and/or the formatter to safely handle nullable
JournalEntry.transaction_date: check JournalEntry.transaction_date for None
before calling format_transaction_date (or modify format_transaction_date to
accept Optional[datetime] and return None/empty string when input is None), then
assign transaction_date accordingly so exports do not crash; reference symbols:
JournalEntry.transaction_date, format_transaction_date, and the local variable
transaction_date.
No description provided.