mollie / mollie-odoo

Mollie Payments plugin for Odoo - an open source CRM and ERP
29 stars 49 forks source link

Rounding issue (negative discount) in 12.0 #67

Closed PCatinean closed 4 years ago

PCatinean commented 4 years ago

When a sale_order_line with the following data is present on a sale.order it computes a negative discount which prevents the payment from going through.

{
    'discountAmount': {'currency': 'EUR', 'value': '-0.02'},
    'quantity': 2,
    'totalAmount': {'currency': 'EUR', 'value': '32.23'},
    'type': 'physical',
    'unitPrice': {'currency': 'EUR', 'value': '16.11'},
    'vatAmount': {'currency': 'EUR', 'value': '5.15'},
    'vatRate': '19.00'
}

This is issue is because the total value 32.23 is divided by the qty (2) which results in 16,115.

Mollie's line.price_unit_taxinc returns 16.11 and line.price_unit_taxinc is 16.12 giving us the negative discount.

PCatinean commented 4 years ago

Tested https://github.com/mollie/mollie-odoo/pull/66 in staging and this seems to have fixed the problem! Discount is now 0 again :) thank you!

odooexpertsbv commented 4 years ago

@PCatinean Thank you for test.