ananthakumaran / paisa

Paisa – Personal Finance Manager. https://paisa.fyi demo: https://demo.paisa.fyi
https://paisa.fyi
GNU Affero General Public License v3.0
2.24k stars 111 forks source link

Formatting errors in ledger file includes #170

Closed jasperrooduijn closed 5 months ago

jasperrooduijn commented 5 months ago

When using this transaction in main.ledger file syncing the journal is fine. But when using the same transaction inside an include file which is included in the main.ledger it's not possible to sync the journal.

main.ledger looks like this:

include accounts/account-a.ledger 

account-a.ledger looks like:

2024/01/20 Opening Balances
    Assets:Checking:A               € 0.00
    Equity:OpeningBalances

The following error is thrown:

Paisa
Failed to sync

  Assets:Checking:A               € 0.00
                                                  ^^^^^^^^
Error: Incorrect use of thousand-mark period
ananthakumaran commented 5 months ago

@jasperrooduijn do you have any commodity directive in the main file or any other files? There is one edge case that is not handled as of today. If you have a commodity directive on the main file, but the subfile doesn't have it, it will work when you validate the main file, but the subfile might not be valid (if tested in isolation). Paisa validates each file in isolation, I think I need to always validate the main file and show errors related to the current file to avoid this problem.

jasperrooduijn commented 5 months ago

Thanks for the quick reply!

do you have any commodity directive in the main file or any other files

No. The files as shown above is whats inside.

My config settings are the following:

image image

I just tested it again and found some extra information. The error only occurs when i edit my ledger files in VSC and sync the journal afterwards. If i edit them in the Paisa editor and save they will be saved without error. To summarise the Incorrect use of thousand-mark period error only occurs when saving a value like € 0.00 in a imported ledger file, when edited in VSC and synced afterwards.

Seems like an edge case, but as a developer i'm more keen in editing the ledger files in my VSC editor.

ananthakumaran commented 5 months ago

I am unsure if this has to do anything with using EUR as the default currency but using in the ledger file. But I don't know how that could result in the above error.

jasperrooduijn commented 5 months ago

I am unsure if this has to do anything with using EUR as the default currency but using in the ledger file. But I don't know how that could result in the above error.

The weird thing is that the same setup, config and ledger files don't give an error when editing in the Paisa editor and syncing the journal. It only happens after editing the ledger files in VSC and syncing the journal.

So not sure if this has anything to do with the EUR vs € configuration / usage.

jasperrooduijn commented 5 months ago

This seems to be something related to Ledger CLI and not specific to Paise. I will take a deeper dive later and will let you know.

jasperrooduijn commented 5 months ago

This can be closed. It was not related to Paisa. Thanks for helping.