Skip to content

Commit

Permalink
Merge PR #770 into 14.0
Browse files Browse the repository at this point in the history
Signed-off-by pedrobaeza
  • Loading branch information
OCA-git-bot committed Jan 28, 2025
2 parents 36512a2 + c5d774f commit 6c5a803
Show file tree
Hide file tree
Showing 21 changed files with 970 additions and 0 deletions.
94 changes: 94 additions & 0 deletions account_payment_promissory_note/README.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,94 @@
===============================
Account Payment Promissory Note
===============================

..
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!! This file is generated by oca-gen-addon-readme !!
!! changes will be overwritten. !!
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!! source digest: sha256:5660a9983f61c7d29b410daaa0c153537fb8de4b3ba3e5260b0a7ebffedd9652
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
.. |badge1| image:: https://img.shields.io/badge/maturity-Beta-yellow.png
:target: https://odoo-community.org/page/development-status
:alt: Beta
.. |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--payment-lightgray.png?logo=github
:target: https://github.com/OCA/account-payment/tree/14.0/account_payment_promissory_note
:alt: OCA/account-payment
.. |badge4| image:: https://img.shields.io/badge/weblate-Translate%20me-F47D42.png
:target: https://translation.odoo-community.org/projects/account-payment-14-0/account-payment-14-0-account_payment_promissory_note
: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-payment&target_branch=14.0
:alt: Try me on Runboat

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

This module allows you to set a date due in a payment, as promissory notes require.

**Table of contents**

.. contents::
:local:

Usage
=====

#. Go to Invoicing > Customers / Vendors > Payments.
#. Create a new one and select the 'Promissory Note' option.
#. Now you can select a date for the due of the promissory note
(Automatically will be selected the lastest due date of the invoices
if any selected).

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

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

* Tecnativa

Contributors
~~~~~~~~~~~~

* `Tecnativa <https://www.tecnativa.com>`_:

* Sergio Teruel
* Alexandre Díaz
* Carlos Roca
* César A. Sánchez

* `Avanzosc <https://www.avanzosc.es>`_:

* Unai Beristain

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.

This module is part of the `OCA/account-payment <https://github.com/OCA/account-payment/tree/14.0/account_payment_promissory_note>`_ project on GitHub.

You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute.
2 changes: 2 additions & 0 deletions account_payment_promissory_note/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
from . import models
from . import wizard
17 changes: 17 additions & 0 deletions account_payment_promissory_note/__manifest__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
# Copyright 2018 Tecnativa - Carlos Dauden
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl.html).

{
"name": "Account Payment Promissory Note",
"version": "14.0.1.0.0",
"license": "AGPL-3",
"author": "Tecnativa," "Odoo Community Association (OCA)",
"category": "Invoicing Management",
"website": "https://github.com/OCA/account-payment",
"depends": ["account"],
"data": [
"views/account_payment_view.xml",
"views/account_payment_invoice_view.xml",
],
"installable": True,
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
# Translation of Odoo Server.
# This file contains the translation of the following modules:
# * account_payment_promissory_note
#
msgid ""
msgstr ""
"Project-Id-Version: Odoo Server 14.0\n"
"Report-Msgid-Bugs-To: \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_payment_promissory_note
#: model_terms:ir.ui.view,arch_db:account_payment_promissory_note.view_account_payment_form_multi
msgid ""
"<span class=\"text-muted\" attrs=\"{'invisible': [('promissory_note','=', False)]}\">\n"
" Set date due to all payments or empty to select last date due of each partner invoices group\n"
" </span>"
msgstr ""

#. module: account_payment_promissory_note
#: model:ir.model.fields,field_description:account_payment_promissory_note.field_account_payment__date_due
#: model:ir.model.fields,field_description:account_payment_promissory_note.field_account_payment_register__date_due
#: model:ir.model.fields,field_description:account_payment_promissory_note.field_account_promissory_note_mixin__date_due
msgid "Due Date"
msgstr ""

#. module: account_payment_promissory_note
#: model:ir.model,name:account_payment_promissory_note.model_account_payment
msgid "Payments"
msgstr ""

#. module: account_payment_promissory_note
#: model:ir.model.fields,field_description:account_payment_promissory_note.field_account_payment__promissory_note
#: model:ir.model.fields,field_description:account_payment_promissory_note.field_account_payment_register__promissory_note
#: model:ir.model.fields,field_description:account_payment_promissory_note.field_account_promissory_note_mixin__promissory_note
#: model_terms:ir.ui.view,arch_db:account_payment_promissory_note.view_account_payment_search
msgid "Promissory Note"
msgstr ""

#. module: account_payment_promissory_note
#: model:ir.model,name:account_payment_promissory_note.model_account_promissory_note_mixin
msgid "Promissory Note Mixin"
msgstr ""

#. module: account_payment_promissory_note
#: model:ir.model,name:account_payment_promissory_note.model_account_payment_register
msgid "Register Payment"
msgstr ""
82 changes: 82 additions & 0 deletions account_payment_promissory_note/i18n/es.po
Original file line number Diff line number Diff line change
@@ -0,0 +1,82 @@
# Translation of Odoo Server.
# This file contains the translation of the following modules:
# * account_payment_promissory_note
#
msgid ""
msgstr ""
"Project-Id-Version: Odoo Server 12.0\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2020-11-18 14:51+0000\n"
"PO-Revision-Date: 2023-09-21 16:38+0000\n"
"Last-Translator: Ivorra78 <informatica@totmaterial.es>\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: Weblate 4.17\n"

#. module: account_payment_promissory_note
#: model_terms:ir.ui.view,arch_db:account_payment_promissory_note.view_account_payment_form_multi
msgid ""
"<span class=\"text-muted\" attrs=\"{'invisible': [('promissory_note','=', "
"False)]}\">\n"
" Set date due to all payments or empty to select last "
"date due of each partner invoices group\n"
" </span>"
msgstr ""
"<span class=\"text-muted\" attrs=\"{'invisible': [('promissory_note','=', "
"False)]}\">\n"
" Selecciona una fecha de vencimiento para todos los pagos "
"o dejalo vacío para que se seleccione la última fecha de vencimiento para "
"cada agrupación de facturas de un partner.\n"
" </span>"

#. module: account_payment_promissory_note
#: model:ir.model.fields,field_description:account_payment_promissory_note.field_account_payment__date_due
#: model:ir.model.fields,field_description:account_payment_promissory_note.field_account_payment_register__date_due
#: model:ir.model.fields,field_description:account_payment_promissory_note.field_account_promissory_note_mixin__date_due
msgid "Due Date"
msgstr "Fecha de Vencimiento"

#. module: account_payment_promissory_note
#: model:ir.model,name:account_payment_promissory_note.model_account_payment
msgid "Payments"
msgstr "Pagos"

#. module: account_payment_promissory_note
#: model:ir.model.fields,field_description:account_payment_promissory_note.field_account_payment__promissory_note
#: model:ir.model.fields,field_description:account_payment_promissory_note.field_account_payment_register__promissory_note
#: model:ir.model.fields,field_description:account_payment_promissory_note.field_account_promissory_note_mixin__promissory_note
#: model_terms:ir.ui.view,arch_db:account_payment_promissory_note.view_account_payment_search
msgid "Promissory Note"
msgstr "Pagaré"

#. module: account_payment_promissory_note
#: model:ir.model,name:account_payment_promissory_note.model_account_promissory_note_mixin
msgid "Promissory Note Mixin"
msgstr "Mezcla de pagarés"

#. module: account_payment_promissory_note
#: model:ir.model,name:account_payment_promissory_note.model_account_payment_register
msgid "Register Payment"
msgstr "Registrar pago"

#~ msgid "Display Name"
#~ msgstr "Mostrar Nombre"

#~ msgid "ID"
#~ msgstr "ID"

#~ msgid "Last Modified on"
#~ msgstr "Última modificación en"

#~ msgid ""
#~ "Contains the logic shared between models which allows to register payments"
#~ msgstr ""
#~ "Contiene la lógica compartida entre los modelos que permiten el registro "
#~ "de pagos"

#~ msgid "Register Payments"
#~ msgstr "Registrar pagos"
2 changes: 2 additions & 0 deletions account_payment_promissory_note/models/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
from . import account_abstract_payment
from . import account_payment
20 changes: 20 additions & 0 deletions account_payment_promissory_note/models/account_abstract_payment.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
# Copyright 2018 Sergio Teruel <sergio.teruel@tecnativa.com>
# Copyright 2018 Carlos Dauden <carlos.dauden@tecnativa.com>
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).

