Skip to content

Commit

Permalink
[12.0][MIG] l10n_nl_tax_statement_icp
Browse files Browse the repository at this point in the history
  • Loading branch information
astirpe committed Nov 11, 2019
1 parent 8c9f3bd commit 305450e
Show file tree
Hide file tree
Showing 10 changed files with 29 additions and 51 deletions.
17 changes: 5 additions & 12 deletions l10n_nl_tax_statement_icp/README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -14,13 +14,13 @@ Netherlands ICP Statement
:target: http://www.gnu.org/licenses/agpl-3.0-standalone.html
:alt: License: AGPL-3
.. |badge3| image:: https://img.shields.io/badge/github-OCA%2Fl10n--netherlands-lightgray.png?logo=github
:target: https://github.com/OCA/l10n-netherlands/tree/11.0/l10n_nl_tax_statement_icp
:target: https://github.com/OCA/l10n-netherlands/tree/12.0/l10n_nl_tax_statement_icp
:alt: OCA/l10n-netherlands
.. |badge4| image:: https://img.shields.io/badge/weblate-Translate%20me-F47D42.png
:target: https://translation.odoo-community.org/projects/l10n-netherlands-11-0/l10n-netherlands-11-0-l10n_nl_tax_statement_icp
:target: https://translation.odoo-community.org/projects/l10n-netherlands-12-0/l10n-netherlands-12-0-l10n_nl_tax_statement_icp
:alt: Translate me on Weblate
.. |badge5| image:: https://img.shields.io/badge/runbot-Try%20me-875A7B.png
:target: https://runbot.odoo-community.org/runbot/176/11.0
:target: https://runbot.odoo-community.org/runbot/176/12.0
:alt: Try me on Runbot

|badge1| |badge2| |badge3| |badge4| |badge5|
Expand All @@ -40,13 +40,6 @@ This ICP declaration report includes:
.. contents::
:local:

Installation
============

To install this module, you need to:

#. Install module *l10n_nl_tax_statement* version >= *11.0.2.0.0*.

Configuration
=============

Expand Down Expand Up @@ -78,7 +71,7 @@ Bug Tracker
Bugs are tracked on `GitHub Issues <https://github.com/OCA/l10n-netherlands/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/l10n-netherlands/issues/new?body=module:%20l10n_nl_tax_statement_icp%0Aversion:%2011.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**>`_.
`feedback <https://github.com/OCA/l10n-netherlands/issues/new?body=module:%20l10n_nl_tax_statement_icp%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.

Expand Down Expand Up @@ -108,6 +101,6 @@ 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/l10n-netherlands <https://github.com/OCA/l10n-netherlands/tree/11.0/l10n_nl_tax_statement_icp>`_ project on GitHub.
This module is part of the `OCA/l10n-netherlands <https://github.com/OCA/l10n-netherlands/tree/12.0/l10n_nl_tax_statement_icp>`_ project on GitHub.

You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute.
6 changes: 3 additions & 3 deletions l10n_nl_tax_statement_icp/__manifest__.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
# Copyright 2018 Onestein (<http://www.onestein.eu>)
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
# Copyright 2018 Onestein (<https://www.onestein.eu>)
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl.html).

{
'name': 'Netherlands ICP Statement',
'version': '11.0.1.0.0',
'version': '12.0.1.0.0',
'category': 'Localization',
'license': 'AGPL-3',
'author': 'Onestein, Odoo Community Association (OCA)',
Expand Down
38 changes: 13 additions & 25 deletions l10n_nl_tax_statement_icp/models/l10n_nl_vat_statement.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# Copyright 2018 Onestein (<http://www.onestein.eu>)
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
# Copyright 2018-2019 Onestein (<https://www.onestein.eu>)
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl.html).

from odoo import api, fields, models, _
from odoo.exceptions import UserError
Expand Down Expand Up @@ -38,7 +38,6 @@ def _compute_tag_3b_omzet(self):
statement.tag_3b_omzet = config.tag_3b_omzet
statement.tag_3b_omzet_d = config.tag_3b_omzet_d

@api.multi
def _compute_icp_lines(self):
''' Computes ICP lines for the report'''
IcpLine = self.env['l10n.nl.vat.statement.icp.line']
Expand Down Expand Up @@ -66,29 +65,24 @@ def _prepare_icp_line(self, partner_amounts):
'currency_id': partner_amounts['currency_id'],
}

@api.multi
def _is_3b_omzet_line(self, line):
self.ensure_one()

