Skip to content

Commit

Permalink
Merge f0467cf into 6c0a895
Browse files Browse the repository at this point in the history
  • Loading branch information
i-vyshnevska committed Apr 1, 2019
2 parents 6c0a895 + f0467cf commit e9a7a10
Show file tree
Hide file tree
Showing 19 changed files with 831 additions and 1 deletion.
1 change: 1 addition & 0 deletions account_multicurrency_revaluation/model/res_currency.py
Expand Up @@ -14,6 +14,7 @@ class ResCurrency(models.Model):

@api.model
def _get_conversion_rate(self, from_currency, to_currency):
# TODO get rid of this method
context = self.env.context
if 'revaluation' in context:
rate = from_currency.rate
Expand Down
Expand Up @@ -8,6 +8,8 @@


class TestCurrencyRevaluation(TransactionCase):
# Todo update cases and logic to v12
# see https://github.com/OCA/account-closing/pull/88

def test_uk_revaluation(self):
# Set accounts on company
Expand Down
Expand Up @@ -179,6 +179,7 @@ def create_move_and_lines(amount, debit_account_id, credit_account_id,
created_ids = []
# over revaluation
if amount >= 0.01:
# Todo return User errors if no proper accounts
reval_gain_account = company.revaluation_gain_account_id
if reval_gain_account:

Expand Down Expand Up @@ -209,6 +210,7 @@ def create_move_and_lines(amount, debit_account_id, credit_account_id,

# under revaluation
elif amount <= -0.01:
# Todo return User errors if no proper accounts
amount = -amount
reval_loss_account = company.revaluation_loss_account_id
if reval_loss_account:
Expand Down Expand Up @@ -251,6 +253,7 @@ def revaluate_currency(self):

account_obj = self.env['account.account']

# todo move to separate methods
company = self.journal_id.company_id or self.env.user.company_id
if (not company.revaluation_loss_account_id and
not company.revaluation_gain_account_id and
Expand Down Expand Up @@ -281,7 +284,6 @@ def revaluate_currency(self):

# Get balance sums
account_sums = account_ids.compute_revaluations(self.revaluation_date)

for account_id, account_tree in account_sums.iteritems():
for currency_id, currency_tree in account_tree.iteritems():
for partner_id, sums in currency_tree.iteritems():
Expand Down
75 changes: 75 additions & 0 deletions account_multicurrency_revaluation_type/README.rst
@@ -0,0 +1,75 @@
=========================
Multicurrency revaluation
=========================

.. !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!! 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--closing-lightgray.png?logo=github
:target: https://github.com/OCA/account-closing/tree/12.0/account_multicurrency_revaluation_type
:alt: OCA/account-closing
.. |badge4| image:: https://img.shields.io/badge/weblate-Translate%20me-F47D42.png
:target: https://translation.odoo-community.org/projects/account-closing-12-0/account-closing-12-0-account_multicurrency_revaluation_type
:alt: Translate me on Weblate
.. |badge5| image:: https://img.shields.io/badge/runbot-Try%20me-875A7B.png
:target: https://runbot.odoo-community.org/runbot/89/12.0
:alt: Try me on Runbot

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

This addon add possibility to choose in which currency type reevaluation would be
made. It extends account_multicurrency_revaluation behaviour to use month currency rates

**Table of contents**

.. contents::
:local:

Bug Tracker
===========

Bugs are tracked on `GitHub Issues <https://github.com/OCA/account-closing/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-closing/issues/new?body=module:%20account_multicurrency_revaluation_type%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
~~~~~~~

* Camptocamp

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

* Frederic Clementi <frederic.clementi@camptocamp.com>
* Iryna Vyshnevska <i.vyshnevska@mobilunity.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-closing <https://github.com/OCA/account-closing/tree/12.0/account_multicurrency_revaluation_type>`_ 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_multicurrency_revaluation_type/__init__.py
@@ -0,0 +1,2 @@
from . import model
from . import wizard
20 changes: 20 additions & 0 deletions account_multicurrency_revaluation_type/__manifest__.py
@@ -0,0 +1,20 @@
# Copyright 2019 Camptocamp SA
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).

{
"name": "Multicurrency revaluation",
"version": "10.0.1.0.1",
"category": "Finance",
"summary": "Manage revaluation for multicurrency environment",
"author": "Camptocamp,Odoo Community Association (OCA)",
"license": 'AGPL-3',
"depends": [
"account_multicurrency_revaluation",
"currency_monthly_rate",
],
"data": [
"views/res_config_view.xml",
"wizard/wizard_currency_revaluation_view.xml",
],
'installable': True,
}
3 changes: 3 additions & 0 deletions account_multicurrency_revaluation_type/model/__init__.py
@@ -0,0 +1,3 @@
# -*- coding: utf-8 -*-
from . import res_company
from . import res_config
16 changes: 16 additions & 0 deletions account_multicurrency_revaluation_type/model/res_company.py
@@ -0,0 +1,16 @@
# -*- coding: utf-8 -*-
# Copyright 2019 Camptocamp SA
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).

from odoo import models, fields


class ResCompany(models.Model):
_inherit = "res.company"

currency_rate_type = fields.Selection(
string="Rate type", selection=[
('average', 'Average'),
('daily', 'Daily'),
],
default='daily')
17 changes: 17 additions & 0 deletions account_multicurrency_revaluation_type/model/res_config.py
@@ -0,0 +1,17 @@
# -*- coding: utf-8 -*-
# Copyright 2019 Camptocamp SA
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).

from odoo import models, fields


class AccountConfigSettings(models.TransientModel):
_inherit = 'account.config.settings'

currency_rate_type = fields.Selection(
related='company_id.currency_rate_type',
string='Rate type *',
help="Revaluations entries will be created "
"as \"To Be Reversed\".",
readonly=False,
)
@@ -0,0 +1,2 @@
* Frederic Clementi <frederic.clementi@camptocamp.com>
* Iryna Vyshnevska <i.vyshnevska@mobilunity.com>
2 changes: 2 additions & 0 deletions account_multicurrency_revaluation_type/readme/DESCRIPTION.rst
@@ -0,0 +1,2 @@
This addon add possibility to choose in which currency type reevaluation would be
made. It extends account_multicurrency_revaluation behaviour to use month currency rates

0 comments on commit e9a7a10

Please sign in to comment.