Skip to content

[19.0][ADD] account_early_payment_base, account_customer_early_payment_discount: early payment discount granted to customers settled by a credit note task#30881 - #12

Merged
alan196 merged 3 commits into
Jarsa:19.0from
Jarsa-dev:19.0-add-account_customer_early_payment_discount
Sep 18, 2026
Merged

alan196 merged 3 commits into
Jarsa:19.0from
Jarsa-dev:19.0-add-account_customer_early_payment_discount

Conversation

@alan196

@alan196 alan196 commented Sep 18, 2026 •

Copy link
Copy Markdown

New module account_customer_early_payment_discount, on top of account_early_payment_base.

Includes account_early_payment_base and the refactor of account_supplier_early_payment_discount on top of it (already merged here as #11), mirroring the OCA PRs OCA#978 (base), OCA#976 (supplier) and OCA#977 (customer).

Companies that grant their customers a discount for paying within a few days often settle it with a credit note: a fiscal document the customer books and, in countries like Mexico, the only way to report a discount granted after the invoice was issued. The native early payment discount of the payment terms writes the discount off when the payment is registered, counts calendar days and applies the same percentage to the whole invoice.

This module keeps the percentage and the days of the payment terms and adds, on the payment terms:

  • Settle with a Credit Note: the native write-off is switched off, the customer owes the full amount, and the discount is granted with a credit note applied to the invoice once the customer pays the discounted amount in time. The payment receipt then reports what was really collected.
  • Count Business Days: the days to pay within are counted on the working calendar of the company, skipping weekends and holidays.
  • On Goods Only: the discount leaves out the services of the invoice (freight, insurance...).

On the customer invoice: the last day to pay, the amount of the discount, the Early Payment to Apply filter once the customer paid in time, and the Apply Early Payment button, which creates a draft credit note with the eligible lines and their taxes. The credit note is left in draft so any approval flow of the company (for example account_move_tier_validation) can gate it, and it is reconciled with the invoice as soon as it is posted.

account.move._early_payment_paid_on_time() and account.move._early_payment_eligible_lines() are the extension points. The fields on account.move, the button and the business day helpers live in account_early_payment_base, shared with account_supplier_early_payment_discount.

🤖 Generated with Claude Code

@jarsabot

Copy link
Copy Markdown

Linked to Odoo task #30881

alan196 and others added 3 commits September 18, 2026 09:10
…discounts settled by a credit note

Both account_supplier_early_payment_discount and the new customer side need
the same fields on account.move (last day to pay, discount amount, credit
note), the same Apply Early Payment button and the business day helpers of
res.company. Defined twice they override each other, so they move here and
the extending modules override _get_early_payment_values,
_early_payment_can_apply and _early_payment_adjust_credit_note for the move
types they handle. A credit note flagged is_early_payment_refund is
reconciled with its invoice when posted.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
…_payment_base

The fields, the button and the business day helpers now come from the base
module; this module keeps the supplier terms, the base date on the receipt,
the pay date, the posted internal credit note and the follow-up activity.
Behaviour unchanged.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
… granted to customers settled by a credit note

The native early payment discount writes the discount off when the payment
is registered, counts calendar days and applies to the whole invoice. This
module keeps the percentage and days of the payment terms and settles the
discount with a credit note issued once the customer pays in time, optionally
counting business days on the working calendar of the company and leaving
the services (freight, insurance) out of the discount base.

The credit note is created in draft so any approval flow of the company can
gate it, and it is reconciled with the invoice when posted.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
@alan196
alan196 force-pushed the 19.0-add-account_customer_early_payment_discount branch from 88e5364 to b2a4497 Compare September 18, 2026 15:11
@alan196 alan196 changed the title [19.0][ADD] account_customer_early_payment_discount: early payment discount granted to customers settled by a credit note task#30881 [19.0][ADD] account_early_payment_base, account_customer_early_payment_discount: early payment discount granted to customers settled by a credit note task#30881 Sep 18, 2026
@alan196
alan196 merged commit 58584b4 into Jarsa:19.0 Sep 18, 2026
2 of 4 checks passed
@alan196
alan196 deleted the 19.0-add-account_customer_early_payment_discount branch September 18, 2026 15:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants