diff --git a/addons/l10n_dk_bookkeeping/__init__.py b/addons/l10n_dk_bookkeeping/__init__.py new file mode 100644 index 00000000000..d6210b1285d --- /dev/null +++ b/addons/l10n_dk_bookkeeping/__init__.py @@ -0,0 +1,3 @@ +# Part of Odoo. See LICENSE file for full copyright and licensing details. + +from . import models diff --git a/addons/l10n_dk_bookkeeping/__manifest__.py b/addons/l10n_dk_bookkeeping/__manifest__.py new file mode 100644 index 00000000000..8983d830569 --- /dev/null +++ b/addons/l10n_dk_bookkeeping/__manifest__.py @@ -0,0 +1,18 @@ +{ + 'name': 'Denmark - Bookkeeping Act', + 'version': '1.0', + 'description': """ +This module contains all that is needed for the Bookkeeping Act + """, + 'summary': "Bookkeeping Act", + 'countries': ['dk'], + 'depends': [ + 'l10n_dk', + ], + 'data': [ + 'views/account_move_views.xml', + ], + 'installable': True, + 'auto_install': True, + 'license': 'LGPL-3', +} diff --git a/addons/l10n_dk_bookkeeping/models/__init__.py b/addons/l10n_dk_bookkeeping/models/__init__.py new file mode 100644 index 00000000000..00487dbe0c1 --- /dev/null +++ b/addons/l10n_dk_bookkeeping/models/__init__.py @@ -0,0 +1,2 @@ +# Part of Odoo. See LICENSE file for full copyright and licensing details. +from . import account_move diff --git a/addons/l10n_dk_bookkeeping/models/account_move.py b/addons/l10n_dk_bookkeeping/models/account_move.py new file mode 100644 index 00000000000..e6e9712eee9 --- /dev/null +++ b/addons/l10n_dk_bookkeeping/models/account_move.py @@ -0,0 +1,23 @@ +from odoo import api, fields, models + + +class AccountMove(models.Model): + _inherit = "account.move" + + l10n_dk_currency_rate_at_transaction = fields.Float( + string='Rate', + compute='_compute_currency_rate_at_transaction', readonly=True, store=True, + digits=0, + ) + l10n_dk_show_currency_rate = fields.Boolean(compute='_compute_show_currency_rate') + + @api.depends('line_ids') + def _compute_currency_rate_at_transaction(self): + for record in self: + if record.line_ids: + record.l10n_dk_currency_rate_at_transaction = record.line_ids[0].currency_rate + + @api.depends('country_code', 'company_currency_id', 'currency_id', 'line_ids') + def _compute_show_currency_rate(self): + for record in self: + record.l10n_dk_show_currency_rate = record.country_code == 'DK' and record.company_currency_id != record.currency_id and record.line_ids diff --git a/addons/l10n_dk_bookkeeping/views/account_move_views.xml b/addons/l10n_dk_bookkeeping/views/account_move_views.xml new file mode 100644 index 00000000000..54558c1742d --- /dev/null +++ b/addons/l10n_dk_bookkeeping/views/account_move_views.xml @@ -0,0 +1,25 @@ + + + + account.move.form.l10n_dk + account.move + + + + + + + + + + + account.move.line.tree.l10n_dk + account.move.line + + + + + + + +