Skip to content

Commit

Permalink
[FIX] account_invoice_report_grouped_by_picking: Method abs is called…
Browse files Browse the repository at this point in the history
… when remaining_qty is near of zero

TT51353
  • Loading branch information
carlosdauden committed Oct 17, 2024
1 parent e02f3c4 commit a38da1d
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions account_invoice_report_grouped_by_picking/models/account_move.py
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
# Copyright 2017-2023 Tecnativa - Carlos Dauden
# Copyright 2017-2024 Tecnativa - Carlos Dauden
# Copyright 2018 Tecnativa - David Vidal
# Copyright 2018-2019 Tecnativa - Pedro M. Baeza
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
import datetime
from collections import OrderedDict

from odoo import api, models
from odoo.tools import float_is_zero
from odoo.tools import float_round


class AccountMove(models.Model):
Expand Down Expand Up @@ -140,6 +140,9 @@ def lines_grouped_by_picking(self):
remaining_qty -= qty
# To avoid to print duplicate lines because the invoice is a refund
# without returned goods to refund.
remaining_qty = float_round(
remaining_qty, precision_rounding=line.product_id.uom_id.rounding
)
if (
self.move_type == "out_refund"
and not has_returned_qty
Expand All @@ -150,10 +153,7 @@ def lines_grouped_by_picking(self):
remaining_qty = 0.0
for key in picking_dict:
picking_dict[key] = abs(picking_dict[key])
if not float_is_zero(
remaining_qty,
precision_rounding=line.product_id.uom_id.rounding or 0.01,
):
if remaining_qty:
lines_dict[line] = remaining_qty
no_picking = [
{"picking": picking_obj, "line": key, "quantity": value}
Expand Down

0 comments on commit a38da1d

Please sign in to comment.