bemade-addons/account_credit_hold/models/sale_order.py
Marc Durepos 5adce1fd15 [MIG] 17.0..18.0 account_credit_hold
Migrated module account_credit_hold from 17.0 to 18.0. Fixed views and
models and wrote test cases to check functionality.
2025-09-04 12:33:00 -04:00

16 lines
703 B
Python

from odoo import fields, models, api, _
from odoo.exceptions import UserError
class SaleOrder(models.Model):
_inherit = "sale.order"
client_on_hold = fields.Boolean(string='Client on Hold',
help="Whether or not a client has been put on hold due to unpaid invoices.",
related="partner_id.on_hold")
def action_confirm(self):
if any(self.mapped('client_on_hold')):
raise UserError(_("This client is on credit hold. No new orders can be confirmed until past-due invoices "
"are paid or the accounting team postpones the hold."))
return super().action_confirm()