Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
94 changes: 94 additions & 0 deletions account_move_from_epd/README.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,94 @@
=====================
Account Move From EPD
=====================

..
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!! This file is generated by oca-gen-addon-readme !!
!! changes will be overwritten. !!
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!! source digest: sha256:3863e18349f8a6484a1e4da6f6296a6ff895d222c9c2a3954ad28ec3b8b478df
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!

.. |badge1| image:: https://img.shields.io/badge/maturity-Alpha-red.png
:target: https://odoo-community.org/page/development-status
:alt: Alpha
.. |badge2| image:: https://img.shields.io/badge/licence-AGPL--3-blue.png
:target: http://www.gnu.org/licenses/agpl-3.0-standalone.html
:alt: License: AGPL-3
.. |badge3| image:: https://img.shields.io/badge/github-OCA%2Faccount--financial--tools-lightgray.png?logo=github
:target: https://github.com/OCA/account-financial-tools/tree/18.0/account_move_from_epd
:alt: OCA/account-financial-tools
.. |badge4| image:: https://img.shields.io/badge/weblate-Translate%20me-F47D42.png
:target: https://translation.odoo-community.org/projects/account-financial-tools-18-0/account-financial-tools-18-0-account_move_from_epd
:alt: Translate me on Weblate
.. |badge5| image:: https://img.shields.io/badge/runboat-Try%20me-875A7B.png
:target: https://runboat.odoo-community.org/builds?repo=OCA/account-financial-tools&target_branch=18.0
:alt: Try me on Runboat

|badge1| |badge2| |badge3| |badge4| |badge5|

This module allows to materialize an 'Early Payment Discount' from an
invoice into a journal entry on a 'Miscellaneous' journal.

As Early Payment Discount cannot be applied once an invoice is partially
reconciled, the wizard allows to generate a journal entry using the full
EPD amount.

.. IMPORTANT::
This is an alpha version, the data model and design can change at any time without warning.
Only for development or testing purpose, do not use in production.
`More details on development status <https://odoo-community.org/page/development-status>`_

**Table of contents**

.. contents::
:local:

Bug Tracker
===========

Bugs are tracked on `GitHub Issues <https://github.com/OCA/account-financial-tools/issues>`_.
In case of trouble, please check there if your issue has already been reported.
If you spotted it first, help us to smash it by providing a detailed and welcomed
`feedback <https://github.com/OCA/account-financial-tools/issues/new?body=module:%20account_move_from_epd%0Aversion:%2018.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**>`_.

Do not contact contributors directly about support or help with technical issues.

Credits
=======

Authors
-------

* Camptocamp

Contributors
------------

- Akim Juillerat <akim.juillerat@camptocamp.com>

Maintainers
-----------

This module is maintained by the OCA.

.. image:: https://odoo-community.org/logo.png
:alt: Odoo Community Association
:target: https://odoo-community.org

OCA, or the Odoo Community Association, is a nonprofit organization whose
mission is to support the collaborative development of Odoo features and
promote its widespread use.

.. |maintainer-grindtildeath| image:: https://github.com/grindtildeath.png?size=40px
:target: https://github.com/grindtildeath
:alt: grindtildeath

Current `maintainer <https://odoo-community.org/page/maintainer-role>`__:

|maintainer-grindtildeath|

This module is part of the `OCA/account-financial-tools <https://github.com/OCA/account-financial-tools/tree/18.0/account_move_from_epd>`_ project on GitHub.

