Skip to content

Commit

Permalink
[16.0][FIX] account_chart_update: avoid fiscal position duplication w…
Browse files Browse the repository at this point in the history
…hen it's archived
  • Loading branch information
edlopen committed Nov 20, 2024
1 parent 47f7fb4 commit 1998550
Show file tree
Hide file tree
Showing 5 changed files with 37 additions and 8 deletions.
14 changes: 14 additions & 0 deletions account_chart_update/README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -117,6 +117,20 @@ 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.

.. |maintainer-yajo| image:: https://github.com/yajo.png?size=40px
:target: https://github.com/yajo
:alt: yajo
.. |maintainer-rafaelbn| image:: https://github.com/rafaelbn.png?size=40px
:target: https://github.com/rafaelbn
:alt: rafaelbn
.. |maintainer-edlopen| image:: https://github.com/edlopen.png?size=40px
:target: https://github.com/edlopen
:alt: edlopen

Current `maintainers <https://odoo-community.org/page/maintainer-role>`__:

|maintainer-yajo| |maintainer-rafaelbn| |maintainer-edlopen|

This module is part of the `OCA/account-financial-tools <https://github.com/OCA/account-financial-tools/tree/16.0/account_chart_update>`_ project on GitHub.

You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute.
1 change: 1 addition & 0 deletions account_chart_update/__manifest__.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,4 +19,5 @@
"views/account_config_settings_view.xml",
],
"installable": True,
"maintainers": ["yajo", "rafaelbn", "edlopen"],
}
13 changes: 6 additions & 7 deletions account_chart_update/static/description/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,10 @@

/*
:Author: David Goodger ([email protected])
:Id: $Id: html4css1.css 9511 2024-01-13 09:50:07Z milde $
:Id: $Id: html4css1.css 8954 2022-01-20 10:10:25Z milde $
:Copyright: This stylesheet has been placed in the public domain.

Default cascading style sheet for the HTML output of Docutils.
Despite the name, some widely supported CSS2 features are used.

See https://docutils.sourceforge.io/docs/howto/html-stylesheets.html for how to
customize this style sheet.
Expand Down Expand Up @@ -275,7 +274,7 @@
margin-left: 2em ;
margin-right: 2em }

pre.code .ln { color: gray; } /* line numbers */
pre.code .ln { color: grey; } /* line numbers */
pre.code, code { background-color: #eeeeee }
pre.code .comment, code .comment { color: #5C6576 }
pre.code .keyword, code .keyword { color: #3B0D06; font-weight: bold }
Expand All @@ -301,7 +300,7 @@
span.pre {
white-space: pre }

span.problematic, pre.problematic {
span.problematic {
color: red }

span.section-subtitle {
Expand Down Expand Up @@ -456,12 +455,12 @@ <h2><a class="toc-backref" href="#toc-entry-6">Contributors</a></h2>
<div class="section" id="maintainers">
<h2><a class="toc-backref" href="#toc-entry-7">Maintainers</a></h2>
<p>This module is maintained by the OCA.</p>
<a class="reference external image-reference" href="https://odoo-community.org">
<img alt="Odoo Community Association" src="https://odoo-community.org/logo.png" />
</a>
<a class="reference external image-reference" href="https://odoo-community.org"><img alt="Odoo Community Association" src="https://odoo-community.org/logo.png" /></a>
<p>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.</p>
<p>Current <a class="reference external" href="https://odoo-community.org/page/maintainer-role">maintainers</a>:</p>
<p><a class="reference external image-reference" href="https://github.com/yajo"><img alt="yajo" src="https://github.com/yajo.png?size=40px" /></a> <a class="reference external image-reference" href="https://github.com/rafaelbn"><img alt="rafaelbn" src="https://github.com/rafaelbn.png?size=40px" /></a> <a class="reference external image-reference" href="https://github.com/edlopen"><img alt="edlopen" src="https://github.com/edlopen.png?size=40px" /></a></p>
<p>This module is part of the <a class="reference external" href="https://github.com/OCA/account-financial-tools/tree/16.0/account_chart_update">OCA/account-financial-tools</a> project on GitHub.</p>
<p>You are welcome to contribute. To learn how please visit <a class="reference external" href="https://odoo-community.org/page/Contribute">https://odoo-community.org/page/Contribute</a>.</p>
</div>
Expand Down
15 changes: 15 additions & 0 deletions account_chart_update/tests/test_account_chart_update.py
Original file line number Diff line number Diff line change
Expand Up @@ -466,3 +466,18 @@ def test_00_matching(self):
self.assertTrue(list(self.fp.get_external_id().values())[0])
self.assertEqual(fp_rec.get_external_id().get(fp_id), expected_xmlid)
wizard.unlink()

def test_01_archived_fiscal_position(self):
# Test wizard won't duplicate existing fiscal positions when archived
self.fp_template.tax_ids.tax_dest_id = self.tax_template.id
self.fp_template.tax_ids.tax_src_id = self.tax_template.id
fiscal_position = self.env["account.fiscal.position"].search(
[("name", "=", self.fp_template.name), ("company_id", "=", self.company.id)]
)
fiscal_position.active = False
wizard = self.wizard_obj.create(self.wizard_vals)
wizard.action_find_records()
wizard.action_update_records()
wizard.unlink()
self.assertTrue(fiscal_position.exists())
self.assertFalse(fiscal_position.active)
2 changes: 1 addition & 1 deletion account_chart_update/wizard/wizard_chart_update.py
Original file line number Diff line number Diff line change
Expand Up @@ -680,7 +680,7 @@ def find_fp_by_templates(self, templates):
continue
criteria = (field_name, "in", field_values)

result = fp_model.search(
result = fp_model.with_context(active_test=False).search(
[criteria, ("company_id", "=", self.company_id.id)], limit=1
)
if result:
Expand Down

0 comments on commit 1998550

Please sign in to comment.