Skip to content

Commit

Permalink
Merge PR #1625 into 15.0
Browse files Browse the repository at this point in the history
Signed-off-by rafaelbn
  • Loading branch information
OCA-git-bot committed Dec 14, 2023
2 parents 6d49eac + 0dceb71 commit fa76f0c
Show file tree
Hide file tree
Showing 21 changed files with 967 additions and 0 deletions.
135 changes: 135 additions & 0 deletions account_invoice_discount_date/README.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,135 @@
=============================
Account Invoice Discount Date
=============================

..
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!! This file is generated by oca-gen-addon-readme !!
!! changes will be overwritten. !!
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!! source digest: sha256:0e5b3f329304eef2165449b9eec68dfed8cf93999e3a863fe93430b85660fae8
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
.. |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-LGPL--3-blue.png
:target: http://www.gnu.org/licenses/lgpl-3.0-standalone.html
:alt: License: LGPL-3
.. |badge3| image:: https://img.shields.io/badge/github-OCA%2Faccount--invoicing-lightgray.png?logo=github
:target: https://github.com/OCA/account-invoicing/tree/15.0/account_invoice_discount_date
:alt: OCA/account-invoicing
.. |badge4| image:: https://img.shields.io/badge/weblate-Translate%20me-F47D42.png
:target: https://translation.odoo-community.org/projects/account-invoicing-15-0/account-invoicing-15-0-account_invoice_discount_date
: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-invoicing&target_branch=15.0
:alt: Try me on Runboat

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

This module extends the functionality of invoices to support early
discount dates and to allow you to filter which invoices must be paid
before the early discount expires.

.. 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:

Use Cases / Context
===================

This module was developed because there is no way to know when you can
pay an invoice if has an early discount date.

It will be useful for you if you receive invoices with early discounts.

This module was developed because in Odoo 17 CE exist the Early Discount
Date on Account Move lines.

Usage
=====

To use this module, you need to:

1. Go to Accounting > Suppliers > Bills (or Customers > Invoices) and
set the Discount Date on a desired bill.
2. All Move Lines with maturity date set, will update its Discount Date
with the Discount Date of the invoice.
3. You can group invoices to know which Invoice should be paid to ensure
the discount benefit.
4. You can change the Discount Date on any move line. The lower one will
be set on the bill.

- When the Discount Date of the bill is changed, the recomputation of
the Discount Date on the lines will happen.
- Make sure you only increment the discount date if you have multiple
maturity dates or the lower Discount Date will be propagated on all
maturity lines.

Known issues / Roadmap
======================

- This module is no longer necessary in Odoo 17 because Early Discount
Dates are present on Payment Terms.

- The name of the field on account.move.line is the same to ensure a
smooth migration process.

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

Bugs are tracked on `GitHub Issues <https://github.com/OCA/account-invoicing/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-invoicing/issues/new?body=module:%20account_invoice_discount_date%0Aversion:%2015.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
-------

* Moduon

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

- Rafael Blasco (`Moduon <https://www.moduon.team/>`__)
- Eduardo de Miguel (`Moduon <https://www.moduon.team/>`__)

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-Shide| image:: https://github.com/Shide.png?size=40px
:target: https://github.com/Shide
:alt: Shide
.. |maintainer-rafaelbn| image:: https://github.com/rafaelbn.png?size=40px
:target: https://github.com/rafaelbn
:alt: rafaelbn

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

|maintainer-Shide| |maintainer-rafaelbn|

This module is part of the `OCA/account-invoicing <https://github.com/OCA/account-invoicing/tree/15.0/account_invoice_discount_date>`_ project on GitHub.

You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute.
1 change: 1 addition & 0 deletions account_invoice_discount_date/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
from . import models
23 changes: 23 additions & 0 deletions account_invoice_discount_date/__manifest__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
# Copyright 2023 Moduon Team S.L.
# License LGPL-3.0 or later (https://www.gnu.org/licenses/lgpl-3.0)

