[FIX] partner_statement: avoid showing lines with 0.00001 open amounts
parent
c590baaf9e
commit
673779be7b
|
@ -2,6 +2,7 @@
|
||||||
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl.html).
|
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl.html).
|
||||||
|
|
||||||
from odoo import api, models
|
from odoo import api, models
|
||||||
|
from odoo.tools.float_utils import float_is_zero
|
||||||
|
|
||||||
|
|
||||||
class OutstandingStatement(models.AbstractModel):
|
class OutstandingStatement(models.AbstractModel):
|
||||||
|
@ -139,6 +140,11 @@ class OutstandingStatement(models.AbstractModel):
|
||||||
res[row.pop("partner_id")].append(row)
|
res[row.pop("partner_id")].append(row)
|
||||||
return res
|
return res
|
||||||
|
|
||||||
|
def _add_currency_line(self, line, currency):
|
||||||
|
if float_is_zero(line["open_amount"], precision_rounding=currency.rounding):
|
||||||
|
return []
|
||||||
|
return [line]
|
||||||
|
|
||||||
@api.model
|
@api.model
|
||||||
def _get_report_values(self, docids, data=None):
|
def _get_report_values(self, docids, data=None):
|
||||||
if not data:
|
if not data:
|
||||||
|
|
|
@ -287,6 +287,9 @@ class ReportStatementCommon(models.AbstractModel):
|
||||||
currencies,
|
currencies,
|
||||||
)
|
)
|
||||||
|
|
||||||
|
def _add_currency_line(self, line, currency):
|
||||||
|
return [line]
|
||||||
|
|
||||||
@api.model
|
@api.model
|
||||||
def _get_report_values(self, docids, data=None):
|
def _get_report_values(self, docids, data=None):
|
||||||
# flake8: noqa: C901
|
# flake8: noqa: C901
|
||||||
|
@ -396,7 +399,9 @@ class ReportStatementCommon(models.AbstractModel):
|
||||||
line["date_maturity"] = format_date(
|
line["date_maturity"] = format_date(
|
||||||
line["date_maturity"], date_formats.get(partner_id, default_fmt)
|
line["date_maturity"], date_formats.get(partner_id, default_fmt)
|
||||||
)
|
)
|
||||||
line_currency["lines"].append(line)
|
line_currency["lines"].extend(
|
||||||
|
self._add_currency_line(line, currencies[line["currency_id"]])
|
||||||
|
)
|
||||||
|
|
||||||
if data["show_aging_buckets"]:
|
if data["show_aging_buckets"]:
|
||||||
for line in buckets[partner_id]:
|
for line in buckets[partner_id]:
|
||||||
|
|
Loading…
Reference in New Issue