mikee at saxicola.co.uk
Thu Aug 7 10:27:32 EDT 2014
On Wed, 06 Aug 2014 18:01:52 +0200
Geert Janssens <janssens-geert at telenet.be> wrote:
> On Wednesday 06 August 2014 16:00:21 Mike Evans wrote:
> > HiGeert.
> > n is set to 25 using gnc_exp_parser_parse (discount, &n, NULL); just
> > after it's set to gnc_numeric_zero (); Taking the zeroing line out
> > doesn't change the behaviour though.
> Oh right. Probably this isn't working for me because my decimal separator is ",".
> Sorry for the false suggestion.
> > Where discount is read from the file. When the invoice is opened
> > after import the 25.00 is shown in the discount column but the price
> > hasn't been discounted, the line total is still at original price.
> > The gncEntryGetDocDiscountValue () function calls the
> > gncEntry::gncEntryRecomputeValues() function which should set he
> > discount to be applied.
> Yes, it does. As an aside This is a horribly backward way of doing things and source of various
> bugs. We should definitely fix this at some point.
> I fixed the import file for my locale and reran the debugger. The gncEntryRecomputeValues
> function effectively does nothing in this case because the entry has no Invoice tax table set.
> The recalculation only happens when there is either a bill or an invoice tax table.
> So that would explain why the discount is not substracted.
Ah found it by looking in the .gnucash xml file. The discount is saved as 25/1 and the price as 75/1. In gncEntryComputeValues() the denom is read from the currency, ie 100 so it divides 25 by the denom and gets the wrong answers which is effectively zero. Hence no discount. I need to run gnc_numeric_convert(...) to set the denom correctly.
Thanks Geert, sometimes just asking the questions "out loud" is what's needed. :)
Anti NSA? Use PGP.
More information about the gnucash-devel