tag_3b_omzet = self.tag_3b_omzet
for tax in line.tax_ids:
if tax.tag_ids.filtered(
lambda r: r == tag_3b_omzet):
return True
tags = line.tax_ids.mapped('tag_ids')
if any(tags.filtered(lambda r: r == tag_3b_omzet)):
return True
return False

@api.multi
def _is_3b_omzet_diensten_line(self, line):
self.ensure_one()

tag_3b_omzet_d = self.tag_3b_omzet_d
for tax in line.tax_ids:
if tax.tag_ids.filtered(
lambda r: r == tag_3b_omzet_d):
return True
tags = line.tax_ids.mapped('tag_ids')
if any(tags.filtered(lambda r: r == tag_3b_omzet_d)):
return True
return False

@api.multi
def _get_partner_amounts_map(self):
''' Generate an internal data structure representing the ICP line'''
self.ensure_one()
Expand All @@ -104,7 +98,6 @@ def _get_partner_amounts_map(self):
self._update_partner_amounts_map(partner_amounts_map, vals)
return partner_amounts_map

@api.multi
def _check_config_tag_3b_omzet(self):
''' Checks the tag 3b Omzet, as configured for the BTW statement'''
if self.env.context.get('skip_check_config_tag_3b_omzet'):
Expand Down Expand Up @@ -133,12 +126,11 @@ def _init_partner_amounts_map(cls, partner_amounts_map, vals):
'amount_services': 0.0,
}

@api.multi
def _prepare_icp_line_from_move_line(self, line):
''' Gets move line details and prepares ICP report line data'''
self.ensure_one()

balance = line.balance
balance = line.balance and -line.balance or 0
if line.company_currency_id != self.currency_id:
balance = line.company_currency_id.with_context(
date=line.date
Expand All @@ -158,31 +150,27 @@ def _prepare_icp_line_from_move_line(self, line):
'currency_id': self.currency_id.id,
}

@api.multi
def reset(self):
''' Removes ICP lines if reset to draft'''
for statement in self:
statement.icp_line_ids.unlink()
return super(VatStatement, self).reset()
self.mapped('icp_line_ids').unlink()
return super().reset()

@api.multi
def post(self):
''' Checks configuration when validating the statement'''
self.ensure_one()
self._check_config_tag_3b_omzet()
res = super(VatStatement, self).post()
res = super().post()
self._compute_icp_lines()
return res

@api.model
def _modifiable_values_when_posted(self):
''' Returns the modifiable fields even when the statement is posted'''
res = super(VatStatement, self)._modifiable_values_when_posted()
res = super()._modifiable_values_when_posted()
res.append('icp_line_ids')
res.append('icp_total')
return res

@api.multi
def icp_update(self):
''' Update button'''
self.ensure_one()
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# Copyright 2018 Onestein (<http://www.onestein.eu>)
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
# Copyright 2018 Onestein (<https://www.onestein.eu>)
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl.html).

from odoo import _, api, fields, models
from odoo.tools.misc import formatLang
Expand Down
3 changes: 0 additions & 3 deletions l10n_nl_tax_statement_icp/readme/INSTALL.rst

This file was deleted.

2 changes: 1 addition & 1 deletion l10n_nl_tax_statement_icp/report/report_tax_statement.xml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- Copyright 2018 Onestein (<http://www.onestein.eu>)
<!-- Copyright 2018 Onestein (<https://www.onestein.eu>)
License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl). -->

<odoo>
Expand Down
2 changes: 1 addition & 1 deletion l10n_nl_tax_statement_icp/tests/__init__.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl.html).

from . import test_l10n_nl_tax_statement_icp
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# Copyright 2018 Onestein (<http://www.onestein.eu>)
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
# Copyright 2018 Onestein (<https://www.onestein.eu>)
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl.html).

from odoo.exceptions import UserError, ValidationError

Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- Copyright 2018 Onestein (<http://www.onestein.eu>)
<!-- Copyright 2018 Onestein (<https://www.onestein.eu>)
License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl). -->

<odoo>
Expand Down
2 changes: 1 addition & 1 deletion l10n_nl_tax_statement_icp/views/report_tax_statement.xml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- Copyright 2018 Onestein (<http://www.onestein.eu>)
<!-- Copyright 2018 Onestein (<https://www.onestein.eu>)
License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl). -->

<odoo>
Expand Down

0 comments on commit 305450e

Please sign in to comment.