Skip to content

Commit

Permalink
Merge PR #287 into 12.0
Browse files Browse the repository at this point in the history
Signed-off-by jbeficent
  • Loading branch information
OCA-git-bot committed Nov 6, 2019
2 parents 1bb3409 + e6c9d03 commit 510716c
Show file tree
Hide file tree
Showing 14 changed files with 996 additions and 0 deletions.
79 changes: 79 additions & 0 deletions account_payment_residual_amount/README.rst
@@ -0,0 +1,79 @@
===============================
Account Payment Residual Amount
===============================

.. !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!! This file is generated by oca-gen-addon-readme !!
!! changes will be overwritten. !!
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
.. |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/12.0/account_payment_residual_amount
: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-12-0/account-payment-12-0-account_payment_residual_amount
:alt: Translate me on Weblate
.. |badge5| image:: https://img.shields.io/badge/runbot-Try%20me-875A7B.png
:target: https://runbot.odoo-community.org/runbot/96/12.0
:alt: Try me on Runbot

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

This module allows a user to display the amount from a payment that has not
yet been reconciled (called the residual amount).

.. image:: https://raw.githubusercontent.com/OCA/account-payment/12.0/account_payment_residual_amount/account_payment_show_invoice/static/description/payments_view.png
:alt: payment view
:width: 600 px

**Table of contents**

.. contents::
:local:

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 smashing it by providing a detailed and welcomed
`feedback <https://github.com/OCA/account-payment/issues/new?body=module:%20account_payment_residual_amount%0Aversion:%2012.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
~~~~~~~

* Eficent

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

* Eficent
* Jordi Ballester <jordi.ballester@eficent.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.

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

You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute.
3 changes: 3 additions & 0 deletions account_payment_residual_amount/__init__.py
@@ -0,0 +1,3 @@
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).

from . import models
17 changes: 17 additions & 0 deletions account_payment_residual_amount/__manifest__.py
@@ -0,0 +1,17 @@
# Copyright 2019 Eficent Business and IT Consulting Services, S.L.
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
{
"name": "Account Payment Residual Amount",
"summary": "Extends the view of payments to show the residual amount "
"(amount that has not yet been reconciled)",
"version": "12.0.1.0.0",
"category": "Account-payment",
"website": "https://github.com/OCA/account-payment",
"author": "Eficent, Odoo Community Association (OCA)",
"license": "AGPL-3",
"installable": True,
"depends": ["account"],
"data": [
"views/account_payment_view.xml",
],
}
@@ -0,0 +1,35 @@
# Translation of Odoo Server.
# This file contains the translation of the following modules:
# * account_payment_residual_amount
#
msgid ""
msgstr ""
"Project-Id-Version: Odoo Server 12.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_residual_amount
#: model:ir.model,name:account_payment_residual_amount.model_account_payment
msgid "Payments"
msgstr ""

#. module: account_payment_residual_amount
#: model:ir.model.fields,field_description:account_payment_residual_amount.field_account_payment_amount_residual
msgid "Residual Amount"
msgstr ""

#. module: account_payment_residual_amount
#: model:ir.model.fields,help:account_payment_residual_amount.field_account_payment_amount_residual
msgid "The residual amount on a journal item expressed in the company currency."
msgstr ""

#. module: account_payment_residual_amount
#: model:ir.ui.view,arch_db:account_payment_residual_amount.view_account_supplier_payment_tree
msgid "Total"
msgstr ""

3 changes: 3 additions & 0 deletions account_payment_residual_amount/models/__init__.py
@@ -0,0 +1,3 @@
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).

from . import account_payment
38 changes: 38 additions & 0 deletions account_payment_residual_amount/models/account_payment.py
@@ -0,0 +1,38 @@
# Copyright 2019 Eficent Business and IT Consulting Services, S.L.
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).

from odoo import api, fields, models


class AccountPayment(models.Model):
_inherit = "account.payment"

amount_residual = fields.Monetary(
compute='_amount_residual',
string='Residual Amount', store=True,
currency_field='currency_id',
help="The residual amount on a journal item "
"expressed in the company currency.")

@api.multi
@api.depends('move_line_ids',
'move_line_ids.amount_residual',
'move_line_ids.amount_residual_currency')
def _amount_residual(self):
for payment in self:
amount_residual = 0.0
amount_residual_currency = 0.0
pay_acc = payment.journal_id.default_debit_account_id or \
payment.journal_id.default_credit_account_id
for aml in payment.move_line_ids.filtered(
lambda x: x.account_id.reconcile
and x.account_id != pay_acc):
amount_residual += aml.amount_residual
amount_residual_currency += aml.amount_residual_currency
if payment.payment_type == 'inbound':
amount_residual *= -1
amount_residual_currency *= -1
if payment.currency_id != payment.company_id.currency_id:
payment.amount_residual = amount_residual_currency
else:
payment.amount_residual = amount_residual
2 changes: 2 additions & 0 deletions account_payment_residual_amount/readme/CONTRIBUTORS.rst
@@ -0,0 +1,2 @@
* Eficent
* Jordi Ballester <jordi.ballester@eficent.com>
6 changes: 6 additions & 0 deletions account_payment_residual_amount/readme/DESCRIPTION.rst
@@ -0,0 +1,6 @@
This module allows a user to display the amount from a payment that has not
yet been reconciled (called the residual amount).

.. image:: account_payment_show_invoice/static/description/payments_view.png
:alt: payment view
:width: 600 px
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit 510716c

Please sign in to comment.