Skip to content

Commit

Permalink
Merge PR OCA#3476 into 16.0
Browse files Browse the repository at this point in the history
Signed-off-by HaraldPanten
  • Loading branch information
OCA-git-bot committed Mar 21, 2024
2 parents 5a11910 + fe17709 commit 8d2d5fc
Showing 1 changed file with 20 additions and 1 deletion.
21 changes: 20 additions & 1 deletion l10n_es_sigaus_sale/models/sale_order_line.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
# Copyright 2023 Manuel Regidor <[email protected]>
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl).

from odoo import models
from odoo import api, models
from odoo.tools import float_compare


class SaleOrderLine(models.Model):
Expand All @@ -21,3 +22,21 @@ def _prepare_invoice_line(self, **optional_values):
res = super()._prepare_invoice_line(**optional_values)
res["is_sigaus"] = self.is_sigaus
return res

@api.depends("is_sigaus")
def _compute_invoice_status(self):
precision = self.env["decimal.precision"].precision_get(
"Product Unit of Measure"
)
sigaus_lines = self.filtered("is_sigaus")
for line in sigaus_lines:
if (
float_compare(
line.qty_invoiced, line.product_uom_qty, precision_digits=precision
)
>= 0
):
line.invoice_status = "invoiced"
else:
line.invoice_status = "no"
return super(SaleOrderLine, self - sigaus_lines)._compute_invoice_status()

0 comments on commit 8d2d5fc

Please sign in to comment.