-
-
Notifications
You must be signed in to change notification settings - Fork 414
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Signed-off-by HaraldPanten
- Loading branch information
Showing
21 changed files
with
1,415 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,103 @@ | ||
============================= | ||
Account Payment Widget 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/14.0/account_payment_widget_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-14-0/account-payment-14-0-account_payment_widget_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/14.0 | ||
:alt: Try me on Runbot | ||
|
||
|badge1| |badge2| |badge3| |badge4| |badge5| | ||
|
||
This module adds a popover widget in the invoice form view when there | ||
are outstanding payments that allows the user to select the amount | ||
of the selected payment that wants to assign to the invoice. | ||
|
||
.. image:: https://raw.githubusercontent.com/OCA/account-payment/14.0/account_payment_widget_amount/static/description/payment_widget.png | ||
:alt: Payment Widget | ||
:width: 400 px | ||
|
||
**Table of contents** | ||
|
||
.. contents:: | ||
:local: | ||
|
||
Usage | ||
===== | ||
|
||
To use this module, you need to: | ||
|
||
#. Go to 'Invoicing > Purchases > Vendor Bills' or to 'Invoicing > Sales > | ||
Customer Invoices'. | ||
#. If there are payments registered you will see the Add option. | ||
#. Press Add and enter the amount you want to add to invoice. | ||
#. Automatic reconciliation will be done with the specified amount. | ||
|
||
.. image:: https://raw.githubusercontent.com/OCA/account-payment/14.0/account_payment_widget_amount/static/description/payment_widget_amount_reconciled.png | ||
:alt: Payment Widget Amount Reconciled | ||
|
||
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_widget_amount%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 | ||
~~~~~~~ | ||
|
||
* ForgeFlow S.L. | ||
|
||
Contributors | ||
~~~~~~~~~~~~ | ||
|
||
* Adrià Gil Sorribes <adria.gil@eficent.com> | ||
* Jordi Ballester Alomar <jordi.ballester@eforgeflow.com> | ||
* Christopher Ormaza <chris.ormaza@eforgeflow.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. | ||
|
||
.. |maintainer-ChrisOForgeFlow| image:: https://github.com/ChrisOForgeFlow.png?size=40px | ||
:target: https://github.com/ChrisOForgeFlow | ||
:alt: ChrisOForgeFlow | ||
|
||
Current `maintainer <https://odoo-community.org/page/maintainer-role>`__: | ||
|
||
|maintainer-ChrisOForgeFlow| | ||
|
||
This module is part of the `OCA/account-payment <https://github.com/OCA/account-payment/tree/14.0/account_payment_widget_amount>`_ project on GitHub. | ||
|
||
You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
from . import models |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
# Copyright 2019-2021 ForgeFlow S.L. | ||
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). | ||
{ | ||
"name": "Account Payment Widget Amount", | ||
"summary": "Extends the payment widget to be able to choose the payment " "amount", | ||
"version": "15.0.1.0.0", | ||
"category": "Account-payment", | ||
"website": "https://github.com/OCA/account-payment", | ||
"author": "ForgeFlow S.L., Odoo Community Association (OCA)", | ||
"license": "AGPL-3", | ||
"application": False, | ||
"installable": True, | ||
"depends": ["account"], | ||
"data": [], | ||
"maintainers": ["ChrisOForgeFlow"], | ||
"assets": { | ||
"web.assets_qweb": [ | ||
"account_payment_widget_amount/static/src/xml/account_payment.xml", | ||
], | ||
"web.assets_backend": [ | ||
"account_payment_widget_amount/static/src/js/account_payment_field.js", | ||
], | ||
}, | ||
} |
56 changes: 56 additions & 0 deletions
56
account_payment_widget_amount/i18n/account_payment_widget_amount.pot
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
# Translation of Odoo Server. | ||
# This file contains the translation of the following modules: | ||
# * account_payment_widget_amount | ||
# | ||
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_widget_amount | ||
#. openerp-web | ||
#: code:addons/account_payment_widget_amount/static/src/xml/account_payment.xml:0 | ||
#, python-format | ||
msgid "Apply" | ||
msgstr "" | ||
|
||
#. module: account_payment_widget_amount | ||
#: model:ir.model.fields,field_description:account_payment_widget_amount.field_account_move__display_name | ||
#: model:ir.model.fields,field_description:account_payment_widget_amount.field_account_move_line__display_name | ||
msgid "Display Name" | ||
msgstr "" | ||
|
||
#. module: account_payment_widget_amount | ||
#: model:ir.model.fields,field_description:account_payment_widget_amount.field_account_move__id | ||
#: model:ir.model.fields,field_description:account_payment_widget_amount.field_account_move_line__id | ||
msgid "ID" | ||
msgstr "" | ||
|
||
#. module: account_payment_widget_amount | ||
#: model:ir.model,name:account_payment_widget_amount.model_account_move | ||
msgid "Journal Entry" | ||
msgstr "" | ||
|
||
#. module: account_payment_widget_amount | ||
#: model:ir.model,name:account_payment_widget_amount.model_account_move_line | ||
msgid "Journal Item" | ||
msgstr "" | ||
|
||
#. module: account_payment_widget_amount | ||
#: model:ir.model.fields,field_description:account_payment_widget_amount.field_account_move____last_update | ||
#: model:ir.model.fields,field_description:account_payment_widget_amount.field_account_move_line____last_update | ||
msgid "Last Modified on" | ||
msgstr "" | ||
|
||
#. module: account_payment_widget_amount | ||
#. openerp-web | ||
#: code:addons/account_payment_widget_amount/static/src/xml/account_payment.xml:0 | ||
#, python-format | ||
msgid "Paid Amount:" | ||
msgstr "" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
# Translation of Odoo Server. | ||
# This file contains the translation of the following modules: | ||
# * account_payment_widget_amount | ||
# | ||
msgid "" | ||
msgstr "" | ||
"Project-Id-Version: Odoo Server 12.0\n" | ||
"Report-Msgid-Bugs-To: \n" | ||
"PO-Revision-Date: 2021-03-01 18:45+0000\n" | ||
"Last-Translator: Pedro Castro Silva <pedrocs@exo.pt>\n" | ||
"Language-Team: none\n" | ||
"Language: pt\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.3.2\n" | ||
|
||
#. module: account_payment_widget_amount | ||
#. openerp-web | ||
#: code:addons/account_payment_widget_amount/static/src/xml/account_payment.xml:19 | ||
#, python-format | ||
msgid "Apply" | ||
msgstr "Aplicar" | ||
|
||
#. module: account_payment_widget_amount | ||
#: model:ir.model,name:account_payment_widget_amount.model_account_move_line | ||
msgid "Journal Item" | ||
msgstr "Item de Diário" | ||
|
||
#. module: account_payment_widget_amount | ||
#. openerp-web | ||
#: code:addons/account_payment_widget_amount/static/src/xml/account_payment.xml:9 | ||
#, python-format | ||
msgid "Paid Amount:" | ||
msgstr "Montante Pago:" | ||
|
||
#. module: account_payment_widget_amount | ||
#: code:addons/account_payment_widget_amount/models/account_move_line.py:25 | ||
#, python-format | ||
msgid "The specified amount has to be strictly positive" | ||
msgstr "O valor especificado tem que ser estritamente positivo" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
# Translation of Odoo Server. | ||
# This file contains the translation of the following modules: | ||
# * account_payment_widget_amount | ||
# | ||
msgid "" | ||
msgstr "" | ||
"Project-Id-Version: Odoo Server 12.0\n" | ||
"Report-Msgid-Bugs-To: \n" | ||
"Last-Translator: Automatically generated\n" | ||
"Language-Team: none\n" | ||
"Language: pt_BR\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" | ||
|
||
#. module: account_payment_widget_amount | ||
#. openerp-web | ||
#: code:addons/account_payment_widget_amount/static/src/xml/account_payment.xml:19 | ||
#, python-format | ||
msgid "Apply" | ||
msgstr "" | ||
|
||
#. module: account_payment_widget_amount | ||
#: model:ir.model,name:account_payment_widget_amount.model_account_move_line | ||
msgid "Journal Item" | ||
msgstr "" | ||
|
||
#. module: account_payment_widget_amount | ||
#. openerp-web | ||
#: code:addons/account_payment_widget_amount/static/src/xml/account_payment.xml:9 | ||
#, python-format | ||
msgid "Paid Amount:" | ||
msgstr "" | ||
|
||
#. module: account_payment_widget_amount | ||
#: code:addons/account_payment_widget_amount/models/account_move_line.py:25 | ||
#, python-format | ||
msgid "The specified amount has to be strictly positive" | ||
msgstr "" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
from . import account_move_line |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,83 @@ | ||
# Copyright 2018-2021 ForgeFlow S.L. | ||
|
||
from odoo import models | ||
from odoo.tools import float_compare | ||
|
||
|
||
class AccountMove(models.Model): | ||
|
||
_inherit = "account.move" | ||
|
||
def js_assign_outstanding_line(self, line_id): | ||
self.ensure_one() | ||
if "paid_amount" in self.env.context: | ||
return super( | ||
AccountMove, | ||
self.with_context( | ||
move_id=self.id, | ||
line_id=line_id, | ||
), | ||
).js_assign_outstanding_line(line_id) | ||
return super(AccountMove, self).js_assign_outstanding_line(line_id) | ||
|
||
|
||
class AccountMoveLine(models.Model): | ||
|
||
_inherit = "account.move.line" | ||
|
||
def _prepare_reconciliation_partials(self): | ||
am_model = self.env["account.move"] | ||
aml_model = self.env["account.move.line"] | ||
partials = super(AccountMoveLine, self)._prepare_reconciliation_partials() | ||
if self.env.context.get("paid_amount", 0.0): | ||
total_paid = self.env.context.get("paid_amount", 0.0) | ||
current_am = am_model.browse(self.env.context.get("move_id")) | ||
current_aml = aml_model.browse(self.env.context.get("line_id")) | ||
decimal_places = current_am.company_id.currency_id.decimal_places | ||
if current_am.currency_id.id != current_am.company_currency_id.id: | ||
total_paid = current_am.currency_id._convert( | ||
total_paid, | ||
current_aml.currency_id, | ||
current_am.company_id, | ||
current_aml.date, | ||
) | ||
for partial in partials: | ||
debit_line = self.browse(partial.get("debit_move_id")) | ||
credit_line = self.browse(partial.get("credit_move_id")) | ||
different_currency = ( | ||
debit_line.currency_id.id != credit_line.currency_id.id | ||
) | ||
to_apply = min(total_paid, partial.get("amount", 0.0)) | ||
partial.update( | ||
{ | ||
"amount": to_apply, | ||
} | ||
) | ||
if different_currency: | ||
partial.update( | ||
{ | ||
"debit_amount_currency": credit_line.company_currency_id._convert( | ||
to_apply, | ||
debit_line.currency_id, | ||
credit_line.company_id, | ||
credit_line.date, | ||
), | ||
"credit_amount_currency": debit_line.company_currency_id._convert( | ||
to_apply, | ||
credit_line.currency_id, | ||
debit_line.company_id, | ||
debit_line.date, | ||
), | ||
} | ||
) | ||
else: | ||
partial.update( | ||
{ | ||
"debit_amount_currency": to_apply, | ||
"credit_amount_currency": to_apply, | ||
} | ||
) | ||
total_paid -= to_apply | ||
if float_compare(total_paid, 0.0, precision_digits=decimal_places) <= 0: | ||
break | ||
return partials |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
* Adrià Gil Sorribes <adria.gil@eficent.com> | ||
* Jordi Ballester Alomar <jordi.ballester@eforgeflow.com> | ||
* Christopher Ormaza <chris.ormaza@eforgeflow.com> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
This module adds a popover widget in the invoice form view when there | ||
are outstanding payments that allows the user to select the amount | ||
of the selected payment that wants to assign to the invoice. | ||
|
||
.. image:: ../static/description/payment_widget.png | ||
:alt: Payment Widget | ||
:width: 400 px |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
To use this module, you need to: | ||
|
||
#. Go to 'Invoicing > Purchases > Vendor Bills' or to 'Invoicing > Sales > | ||
Customer Invoices'. | ||
#. If there are payments registered you will see the Add option. | ||
#. Press Add and enter the amount you want to add to invoice. | ||
#. Automatic reconciliation will be done with the specified amount. | ||
|
||
.. image:: ../static/description/payment_widget_amount_reconciled.png | ||
:alt: Payment Widget Amount Reconciled |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Oops, something went wrong.