From 242c37eed0acf92c7783ec1c657dde57edbf9301 Mon Sep 17 00:00:00 2001 From: Sara Diaz Date: Mon, 16 Dec 2024 13:45:18 +0100 Subject: [PATCH] [MIG] account_journal_restrict_mode: Migration to 18.0 --- account_journal_restrict_mode/README.rst | 22 ++++++++-------- account_journal_restrict_mode/__manifest__.py | 2 +- .../models/account_journal.py | 15 +++-------- .../static/description/index.html | 21 +++++++-------- .../test_account_journal_restrict_mode.py | 26 ++----------------- 5 files changed, 26 insertions(+), 60 deletions(-) diff --git a/account_journal_restrict_mode/README.rst b/account_journal_restrict_mode/README.rst index 1a6cc73c746..73b88e2ecaf 100644 --- a/account_journal_restrict_mode/README.rst +++ b/account_journal_restrict_mode/README.rst @@ -17,13 +17,13 @@ Account Journal Restrict Mode :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--financial--tools-lightgray.png?logo=github - :target: https://github.com/OCA/account-financial-tools/tree/17.0/account_journal_restrict_mode + :target: https://github.com/OCA/account-financial-tools/tree/18.0/account_journal_restrict_mode :alt: OCA/account-financial-tools .. |badge4| image:: https://img.shields.io/badge/weblate-Translate%20me-F47D42.png - :target: https://translation.odoo-community.org/projects/account-financial-tools-17-0/account-financial-tools-17-0-account_journal_restrict_mode + :target: https://translation.odoo-community.org/projects/account-financial-tools-18-0/account-financial-tools-18-0-account_journal_restrict_mode :alt: Translate me on Weblate .. |badge5| image:: https://img.shields.io/badge/runboat-Try%20me-875A7B.png - :target: https://runboat.odoo-community.org/builds?repo=OCA/account-financial-tools&target_branch=17.0 + :target: https://runboat.odoo-community.org/builds?repo=OCA/account-financial-tools&target_branch=18.0 :alt: Try me on Runboat |badge1| |badge2| |badge3| |badge4| |badge5| @@ -42,11 +42,11 @@ prevent them to be modified. Known issues / Roadmap ====================== -- Odoo hides the setting *Lock Posted Entries with Hash* on Bank and - Cash Journals, but enabling it does not cause issues in the - reconciliation for now. If the Odoo logic changes at any point, the - module may need to be adapted to only force the setting on other - types of journals. +- Odoo hides the setting *Lock Posted Entries with Hash* on Bank and + Cash Journals, but enabling it does not cause issues in the + reconciliation for now. If the Odoo logic changes at any point, the + module may need to be adapted to only force the setting on other types + of journals. Bug Tracker =========== @@ -54,7 +54,7 @@ Bug Tracker Bugs are tracked on `GitHub Issues `_. In case of trouble, please check there if your issue has already been reported. If you spotted it first, help us to smash it by providing a detailed and welcomed -`feedback `_. +`feedback `_. Do not contact contributors directly about support or help with technical issues. @@ -69,7 +69,7 @@ Authors Contributors ------------ -- Jordi Masvidal +- Jordi Masvidal Maintainers ----------- @@ -84,6 +84,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/account-financial-tools `_ project on GitHub. +This module is part of the `OCA/account-financial-tools `_ project on GitHub. You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute. diff --git a/account_journal_restrict_mode/__manifest__.py b/account_journal_restrict_mode/__manifest__.py index 2367bf15360..e4c6d09071d 100644 --- a/account_journal_restrict_mode/__manifest__.py +++ b/account_journal_restrict_mode/__manifest__.py @@ -4,7 +4,7 @@ { "name": "Account Journal Restrict Mode", "summary": "Lock All Posted Entries of Journals.", - "version": "17.0.1.0.0", + "version": "18.0.1.0.0", "author": "ForgeFlow S.L., Odoo Community Association (OCA)", "website": "https://github.com/OCA/account-financial-tools", "category": "Accounting", diff --git a/account_journal_restrict_mode/models/account_journal.py b/account_journal_restrict_mode/models/account_journal.py index 9bbabf681f8..d824117e284 100644 --- a/account_journal_restrict_mode/models/account_journal.py +++ b/account_journal_restrict_mode/models/account_journal.py @@ -1,7 +1,7 @@ # Copyright 2023 ForgeFlow S.L. # License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl.html). -from odoo import _, api, fields, models +from odoo import api, fields, models from odoo.exceptions import UserError @@ -15,15 +15,6 @@ def _check_journal_restrict_mode(self): for rec in self: if not rec.restrict_mode_hash_table: raise UserError( - _("Journal %s must have Lock Posted Entries enabled.") % rec.name + self.env._("Journal %s must have Lock Posted Entries enabled.") + % rec.name ) - - @api.model_create_multi - def create(self, vals_list): - # Proposed fix to odoo https://github.com/odoo/odoo/pull/147738. - # But while they don't merge (as it's not an issue they will face in Odoo standard...) - journals = super().create(vals_list) - for journal in journals: - if journal.restrict_mode_hash_table and not journal.secure_sequence_id: - journal._create_secure_sequence(["secure_sequence_id"]) - return journals diff --git a/account_journal_restrict_mode/static/description/index.html b/account_journal_restrict_mode/static/description/index.html index e21d476b0dc..62c9ca8be82 100644 --- a/account_journal_restrict_mode/static/description/index.html +++ b/account_journal_restrict_mode/static/description/index.html @@ -8,11 +8,10 @@ /* :Author: David Goodger (goodger@python.org) -: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. @@ -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 } @@ -301,7 +300,7 @@ span.pre { white-space: pre } -span.problematic, pre.problematic { +span.problematic { color: red } span.section-subtitle { @@ -369,7 +368,7 @@

