<commit_before># Copyright 2018 Open Source Integrators (http://www.opensourceintegrators.com)
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
from dateutil.relativedelta import relativedelta

from odoo import api, fields, models


class AccountMove(models.Model):
    _inherit = "account.move"

    discount_amt = fields.Monetary(
        "Discount Possible",
        help="Discount amount possible with the given payment term",
        compute="_compute_discount_amt",
        store=True,
    )
    discount_date = fields.Date(
        "Discount Date",
        compute="_compute_discount_date",
        help="Compute discount on the invoice based on the payment term discount "
        "percentage."
        "and the current date",
        store=True,
    )
    discount_taken = fields.Monetary("Discount taken", copy=False)
    check_payment_discount = fields.Boolean(
        "Check Payment Discount", compute="_compute_payment_disc"
    )
    shipping_lines_total = fields.Monetary(
        "Shippling Lines Total",
        help="Exclude shipping lines total from discount if applicable " "in terms",
        compute="_compute_shipping_lines_total",
    )

    @api.onchange("amount_residual", "invoice_payment_term_id", "invoice_date")
    @api.depends("state")
    def _compute_discount_amt(self):
        for invoice in self:
            if invoice.invoice_payment_term_id:
                discount_information = (
                    invoice.invoice_payment_term_id._check_payment_term_discount(
                        invoice
                    )
                )
                if discount_information[0] > 0.0:
                    invoice.discount_amt = abs(round(discount_information[0], 2))
                    # If discount taken make disc amt to 0 as disc is no more valid
                    if invoice.discount_taken != 0:
                        invoice.discount_amt = 0
                else:
                    invoice.discount_amt = 0.0

    @api.depends("invoice_date", "invoice_payment_term_id")
    def _compute_discount_date(self):<commit_msg>[FIX] account_payment_term_discount: fix Shippling typo<commit_after># Copyright 2018 Open Source Integrators (http://www.opensourceintegrators.com)
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
from dateutil.relativedelta import relativedelta

from odoo import api, fields, models


class AccountMove(models.Model):
    _inherit = "account.move"

    discount_amt = fields.Monetary(
        "Discount Possible",
        help="Discount amount possible with the given payment term",
        compute="_compute_discount_amt",
        store=True,
    )
    discount_date = fields.Date(
        "Discount Date",
        compute="_compute_discount_date",
        help="Compute discount on the invoice based on the payment term discount "
        "percentage."
        "and the current date",
        store=True,
    )
    discount_taken = fields.Monetary("Discount taken", copy=False)
    check_payment_discount = fields.Boolean(
        "Check Payment Discount", compute="_compute_payment_disc"
    )
    shipping_lines_total = fields.Monetary(
        "Shipping Lines Total",
        help="Exclude shipping lines total from discount if applicable " "in terms",
        compute="_compute_shipping_lines_total",
    )

    @api.onchange("amount_residual", "invoice_payment_term_id", "invoice_date")
    @api.depends("state")
    def _compute_discount_amt(self):
        for invoice in self:
            if invoice.invoice_payment_term_id:
                discount_information = (
                    invoice.invoice_payment_term_id._check_payment_term_discount(
                        invoice
                    )
                )
                if discount_information[0] > 0.0:
                    invoice.discount_amt = abs(round(discount_information[0], 2))
                    # If discount taken make disc amt to 0 as disc is no more valid
                    if invoice.discount_taken != 0:
                        invoice.discount_amt = 0
                else:
                    invoice.discount_amt = 0.0

    @api.depends("invoice_date", "invoice_payment_term_id")
    def _compute_discount_date(self):
{'fraction_non_alphanumeric': 0.08461720786916331, 'fraction_numerical': 0.007584735719364778, 'mean_word_length': 2.384121892542101, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 4, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '7482127', 'n_tokens_mistral': 1223, 'n_tokens_neox': 1175, 'n_words': 273}