You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute.
4 changes: 4 additions & 0 deletions account_move_from_epd/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
# Copyright 2026 Camptocamp SA
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl)
from . import models
from . import wizard
21 changes: 21 additions & 0 deletions account_move_from_epd/__manifest__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
# Copyright 2026 Camptocamp SA
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl)
{
"name": "Account Move From EPD",
"summary": "Materialize Early Payment Discount as a Journal Entry",
"version": "18.0.1.0.0",
"development_status": "Alpha",
"category": "Accounting",
"website": "https://github.com/OCA/account-financial-tools",
"author": "Camptocamp, Odoo Community Association (OCA)",
"maintainers": ["grindtildeath"],
"license": "AGPL-3",
"depends": [
"account",
],
"data": [
"security/ir.model.access.csv",
"wizard/account_move_from_epd_generator_views.xml",
"views/account_move_views.xml",
],
}
3 changes: 3 additions & 0 deletions account_move_from_epd/models/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# Copyright 2026 Camptocamp SA
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl)
from . import account_move
63 changes: 63 additions & 0 deletions account_move_from_epd/models/account_move.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
# Copyright 2026 Camptocamp SA
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl)
from odoo import api, fields, models


class AccountMove(models.Model):
_inherit = "account.move"

display_generate_epd_move = fields.Boolean(
compute="_compute_display_generate_epd_move",
)
generated_epd_move_id = fields.Many2one("account.move", readonly=True)
generated_epd_move_not_reconciled = fields.Boolean(
compute="_compute_generated_epd_move_not_reconciled"
)

@api.depends(
"generated_epd_move_id",
"move_type",
"state",
"line_ids.display_type",
"line_ids.discount_amount_currency",
)
def _compute_display_generate_epd_move(self):
for move in self:
move.display_generate_epd_move = (
any(
not move.company_currency_id.is_zero(line.discount_amount_currency)
for line in move.line_ids
if line.display_type == "payment_term"
)
and move.state == "posted"
and move.move_type in ("out_invoice", "in_invoice")
and not move.generated_epd_move_id
)

@api.depends(
"generated_epd_move_id",
"line_ids.matched_debit_ids",
"line_ids.matched_credit_ids",
)
def _compute_generated_epd_move_not_reconciled(self):
for move in self:
epd_move = move.generated_epd_move_id
if not epd_move:
move.generated_epd_move_not_reconciled = False
continue

epd_rec_pay_line = epd_move.line_ids.filtered(
lambda li: li.account_id.account_type
in ("asset_receivable", "liability_payable")
)
invoice_pay_term_lines = move.line_ids.filtered(
lambda li: li.account_id.account_type
in ("asset_receivable", "liability_payable")
)
reconciled_lines = (
invoice_pay_term_lines.matched_debit_ids.debit_move_id
| invoice_pay_term_lines.matched_credit_ids.credit_move_id
)
move.generated_epd_move_not_reconciled = not bool(

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
move.generated_epd_move_not_reconciled = not bool(
move.generated_epd_move_not_reconciled = not (

epd_rec_pay_line & reconciled_lines
)
3 changes: 3 additions & 0 deletions account_move_from_epd/pyproject.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
[build-system]
requires = ["whool"]
build-backend = "whool.buildapi"
1 change: 1 addition & 0 deletions account_move_from_epd/readme/CONTRIBUTORS.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
- Akim Juillerat \<<akim.juillerat@camptocamp.com>\>
5 changes: 5 additions & 0 deletions account_move_from_epd/readme/DESCRIPTION.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
This module allows to materialize an 'Early Payment Discount' from an invoice
into a journal entry on a 'Miscellaneous' journal.

As Early Payment Discount cannot be applied once an invoice is partially reconciled,
the wizard allows to generate a journal entry using the full EPD amount.
Comment thread
grindtildeath marked this conversation as resolved.
4 changes: 4 additions & 0 deletions account_move_from_epd/readme/USAGE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
On posted invoices or vendor bills having an early payment discount,
the button `Generate EPD Entry` allows to open the wizard where
user will have to select a journal and a date on which the journal
entry must be generated.
2 changes: 2 additions & 0 deletions account_move_from_epd/security/ir.model.access.csv
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
id,name,model_id:id,group_id:id,perm_read,perm_write,perm_create,perm_unlink
access_account_move_from_epd_generator_user,account.move.from_epd.generator,model_account_move_from_epd_generator,account.group_account_user,1,1,1,1
Loading
Loading