Skip to content
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

[18.0][MIG] account_payment_promissory_note: Migration to 18.0 #783

Open
wants to merge 16 commits into
base: 18.0
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
16 commits
Select commit Hold shift + click to select a range
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
91 changes: 91 additions & 0 deletions account_payment_promissory_note/README.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,91 @@
===============================
Account Payment Promissory Note
===============================

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

.. |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/18.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-18-0/account-payment-18-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=18.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
=====

1. Go to Invoicing > Customers / Vendors > Payments.
2. Create a new one and select the 'Promissory Note' option.
3. 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:%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
-------

* Tecnativa

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

- `Tecnativa <https://www.tecnativa.com>`__:

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

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/18.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": "18.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 16.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-05-17 11:34+0000\n"
"Last-Translator: gelo joga Rodríguez <[email protected]>\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.14.1\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"
61 changes: 61 additions & 0 deletions account_payment_promissory_note/i18n/it.po
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
# Translation of Odoo Server.
# This file contains the translation of the following modules:
# * account_payment_promissory_note
#
msgid ""
msgstr ""
"Project-Id-Version: Odoo Server 16.0\n"
"Report-Msgid-Bugs-To: \n"
"PO-Revision-Date: 2024-02-29 17:37+0000\n"
"Last-Translator: mymage <[email protected]>\n"
"Language-Team: none\n"
"Language: it\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: \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"
" Impostare la data scadenza in tutti i pagamenti o "
"lasciare vuoto per selezionare l'ultima data scadenza di ogni gruppo fatture "
"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 "Scadenza"

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

#. 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 "Nota promissorio"

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

#. module: account_payment_promissory_note
#: model:ir.model,name:account_payment_promissory_note.model_account_payment_register
msgid "Register Payment"
msgstr "Registra pagamento"
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 <[email protected]>
# Copyright 2018 Carlos Dauden <[email protected]>
# 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
32 changes: 32 additions & 0 deletions account_payment_promissory_note/models/account_payment.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
# Copyright 2018 Sergio Teruel <[email protected]>
# Copyright 2018 Carlos Dauden <[email protected]>
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).

from odoo import api, models


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

@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:
lines = payment.move_id.line_ids
if "promissory_note" in vals:
if not vals["promissory_note"]:
lines.date_maturity = vals.get("date", payment.date)
elif "date_due" in vals:
lines.date_maturity = vals["date_due"]

Check warning on line 29 in account_payment_promissory_note/models/account_payment.py

View check run for this annotation

Codecov / codecov/patch

account_payment_promissory_note/models/account_payment.py#L29

Added line #L29 was not covered by tests
elif payment.promissory_note and "date_due" in vals:
lines.date_maturity = vals["date_due"]
return super().write(vals)
3 changes: 3 additions & 0 deletions account_payment_promissory_note/pyproject.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
[build-system]
requires = ["whool"]
build-backend = "whool.buildapi"
5 changes: 5 additions & 0 deletions account_payment_promissory_note/readme/CONTRIBUTORS.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
- [Tecnativa](https://www.tecnativa.com):
- Sergio Teruel
- Alexandre Díaz
- Carlos Roca
- César A. Sánchez
2 changes: 2 additions & 0 deletions account_payment_promissory_note/readme/DESCRIPTION.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
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.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
1. Go to Invoicing \> Customers / Vendors \> Payments.
2. Create a new one and select the 'Promissory Note' option.
3. 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
Loading