from odoo import api, fields, models


class AccountAbstractPayment(models.AbstractModel):
_name = "account.promissory.note.mixin"
_description = "Promissory Note Mixin"

promissory_note = fields.Boolean()
date_due = fields.Date(
string="Due Date",
)

@api.onchange("promissory_note")
def _onchange_promissory_note(self):
if not self.promissory_note:
self.date_due = False
48 changes: 48 additions & 0 deletions account_payment_promissory_note/models/account_payment.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
# Copyright 2018 Sergio Teruel <sergio.teruel@tecnativa.com>
# Copyright 2018 Carlos Dauden <carlos.dauden@tecnativa.com>
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).

from odoo import api, fields, models


class AccountPayment(models.Model):
_name = "account.payment"
_inherit = ["account.payment", "account.promissory.note.mixin"]

promissory_note = fields.Boolean(
readonly=True,
states={"draft": [("readonly", False)]},
)
date_due = fields.Date(
readonly=True,
states={"draft": [("readonly", False)]},
)

def _prepare_payment_moves(self):
res = super()._prepare_payment_moves()
if self.promissory_note:
for vals in res:
for line in vals["line_ids"]:
line[2]["date_maturity"] = self.date_due
return res

@api.onchange("promissory_note")
def _onchange_promissory_note(self):
result = super()._onchange_promissory_note()
if not self.date_due and self.promissory_note:
invoices = self.reconciled_invoice_ids
same_partner = len(invoices.mapped("partner_id")) == 1
if invoices and same_partner:
self.date_due = max(invoices.mapped("invoice_date_due"))
return result

def write(self, vals):
for payment in self:
if "promissory_note" in vals:
if not vals["promissory_note"]:
payment.line_ids.date_maturity = vals.get("date") or payment.date
elif "date_due" in vals:
payment.line_ids.date_maturity = vals["date_due"]
elif payment.promissory_note and "date_due" in vals:
payment.line_ids.date_maturity = vals["date_due"]
return super().write(vals)
10 changes: 10 additions & 0 deletions account_payment_promissory_note/readme/CONTRIBUTORS.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
* `Tecnativa <https://www.tecnativa.com>`_:

* Sergio Teruel
* Alexandre Díaz
* Carlos Roca
* César A. Sánchez

* `Avanzosc <https://www.avanzosc.es>`_:

* Unai Beristain
1 change: 1 addition & 0 deletions account_payment_promissory_note/readme/DESCRIPTION.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
This module allows you to set a date due in a payment, as promissory notes require.
5 changes: 5 additions & 0 deletions account_payment_promissory_note/readme/USAGE.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
#. Go to Invoicing > Customers / Vendors > Payments.
#. Create a new one and select the 'Promissory Note' option.
#. Now you can select a date for the due of the promissory note
(Automatically will be selected the lastest due date of the invoices
if any selected).
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 6c5a803

Please sign in to comment.