Skip to content

Commit

Permalink
Merge PR OCA#283 into 14.0
Browse files Browse the repository at this point in the history
Signed-off-by AaronHForgeFlow
  • Loading branch information
OCA-git-bot committed Dec 11, 2023
2 parents 066a432 + c79bb05 commit 8d0b6a0
Show file tree
Hide file tree
Showing 5 changed files with 27 additions and 31 deletions.
9 changes: 8 additions & 1 deletion account_invoice_overdue_reminder/data/mail_template.xml
Original file line number Diff line number Diff line change
Expand Up @@ -35,18 +35,24 @@
<th style="padding: 5px; border: 1px solid black;">Payment Terms</th>
<th style="padding: 5px; border: 1px solid black;">Due Date</th>
<th style="padding: 5px; border: 1px solid black;">Order Ref.</th>
<th style="padding: 5px; border: 1px solid black;">Type</th>
<th style="padding: 5px; border: 1px solid black;">Total Untaxed</th>
<th style="padding: 5px; border: 1px solid black;">Total</th>
<th style="padding: 5px; border: 1px solid black;">Residual</th>
<th style="padding: 5px; border: 1px solid black;">Past Reminders</th>
</tr>
% for inv in object.invoice_ids.sorted(key='invoice_date'):
<tr>
<tr style="background-color:
% if inv.move_type == 'out_refund':
LightGray
% endif
">
<td style="padding: 5px; border: 1px solid black;">${inv.name}</td>
<td style="padding: 5px; border: 1px solid black;">${format_date(inv.invoice_date)}</td>
<td style="padding: 5px; border: 1px solid black;">${inv.invoice_payment_term_id.name or ''}</td>
<td style="padding: 5px; border: 1px solid black;">${format_date(inv.invoice_date_due)}</td>
<td style="padding: 5px; border: 1px solid black;">${inv.ref or ''}</td>
<td style="padding: 5px; border: 1px solid black;">${dict(inv.fields_get(allfields=['move_type'])['move_type']['selection'])[inv.move_type]}</td>
<td style="padding: 5px; border: 1px solid black; text-align: right;">${format_amount(inv.amount_untaxed * (inv.move_type == 'out_refund' and -1 or 1), inv.currency_id)}</td>
<td style="padding: 5px; border: 1px solid black; text-align: right;">${format_amount(inv.amount_total * (inv.move_type == 'out_refund' and -1 or 1), inv.currency_id)}</td>
<td style="padding: 5px; border: 1px solid black; text-align: right;">${format_amount(inv.amount_residual * (inv.move_type == 'out_refund' and -1 or 1), inv.currency_id)}</td>
Expand All @@ -60,6 +66,7 @@
<td></td>
<td></td>
<td></td>
<td></td>
<td colspan="2" style="padding: 5px; border: 1px solid black; font-weight: bold; text-align: right;">Total Residual in ${currency.name}:</td>
<td style="padding: 5px; border: 1px solid black; font-weight: bold; text-align: right;">${format_amount(total_residual, currency)}</td>
<td></td>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,11 +48,14 @@ class AccountInvoiceOverdueReminder(models.Model):
@api.constrains("invoice_id")
def invoice_id_check(self):
for action in self:
if action.invoice_id and action.invoice_id.move_type != "out_invoice":
if action.invoice_id and action.invoice_id.move_type not in [
"out_invoice",
"out_refund",
]:
raise ValidationError(
_(
"An overdue reminder can only be attached "
"to a customer invoice"
"to a customer invoice or credit note"
)
)

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
Credit notes have been added to the e-mail summary that are sent to the
customer. They are marked in a different colour.

Furthermore, the button toggle to allow to send a reminder with unreconciled
payments has been removed. The warning remains.
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ def default_get(self, fields_list):
def _prepare_base_domain(self):
base_domain = [
("company_id", "=", self.company_id.id),
("move_type", "=", "out_invoice"),
("move_type", "in", ["out_invoice", "out_refund"]),
("state", "=", "posted"),
("payment_state", "not in", ("paid", "reversed", "in_payment")),
("no_overdue_reminder", "=", False),
Expand Down Expand Up @@ -370,10 +370,6 @@ class OverdueReminderStep(models.TransientModel):
warn_unreconciled_move_line_ids = fields.Many2many(
"account.move.line", string="Unreconciled Payments/Refunds", readonly=True
)
unreconciled_move_line_normal = fields.Boolean(
string="To check if unreconciled payments/refunds above have a good "
"reason not to be reconciled with an open invoice"
)
interface = fields.Char(readonly=True)
state = fields.Selection(
[
Expand Down Expand Up @@ -500,21 +496,6 @@ def check_warnings(self):
"This should never happen."
)
)
if (
rec.warn_unreconciled_move_line_ids
and not rec.unreconciled_move_line_normal
):
raise UserError(
_(
"Customer '%s' has unreconciled payments/refunds. "
"You should reconcile these payments/refunds and start the "
"overdue remind process again "
"(or check the option to confirm that these unreconciled "
"payments/refunds have a good reason not to be "
"reconciled with an open invoice)."
)
% rec.commercial_partner_id.display_name
)

def validate(self):
orao = self.env["overdue.reminder.action"]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -80,17 +80,17 @@
<group
attrs="{'invisible': [('warn_unreconciled_move_line_ids', '=', [])]}"
string="WARNING: unreconciled payments/refunds"
col="1"
>
<p>
Customer has unreconciled payments/refunds. You should
reconcile these payments/refunds and start the overdue
remind process again, or manually verify that these
unreconciled payments/refunds have a good reason not to
be reconciled with an open invoice.
</p>
<field name="warn_unreconciled_move_line_ids" nolabel="1" />
</group>
<group
attrs="{'invisible': [('warn_unreconciled_move_line_ids', '=', [])]}"
>
<div name="unreconciled_move_line_normal">
<field name="unreconciled_move_line_normal" class="oe_inline" />
<label for="unreconciled_move_line_normal" />
</div>
</group>
<group name="invoices">
<field name="invoice_ids" nolabel="1">
<tree default_order="invoice_date">
Expand Down

0 comments on commit 8d0b6a0

Please sign in to comment.