{
"name": "Account Invoice Discount Date",
"summary": "Set the early discount date on invoices",
"version": "15.0.1.0.0",
"development_status": "Alpha",
"category": "Accounting",
"website": "https://github.com/OCA/account-invoicing",
"author": "Moduon, Odoo Community Association (OCA)",
"maintainers": ["Shide", "rafaelbn"],
"license": "LGPL-3",
"application": False,
"installable": True,
"depends": [
"account",
],
"data": [
"views/account_move_line_view.xml",
"views/account_move_view.xml",
],
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
# Translation of Odoo Server.
# This file contains the translation of the following modules:
# * account_invoice_discount_date
#
msgid ""
msgstr ""
"Project-Id-Version: Odoo Server 15.0\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2023-12-12 12:49+0000\n"
"PO-Revision-Date: 2023-12-12 12:49+0000\n"
"Last-Translator: \n"
"Language-Team: \n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: \n"
"Plural-Forms: \n"

#. module: account_invoice_discount_date
#: model:ir.model.fields,field_description:account_invoice_discount_date.field_account_bank_statement_line__discount_date
#: model:ir.model.fields,field_description:account_invoice_discount_date.field_account_move__discount_date
#: model:ir.model.fields,field_description:account_invoice_discount_date.field_account_move_line__discount_date
#: model:ir.model.fields,field_description:account_invoice_discount_date.field_account_payment__discount_date
#: model_terms:ir.ui.view,arch_db:account_invoice_discount_date.view_account_invoice_filter
#: model_terms:ir.ui.view,arch_db:account_invoice_discount_date.view_account_move_line_filter
msgid "Discount Date"
msgstr ""

#. module: account_invoice_discount_date
#: model:ir.model,name:account_invoice_discount_date.model_account_move
msgid "Journal Entry"
msgstr ""

#. module: account_invoice_discount_date
#: model:ir.model,name:account_invoice_discount_date.model_account_move_line
msgid "Journal Item"
msgstr ""

#. module: account_invoice_discount_date
#: model:ir.model.fields,help:account_invoice_discount_date.field_account_bank_statement_line__discount_date
#: model:ir.model.fields,help:account_invoice_discount_date.field_account_move__discount_date
#: model:ir.model.fields,help:account_invoice_discount_date.field_account_move_line__discount_date
#: model:ir.model.fields,help:account_invoice_discount_date.field_account_payment__discount_date
msgid ""
"Last date at which the discounted amount must be paid in order for the Early"
" Payment Discount to be granted"
msgstr ""
50 changes: 50 additions & 0 deletions account_invoice_discount_date/i18n/es.po
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
# Translation of Odoo Server.
# This file contains the translation of the following modules:
# * account_invoice_discount_date
#
msgid ""
msgstr ""
"Project-Id-Version: Odoo Server 15.0\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2023-12-12 12:50+0000\n"
"PO-Revision-Date: 2023-12-12 13:52+0100\n"
"Last-Translator: \n"
"Language-Team: \n"
"Language: es\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"Plural-Forms: nplurals=2; plural=(n != 1);\n"
"X-Generator: Poedit 3.4\n"

#. module: account_invoice_discount_date
#: model:ir.model.fields,field_description:account_invoice_discount_date.field_account_bank_statement_line__discount_date
#: model:ir.model.fields,field_description:account_invoice_discount_date.field_account_move__discount_date
#: model:ir.model.fields,field_description:account_invoice_discount_date.field_account_move_line__discount_date
#: model:ir.model.fields,field_description:account_invoice_discount_date.field_account_payment__discount_date
#: model_terms:ir.ui.view,arch_db:account_invoice_discount_date.view_account_invoice_filter
#: model_terms:ir.ui.view,arch_db:account_invoice_discount_date.view_account_move_line_filter
msgid "Discount Date"
msgstr "Fecha del Descuento por Pago Adelantado"

#. module: account_invoice_discount_date
#: model:ir.model,name:account_invoice_discount_date.model_account_move
msgid "Journal Entry"
msgstr "Asiento contable"

#. module: account_invoice_discount_date
#: model:ir.model,name:account_invoice_discount_date.model_account_move_line
msgid "Journal Item"
msgstr "Apunte contable"

#. module: account_invoice_discount_date
#: model:ir.model.fields,help:account_invoice_discount_date.field_account_bank_statement_line__discount_date
#: model:ir.model.fields,help:account_invoice_discount_date.field_account_move__discount_date
#: model:ir.model.fields,help:account_invoice_discount_date.field_account_move_line__discount_date
#: model:ir.model.fields,help:account_invoice_discount_date.field_account_payment__discount_date
msgid ""
"Last date at which the discounted amount must be paid in order for the "
"Early Payment Discount to be granted"
msgstr ""
"Fecha límite en la cual el importe descontado debe ser pagado para que el "
"Descuento por Pago Adelantado sea concedido"
2 changes: 2 additions & 0 deletions account_invoice_discount_date/models/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
from . import account_move_line
from . import account_move
32 changes: 32 additions & 0 deletions account_invoice_discount_date/models/account_move.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
# Copyright 2023 Moduon Team S.L.
# License LGPL-3.0 or later (https://www.gnu.org/licenses/lgpl-3.0)


from odoo import api, fields, models


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

discount_date = fields.Date(
compute="_compute_discount_date",
inverse="_inverse_discount_date",
store=True,
help="Last date at which the discounted amount must be paid in order "
"for the Early Payment Discount to be granted",
)

@api.depends("line_ids.discount_date")
def _compute_discount_date(self):
"""Set discount_date to the earliest Discount date of lines with Date maturity"""
for record in self:
d_dates = record.line_ids.filtered("date_maturity").mapped("discount_date")
new_discount_date = d_dates and sorted(d_dates)[0] or None
if new_discount_date != record.discount_date or not new_discount_date:
record.discount_date = new_discount_date

def _inverse_discount_date(self):
"""When set Discount date, update all move lines with Date maturity"""
for record in self:
for line in record.line_ids:
line.discount_date = line.date_maturity and record.discount_date
14 changes: 14 additions & 0 deletions account_invoice_discount_date/models/account_move_line.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
# Copyright 2023 Moduon Team S.L.
# License LGPL-3.0 or later (https://www.gnu.org/licenses/lgpl-3.0)


from odoo import fields, models


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

discount_date = fields.Date(
help="Last date at which the discounted amount must be paid in order "
"for the Early Payment Discount to be granted",
)
7 changes: 7 additions & 0 deletions account_invoice_discount_date/readme/CONTEXT.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
This module was developed because there is no way to know when you can pay an
invoice if has an early discount date.

It will be useful for you if you receive invoices with early discounts.

This module was developed because in Odoo 17 CE exist the Early Discount Date on
Account Move lines.
2 changes: 2 additions & 0 deletions account_invoice_discount_date/readme/CONTRIBUTORS.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
- Rafael Blasco ([Moduon](https://www.moduon.team/))
- Eduardo de Miguel ([Moduon](https://www.moduon.team/))
2 changes: 2 additions & 0 deletions account_invoice_discount_date/readme/DESCRIPTION.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
This module extends the functionality of invoices to support early discount dates
and to allow you to filter which invoices must be paid before the early discount expires.
5 changes: 5 additions & 0 deletions account_invoice_discount_date/readme/ROADMAP.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
- This module is no longer necessary in Odoo 17 because Early Discount Dates
are present on Payment Terms.

- The name of the field on account.move.line is the same to ensure a
smooth migration process.
8 changes: 8 additions & 0 deletions account_invoice_discount_date/readme/USAGE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
To use this module, you need to:

1. Go to Accounting > Suppliers > Bills (or Customers > Invoices) and set the Discount Date on a desired bill.
2. All Move Lines with maturity date set, will update its Discount Date with the Discount Date of the invoice.
3. You can group invoices to know which Invoice should be paid to ensure the discount benefit.
4. You can change the Discount Date on any move line. The lower one will be set on the bill.
- When the Discount Date of the bill is changed, the recomputation of the Discount Date on the lines will happen.
- Make sure you only increment the discount date if you have multiple maturity dates or the lower Discount Date will be propagated on all maturity lines.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading

0 comments on commit fa76f0c

Please sign in to comment.