-
-
Notifications
You must be signed in to change notification settings - Fork 482
Expand file tree
/
Copy pathaccount_payment_term.py
More file actions
20 lines (15 loc) · 803 Bytes
/
account_payment_term.py
File metadata and controls
20 lines (15 loc) · 803 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
# Copyright 2025 ForgeFlow S.L. (https://www.forgeflow.com)
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
from odoo import models
class AccountPaymentTerm(models.Model):
_inherit = "account.payment.term"
def apply_payment_days(self, line, date):
"""Calculate the new date taking into account the partner payment days"""
partner_id = self.env.context.get("partner_id")
if partner_id:
partner = self.env["res.partner"].browse(partner_id)
payment_days = partner._get_payment_days()
if payment_days:
decoded_payment_days = line._decode_payment_days(payment_days)
return self._get_payment_days_due_date(date, decoded_payment_days)
return super().apply_payment_days(line, date)