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

[FIX] l10n_it_intrastat: Permettere agli override di eseguire un'azione #4311

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
6 changes: 5 additions & 1 deletion l10n_it_intrastat/README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ ITA - Intrastat
!! This file is generated by oca-gen-addon-readme !!
!! changes will be overwritten. !!
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!! source digest: sha256:9d4dc2801a45d42793e18f577c8279375df74d167a5be0931f7d7a32b67a50b0
!! source digest: sha256:85d781ae4f27ed4dbe508c3bb70a8d3ec502c033e3c523eb0bb477f968d73c67
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!

.. |badge1| image:: https://img.shields.io/badge/maturity-Beta-yellow.png
Expand Down Expand Up @@ -289,6 +289,10 @@ Contributors

- Alex Comba <[email protected]>

- `Aion Tech <https://aiontech.company/>`__:

- Simone Rubino <[email protected]>

Maintainers
-----------

Expand Down
5 changes: 3 additions & 2 deletions l10n_it_intrastat/models/account.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
# Copyright 2019 Simone Rubino - Agile Business Group
# Copyright 2024 Simone Rubino - Aion Tech
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).

from odoo import _, api, fields, models
Expand Down Expand Up @@ -323,7 +324,7 @@ def action_post(self):
for invoice in self:
if not invoice.intrastat_line_ids and invoice.intrastat:
invoice.compute_intrastat_lines()
super().action_post()
res = super().action_post()
precision_digits = self.env["decimal.precision"].precision_get("Account")
for invoice in self:
if invoice.intrastat:
Expand All @@ -347,7 +348,7 @@ def action_post(self):
raise UserError(
_("Intrastat total must be equal to invoice untaxed total")
)
return True
return res

def compute_intrastat_lines(self):
for inv in self:
Expand Down
3 changes: 3 additions & 0 deletions l10n_it_intrastat/readme/CONTRIBUTORS.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,3 +17,6 @@
- Fabio Giovannelli \<<[email protected]>\>

- Alex Comba \<<[email protected]>\>

- [Aion Tech](https://aiontech.company/):
- Simone Rubino \<<[email protected]>\>
7 changes: 6 additions & 1 deletion l10n_it_intrastat/static/description/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -367,7 +367,7 @@ <h1 class="title">ITA - Intrastat</h1>
!! This file is generated by oca-gen-addon-readme !!
!! changes will be overwritten. !!
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!! source digest: sha256:9d4dc2801a45d42793e18f577c8279375df74d167a5be0931f7d7a32b67a50b0
!! source digest: sha256:85d781ae4f27ed4dbe508c3bb70a8d3ec502c033e3c523eb0bb477f968d73c67
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! -->
<p><a class="reference external image-reference" href="https://odoo-community.org/page/development-status"><img alt="Beta" src="https://img.shields.io/badge/maturity-Beta-yellow.png" /></a> <a class="reference external image-reference" href="http://www.gnu.org/licenses/agpl-3.0-standalone.html"><img alt="License: AGPL-3" src="https://img.shields.io/badge/licence-AGPL--3-blue.png" /></a> <a class="reference external image-reference" href="https://github.com/OCA/l10n-italy/tree/16.0/l10n_it_intrastat"><img alt="OCA/l10n-italy" src="https://img.shields.io/badge/github-OCA%2Fl10n--italy-lightgray.png?logo=github" /></a> <a class="reference external image-reference" href="https://translation.odoo-community.org/projects/l10n-italy-16-0/l10n-italy-16-0-l10n_it_intrastat"><img alt="Translate me on Weblate" src="https://img.shields.io/badge/weblate-Translate%20me-F47D42.png" /></a> <a class="reference external image-reference" href="https://runboat.odoo-community.org/builds?repo=OCA/l10n-italy&amp;target_branch=16.0"><img alt="Try me on Runboat" src="https://img.shields.io/badge/runboat-Try%20me-875A7B.png" /></a></p>
<p><strong>Italiano</strong></p>
Expand Down Expand Up @@ -623,6 +623,11 @@ <h2><a class="toc-backref" href="#toc-entry-6">Contributors</a></h2>
</li>
<li><p class="first">Alex Comba &lt;<a class="reference external" href="mailto:alex.comba&#64;agilebg.com">alex.comba&#64;agilebg.com</a>&gt;</p>
</li>
<li><p class="first"><a class="reference external" href="https://aiontech.company/">Aion Tech</a>:</p>
<ul class="simple">
<li>Simone Rubino &lt;<a class="reference external" href="mailto:simone.rubino&#64;aion-tech.it">simone.rubino&#64;aion-tech.it</a>&gt;</li>
</ul>
</li>
</ul>
</div>
<div class="section" id="maintainers">
Expand Down
14 changes: 14 additions & 0 deletions l10n_it_intrastat/tests/test_intrastat.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
# Copyright 2019 Simone Rubino - Agile Business Group
# Copyright 2024 Simone Rubino - Aion Tech
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).

from unittest import mock

from odoo.tests import tagged

from odoo.addons.account.tests.common import AccountTestInvoicingCommon
Expand Down Expand Up @@ -82,3 +85,14 @@ def test_invoice_fiscal_postion(self):
invoice.action_post()
invoice.compute_intrastat_lines()
self.assertEqual(invoice.intrastat, True)

def test_propagate_action_post_result(self):
"""The result of posting an invoice is propagated."""
expected_post_result = "Test post result"
from odoo.addons.account.models.account_move import AccountMove

with mock.patch.object(AccountMove, "action_post") as core_post_method:
core_post_method.return_value = expected_post_result
invoice = self.init_invoice("out_invoice")
post_result = invoice.action_post()
self.assertEqual(post_result, expected_post_result)
Loading