On 22/01/12 08:36 -0800, Giedrius Slavinskas wrote:
> 
> On Dec 29 2011, 6:29 pm, Cédric Krier <[email protected]> wrote:
> >
> > All this misunderstanding comes from the point that you are looking at
> > tax included price which can not work and will not work in the ERP.
> > If you have such needs, you must define a way to retro-compute the taxes
> > for each line you are saling.
> >
> 
> I must agree, it is a bit different way of computing prices. It would
> be not suitable for other business except retailers.
> 
> But the current tax computation is still inaccurate. I've made a fix
> in the third patchset here:
> http://codereview.tryton.org/210007
> 
> In the patch taxes are calculated like this:
> tax_group_amount = round( round(line_total)*tax_group_rate +
> round(line_total)*tax_group_rate + ... )
> 
> it is identical (no accuracy lost) to: tax_group_amount =
> round( round(tax_group_base) * tax_group_rate )
> 
> It fixes inaccuracies in such a invoice:
> Line1: unitprice=0.1260, quantity=1, subtotal=0.13
> Line2: unitprice=0.1260, quantity=1, subtotal=0.13
> Line3: unitprice=0.1260, quantity=1, subtotal=0.13
> Line4: unitprice=0.1260, quantity=1, subtotal=0.13
> Line5: unitprice=0.1260, quantity=1, subtotal=0.13
> With patch:
> vat_21_base=0.65, VAT_21%=0.14 (correct because 0.65 * 0.21 = 0.14)
> 
> Without patch:
> vat_21_base=0.65, VAT_21%=0.13 (wrong)

Sorry but it is correct because if you get a line like this:

Line1: unitprice=0.1260, quantity=5, subtotal=0.63

vat_21_base=0.63, VAT_21%=0.13

The way, we implemented, is to have the same value if we compute with 1
or 5 lines.

But of course, it is impossible to have an implementation that will
always work the best for every cases.

Morevover, your example is a case that should never happen in real life.

-- 
Cédric Krier

B2CK SPRL
Rue de Rotterdam, 4
4000 Liège
Belgium
Tel: +32 472 54 46 59
Email/Jabber: [email protected]
Website: http://www.b2ck.com/

Attachment: pgpZxJ46oF0hW.pgp
Description: PGP signature

Reply via email to