-
-
Notifications
You must be signed in to change notification settings - Fork 917
[18.0][ADD] account_move_from_epd: Materialize early payment discount #2328
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
grindtildeath
wants to merge
4
commits into
OCA:18.0
Choose a base branch
from
camptocamp:18.0-add-account_move_from_epd
base: 18.0
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
4 commits
Select commit
Hold shift + click to select a range
df37079
[ADD] account_move_from_epd: Materialize early payment discount
grindtildeath 68309c4
fixup! [ADD] account_move_from_epd: Materialize early payment discount
grindtildeath e4294e4
fixup! fixup! [ADD] account_move_from_epd: Materialize early payment …
grindtildeath b32f244
fixup! fixup! fixup! [ADD] account_move_from_epd: Materialize early p…
grindtildeath File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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", | ||
| ], | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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( | ||
| epd_rec_pay_line & reconciled_lines | ||
| ) | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,3 @@ | ||
| [build-system] | ||
| requires = ["whool"] | ||
| build-backend = "whool.buildapi" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1 @@ | ||
| - Akim Juillerat \<<akim.juillerat@camptocamp.com>\> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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. | ||
|
grindtildeath marked this conversation as resolved.
|
||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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 |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.