Correction : Format.Ledger.Read.amount : utilise l’Unit par défaut si présente
authorJulien Moutinho <julm+hcompta@autogeree.net>
Fri, 15 May 2015 03:43:23 +0000 (05:43 +0200)
committerJulien Moutinho <julm+hcompta@autogeree.net>
Fri, 15 May 2015 03:54:18 +0000 (05:54 +0200)
lib/Hcompta/Format/Ledger/Read.hs

index 7335b6f8fff37110f4ac8ff1f2676f38858f8487..250d18d2b7dc17d9cb70271d7e29e50c2a1cd5ae 100644 (file)
@@ -534,8 +534,13 @@ posting = (do
                 [ do
                        _ <- R.count 2 R.space_horizontal
                        R.skipMany $ R.space_horizontal
-                       maybe id
-                        (\(u, s) -> Data.Map.adjust (\a -> a{Amount.style=s, Amount.unit=u}) Unit.nil)
+                       maybe id (\(u, s) ->
+                               if u == Unit.nil then id
+                               else
+                                       Data.Map.adjust (\a ->
+                                               a{ Amount.style = s{Style.precision = Style.precision $ Amount.style a}
+                                                , Amount.unit  = u })
+                                        Unit.nil)
                         (context_unit_and_style ctx) .
                         Amount.from_List <$> do
                                R.many_separated amount $ do