İçereği Atla
Menü
Bu soru işaretlendi
3 Cevaplar
954 Görünümler

Hi 

Is there a setting in Odoo V17 that will alert a user when they create an order for a customer (partner) that have overdue invoices that have gone over the payment term.


Example a customers payment term is set to 30 Days and they have an invoice that is overdue by 31 days, can Odoo display a warning message when a user creates a new order for that customer?

Is it possible to automatically email the customer and send a follow-up letter when an invoice goes beyond the payment term and is overdue?


Thanks

Avatar
Vazgeç
En İyi Yanıt

Hello Angelina,

Here's how to handle both of your requirements in Odoo 17:

1. Warning for Overdue Invoices When Creating New Orders

Option A: Built-in Credit Limit Feature (Simplest)
  1. Go to Accounting → Configuration → Settings
  2. Enable "Credit Limits" under the "Credit Management" section
  3. Set "Default Overdue Limit" to 1 day (or your preferred threshold)
  4. Now when creating a sales order for customers with overdue invoices, Odoo will show a warning
Option B: Automated Action (More Customizable)
  1. Go to Settings → Technical → Automation → Automated Actions
  2. Create new action:
    • Name: "Warn on overdue invoices"
    • Model: sale.order
    • Trigger: On Creation
  3. In Python code section:

python

partner = record.partner_id.commercial_partner_id
overdue_invoices = env['account.move'].search([
    ('partner_id', '=', partner.id),
    ('payment_state', '=', 'not_paid'),
    ('invoice_date_due', '<', fields.Date.today())
])
if overdue_invoices:
    warning = {
        'title': 'Overdue Invoices Warning',
        'message': f'Customer has {len(overdue_invoices)} overdue invoice(s)'
    }
    action = {
        'type': 'ir.actions.client',
        'tag': 'display_notification',
        'params': warning
    }
    # Optional: Block order confirmation
    record.write({'state': 'draft'})
    return action

2. Automatic Follow-ups for Overdue Invoices

Using Odoo's Built-in Follow-up System
  1. Go to Accounting → Customers → Follow-up
  2. Click "Define Follow-up Levels"
  3. Create levels like:
    • Level 1: 5 days overdue (Email reminder)
    • Level 2: 15 days overdue (Email + letter)
    • Level 3: 30 days overdue (Stronger wording)
  4. Configure email templates for each level
  5. Set up automated actions to process follow-ups daily
To Customize Follow-up Emails:
  1. Go to Settings → Technical → Email → Templates
  2. Duplicate the default follow-up template
  3. Customize subject/body with:
    Dear ${object.partner_id.name},
    
    Our records show invoice ${object.name} for ${object.amount_total} is ${object.invoice_days_overdue} days overdue.
    
    Please arrange payment immediately.
Pro Tips
  1. For the warning system, consider adding:
    • Overdue amount totals
    • Links to the overdue invoices
    • Option to override the warning
  2. For follow-ups:
    • Set different sequences for different customer segments
    • Add PDF reports of overdue invoices to emails

Include payment links in reminders

🚀 Did This Solve Your Problem?

If this answer helped you save time, money, or frustration, consider:

✅ Upvoting (👍) to help others find it faster

✅ Marking as "Best Answer" if it resolved your issue

Your feedback keeps the Odoo community strong! 💪

(Need further customization? Drop a comment—I’m happy to refine the solution!)

Avatar
Vazgeç
En İyi Yanıt

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

Avatar
Vazgeç
En İyi Yanıt

1. Alert on Sales Order for Customers with Overdue Invoices

By default, Odoo doesn't show a warning out of the box when placing a Sales Order for a customer with overdue invoices, but you can achieve this by customization


2. Automatically Email Customers with Follow-up Letters for Overdue Invoices

This is supported out of the box in Odoo via the Accounting App > Follow-ups.

Steps:

  1. Go to Accounting > Customers > Follow-up Reports
  2. Configure Follow-up Levels (e.g., 1 day late, 15 days late, etc.)
  3. Set:
    • Automatic emails
    • Follow-up letter templates
    • Add SMS if needed

Avatar
Vazgeç
İlgili Gönderiler Cevaplar Görünümler Aktivite
2
Haz 25
879
0
Haz 24
1312
1
May 24
1458
0
Şub 24
1310
5
Oca 24
6924