imp: journal: remove the "adjacent conversion postings" check again

I find that single conversion postings are sometimes needed, eg with
paypal.
This commit is contained in:
Simon Michael 2023-01-30 16:13:06 -10:00
parent c7eb9aa944
commit c51ebe7b8c
3 changed files with 6 additions and 23 deletions

View File

@ -337,7 +337,8 @@ journalFinalise iopts@InputOpts{..} f txt pj = do
when strict_ $ do when strict_ $ do
journalCheckAccounts j -- If in strict mode, check all postings are to declared accounts journalCheckAccounts j -- If in strict mode, check all postings are to declared accounts
journalCheckCommodities j -- and using declared commodities journalCheckCommodities j -- and using declared commodities
journalCheckPairedConversionPostings j -- check conversion postings are in adjacent pairs -- journalCheckPairedConversionPostings j -- check conversion postings are in adjacent pairs
-- disabled for now, single conversion postings are sometimes needed eg with paypal
return j return j

View File

@ -422,7 +422,6 @@ With the `-s`/`--strict` flag, additional checks are performed:
- Are all commodities declared with a `commodity` directive ? - Are all commodities declared with a `commodity` directive ?
([Commodity error checking](#commodity-error-checking)) ([Commodity error checking](#commodity-error-checking))
- Are all commodity conversions declared explicitly ? - Are all commodity conversions declared explicitly ?
- Are all commodity conversion equity postings occurring in adjacent pairs ?
You can use the [check](#check) command to run individual checks -- the You can use the [check](#check) command to run individual checks -- the
ones listed above and some more. ones listed above and some more.

View File

@ -506,24 +506,7 @@ $ hledger -f- print --infer-costs
>=0 >=0
# 39. In strict mode, conversion postings must be in adjacent pairs. # 39. If a conversion pair matches several postings it should throw an error
<
account assets
account equity:conversion
account expenses:foreign currency
commodity €0.
commodity $0.
2011/01/01
expenses:foreign currency €100
equity:conversion €-100
assets $-135
equity:conversion $135
$ hledger -f- print -s
>2 /Conversion postings must occur in adjacent pairs/
>=1
# 40. If a conversion pair matches several postings it should throw an error
< <
2011/01/01 2011/01/01
expenses:foreign currency €100 @@ $135 expenses:foreign currency €100 @@ $135
@ -537,7 +520,7 @@ $ hledger -f- print --infer-costs
>2 /There is not a unique posting which matches the conversion posting pair/ >2 /There is not a unique posting which matches the conversion posting pair/
>=1 >=1
# 41. If a conversion pair does not match it should throw an error # 42. If a conversion pair does not match it should throw an error
< <
2011/01/01 2011/01/01
expenses:foreign currency €120 expenses:foreign currency €120
@ -551,7 +534,7 @@ $ hledger -f- print --infer-costs
>2 /There is not a unique posting which matches the conversion posting pair/ >2 /There is not a unique posting which matches the conversion posting pair/
>=1 >=1
# 42. Multiple conversion pairs which match a single posting should cause an # 43. Multiple conversion pairs which match a single posting should cause an
# error, and should not match both sides of the conversion # error, and should not match both sides of the conversion
< <
2011/01/01 2011/01/01
@ -567,7 +550,7 @@ $ hledger -f- print --infer-costs
>2 /There is not a unique posting which matches the conversion posting pair/ >2 /There is not a unique posting which matches the conversion posting pair/
>=1 >=1
# 43. We can combine other amounts into one posting, if they still match up. # 44. We can combine other amounts into one posting, if they still match up.
< <
2011-01-01 2011-01-01
expenses:foreign currency €100 @ $1.35 expenses:foreign currency €100 @ $1.35