diff --git a/osi_avatax_rounding_fix/__init__.py b/osi_avatax_rounding_fix/__init__.py new file mode 100644 index 000000000..0650744f6 --- /dev/null +++ b/osi_avatax_rounding_fix/__init__.py @@ -0,0 +1 @@ +from . import models diff --git a/osi_avatax_rounding_fix/__manifest__.py b/osi_avatax_rounding_fix/__manifest__.py new file mode 100644 index 000000000..a686498da --- /dev/null +++ b/osi_avatax_rounding_fix/__manifest__.py @@ -0,0 +1,18 @@ +# -*- coding: utf-8 -*- + +{ # noqa + "name": "Proslat Accounting Enhancement", + "summary": "Proslat Accounting Enhancement", + "version": "17.0.1.0.0", + "author": "Open Source Integrators", + "category": "Accounting", + "depends": [ + 'account_avatax_sale_oca', + ], + "data": [ + ], + "application": False, + "installable": True, + "auto_install": False +} + diff --git a/osi_avatax_rounding_fix/models/__init__.py b/osi_avatax_rounding_fix/models/__init__.py new file mode 100644 index 000000000..b60632946 --- /dev/null +++ b/osi_avatax_rounding_fix/models/__init__.py @@ -0,0 +1 @@ +from . import account_tax diff --git a/osi_avatax_rounding_fix/models/account_tax.py b/osi_avatax_rounding_fix/models/account_tax.py new file mode 100644 index 000000000..bad19bb62 --- /dev/null +++ b/osi_avatax_rounding_fix/models/account_tax.py @@ -0,0 +1,14 @@ +from odoo import api, fields, models + + +class AccountTax(models.Model): + _inherit = 'account.tax' + + @api.model + def _prepare_tax_totals(self, base_lines, currency, tax_lines=None, is_company_currency_requested=False): + vals = super()._prepare_tax_totals(base_lines, currency, tax_lines, is_company_currency_requested) + if vals.get('amount_untaxed'): + vals['amount_untaxed'] = round(vals['amount_untaxed'], 2) + if vals.get('amount_total'): + vals['amount_total'] = round(vals['amount_total'], 2) + return vals