Hi,
By default, Odoo doesn't have the feature to show a warning when a customer has a payment due.
By simple customization, we can achieve this.
1- Inherit the sale order.
Python
from datetime import date
from odoo import api, fields, models
class SaleOrder(models.Model):
"""Inherits the model sale.order"""
_inherit = 'sale.order'
is_payment_due = fields.Boolean(string="Is payment due", copy=False,
compute="_compute_is_customer_payment_due")
@api.depends('partner_id')
def _compute_is_customer_payment_due(self):
"""Function that check the validity of the KYC documents and
Payment due for the customer"""
payment_due = sum(self.env['account.move'].sudo().search(
[('partner_id', '=', self.partner_id.id),
('payment_state', '!=', 'paid'),
('move_type', '=', 'out_invoice'),
('invoice_date_due', '<=', date.today())]).mapped(
'amount_residual'))
self.is_payment_due = payment_due > 0
XML
<record id="view_order_form" model="ir.ui.view">
<field name="name">sale.order.view.form.inherit</field>
<field name="model">sale.order</field>
<field name="inherit_id" ref="sale.view_order_form"/>
<field name="arch" type="xml">
<xpath expr="//field[@name='partner_id']"
position="before">
<field name="is_payment_due" invisible="1"/>
</xpath>
<xpath expr="//sheet" position="before">
<div role="alert" class="alert alert-danger" style="height:40px, width:30px, margin-bottom:1px;"
invisible="is_payment_due == False or state in ('sale', 'done','cancel')">This customer have payment due after the payment terms</div>
</xpath>
</field>
</record>
By using the above code, we can add a warning message while selecting a customer who has any payment due.
Eg:

If you want to send mail while creating the sale order, add the following function.
def action_confirm(self):
res = super().action_confirm()
if self.is_payment_due:
email_values = {'subject': '#Add email subject',
'email_to': '#Add receiver email',
'auto_delete': False}
mail_template = self.env.ref(
'module_name.email_template_id')
mail_template.with_context(company=self.env.user.company_id.name).send_mail(
self.id, force_send=True, email_values=email_values)
mail_template = self.env.ref(
'module_name.email_template_id')
mail_template.send_mail(self.id, force_send=True)
return res
Mail template
<record id="mail_template_id" model="mail.template">
<field name="name">Payment Due Alert</field>
<field name="model_id" ref="module_name.model_sale_order"/>
<field name="body_html" type="html">
<div style="margin: 0px; padding: 0px;">
<div style="margin: 0px; padding: 0px;">
<p style="margin: 0px; padding: 0px; font-size: 13px;">
Hi,
<br/>
#mail contents
#
#
#
<br/>
Regards,
<br/>
<t t-out="object.company_id.name"/>
</p>
</div>
</div>
</field>
</record>
Hope it helps