Skip to content

Commit

Permalink
Merge f363158 into 0d66b11
Browse files Browse the repository at this point in the history
  • Loading branch information
JordiBForgeFlow committed May 31, 2019
2 parents 0d66b11 + f363158 commit 698c0cb
Show file tree
Hide file tree
Showing 11 changed files with 603 additions and 0 deletions.
79 changes: 79 additions & 0 deletions account_payment_residual_amount/README.rst
Original file line number Diff line number Diff line change
@@ -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/10.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-10-0/account-payment-10-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/10.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:: 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:%2010.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/10.0/account_payment_residual_amount>`_ project on GitHub.

You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute.
5 changes: 5 additions & 0 deletions account_payment_residual_amount/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# -*- coding: utf-8 -*-
# Copyright 2017 Eficent Business and IT Consulting Services, S.L.
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).

from . import models
19 changes: 19 additions & 0 deletions account_payment_residual_amount/__manifest__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
# -*- coding: utf-8 -*-
# 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": "10.0.1.0.0",
"category": "Account-payment",
"website": "https://github.com/OCA/account-payment",
"author": "Eficent, Odoo Community Association (OCA)",
"license": "AGPL-3",
"application": False,
"installable": True,
"depends": ["account"],
"data": [
"views/account_payment_view.xml"
],
}
5 changes: 5 additions & 0 deletions account_payment_residual_amount/models/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# -*- coding: utf-8 -*-
# Copyright 2019 Eficent Business and IT Consulting Services, S.L.
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).

from . import account_payment
36 changes: 36 additions & 0 deletions account_payment_residual_amount/models/account_payment.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
# -*- coding: utf-8 -*-
# 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
for aml in payment.move_line_ids.filtered(
lambda x: x.account_id.reconcile):
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
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
* Eficent
* Jordi Ballester <jordi.ballester@eficent.com>
6 changes: 6 additions & 0 deletions account_payment_residual_amount/readme/DESCRIPTION.rst
Original file line number Diff line number Diff line change
@@ -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
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 698c0cb

Please sign in to comment.