feat: add fusion_odoo_fixes module for default Odoo patches
- New standalone module to collect fixes for default Odoo behavior - Fix #1: account_followup never clears followup_next_action_date when invoices are paid, causing collection emails to fully-paid clients. Hooks into _invoice_paid_hook to auto-clear stale data. - Harden Fusion Accounting followup queries with amount_residual > 0 filter and add balance check before sending emails Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -237,6 +237,7 @@ class FusionFollowupLine(models.Model):
|
||||
('account_id.account_type', '=', 'asset_receivable'),
|
||||
('parent_state', '=', 'posted'),
|
||||
('reconciled', '=', False),
|
||||
('amount_residual', '>', 0),
|
||||
('date_maturity', '<', today),
|
||||
])
|
||||
line.overdue_amount = sum(overdue_lines.mapped('amount_residual'))
|
||||
@@ -281,6 +282,8 @@ class FusionFollowupLine(models.Model):
|
||||
of the current follow-up level, then advances the partner to
|
||||
the next level.
|
||||
|
||||
Skips sending if the partner no longer has any overdue balance.
|
||||
|
||||
:raises UserError: If no follow-up level is set.
|
||||
"""
|
||||
self.ensure_one()
|
||||
@@ -291,6 +294,11 @@ class FusionFollowupLine(models.Model):
|
||||
self.partner_id.display_name,
|
||||
))
|
||||
|
||||
self._compute_overdue_values()
|
||||
if self.overdue_amount <= 0:
|
||||
self.followup_status = 'no_action_needed'
|
||||
return True
|
||||
|
||||
level = self.followup_level_id
|
||||
partner = self.partner_id
|
||||
|
||||
|
||||
Reference in New Issue
Block a user