Account Journal Restrict Mode

!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! !! source digest: sha256:7f60b7459afd54a01b8c168db59f71e492fd6b78126cc951e7873a5f3e5f8746 !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! --> -

Beta License: AGPL-3 OCA/account-financial-tools Translate me on Weblate Try me on Runboat

+

Beta License: AGPL-3 OCA/account-financial-tools Translate me on Weblate Try me on Runboat

This module enables by default the setting Lock Posted Entries with Hash in all Journals and prevents the setting to be modified.

The goal is to assure that all journal entries are locked when posted to @@ -393,8 +392,8 @@

Known issues / Roadmap

  • Odoo hides the setting Lock Posted Entries with Hash on Bank and Cash Journals, but enabling it does not cause issues in the reconciliation for now. If the Odoo logic changes at any point, the -module may need to be adapted to only force the setting on other -types of journals.
  • +module may need to be adapted to only force the setting on other types +of journals.
    @@ -402,7 +401,7 @@

    Bug Tracker

    Bugs are tracked on GitHub Issues. In case of trouble, please check there if your issue has already been reported. If you spotted it first, help us to smash it by providing a detailed and welcomed -feedback.

    +feedback.

    Do not contact contributors directly about support or help with technical issues.

    @@ -422,13 +421,11 @@

    Contributors

    Maintainers

    This module is maintained by the OCA.

    - -Odoo Community Association - +Odoo Community Association

    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-financial-tools project on GitHub.

    +

    This module is part of the OCA/account-financial-tools project on GitHub.

    You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute.

    diff --git a/account_journal_restrict_mode/tests/test_account_journal_restrict_mode.py b/account_journal_restrict_mode/tests/test_account_journal_restrict_mode.py index 9d2c6837fd8..9ef09365dd3 100644 --- a/account_journal_restrict_mode/tests/test_account_journal_restrict_mode.py +++ b/account_journal_restrict_mode/tests/test_account_journal_restrict_mode.py @@ -10,8 +10,8 @@ @tagged("post_install", "-at_install") class TestAccountJournalRestrictMode(AccountTestInvoicingCommon): @classmethod - def setUpClass(cls, chart_template_ref=None): - super().setUpClass(chart_template_ref=chart_template_ref) + def setUpClass(cls): + super().setUpClass() cls.account_journal_obj = cls.env["account.journal"] cls.company_obj = cls.env["res.company"] cls.currency_obj = cls.env["res.currency"] @@ -25,25 +25,3 @@ def test_journal_default_lock_entries(self): self.assertTrue(journal.restrict_mode_hash_table) with self.assertRaises(UserError): journal.write({"restrict_mode_hash_table": False}) - - def test_journal_default_secure_sequence_new_company(self): - test_company = self.company_obj.create( - { - "name": "My Test Company", - "currency_id": self.currency_obj.search([("name", "=", "USD")]).id, - "country_id": self.country_be.id, - } - ) - self.chart_template_obj.try_loading( - template_code="generic_coa", company=test_company, install_demo=False - ) - journals = self.env["account.journal"].search( - [("company_id", "=", test_company.id)] - ) - self.assertTrue(journals) - self.assertTrue( - all( - journal.restrict_mode_hash_table and journal.secure_sequence_id - for journal in journals - ) - )