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

[10.0] FIX l10n_it_withholding_tax in multi currency env #451

Merged
merged 1 commit into from
Feb 26, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
4 changes: 2 additions & 2 deletions l10n_it_withholding_tax/__manifest__.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,11 @@

{
'name': 'Italian Withholding Tax',
'version': '10.0.1.0.1',
'version': '10.0.1.0.2',
'category': 'Account',
'author': 'Openforce, Odoo Italia Network, '
'Odoo Community Association (OCA)',
'website': 'https://odoo-community.org/',
'website': 'https://www.odoo-italia.net/',
'license': 'AGPL-3',
"depends": ['account'],
"data": [
Expand Down
7 changes: 6 additions & 1 deletion l10n_it_withholding_tax/models/account.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
# -*- coding: utf-8 -*-
# Copyright 2015 Alessandro Camilli (<http://www.openforce.it>)
# Copyright 2018 Lorenzo Battistini - Agile Business Group
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).


Expand Down Expand Up @@ -29,7 +30,11 @@ def create(self, vals):
break
# Limit value of reconciliation
if invoice and invoice.amount_net_pay:
if vals.get('amount') > invoice.amount_net_pay:
# We must consider amount in foreign currency, if present
# Note that this is always executed, for every reconciliation.
# Thus, we must not chnage amount when not in withholding tax case
amount = vals.get('amount_currency') or vals.get('amount')
if amount > invoice.amount_net_pay:
vals.update({'amount': invoice.amount_net_pay})

# Create reconciliation
Expand Down