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

[18.0][MIG] account_journal_lock_date: Migration to 18.0 #2007

Closed

Conversation

BhaveshHeliconia
Copy link

No description provided.

sbidoul and others added 30 commits January 2, 2025 09:39
The test failed on travis (not on a local install) because the
admin users if part of the Adviser group. Make sure we have the right
group and add a test for that feature too.
- Change in journal the existing 'Lock date' by two dates, the same as in company.
- Add a wizard to allows a massive update of those dates for several journals at the same time.
Updated by "Update PO files to match POT (msgmerge)" hook in Weblate.

Translation: account-financial-tools-13.0/account-financial-tools-13.0-account_journal_lock_date
Translate-URL: https://translation.odoo-community.org/projects/account-financial-tools-13-0/account-financial-tools-13-0-account_journal_lock_date/
Updated by "Update PO files to match POT (msgmerge)" hook in Weblate.

Translation: account-financial-tools-13.0/account-financial-tools-13.0-account_journal_lock_date
Translate-URL: https://translation.odoo-community.org/projects/account-financial-tools-13-0/account-financial-tools-13-0-account_journal_lock_date/
Currently translated at 20.0% (4 of 20 strings)

Translation: account-financial-tools-14.0/account-financial-tools-14.0-account_journal_lock_date
Translate-URL: https://translation.odoo-community.org/projects/account-financial-tools-14-0/account-financial-tools-14-0-account_journal_lock_date/it/
Updated by "Update PO files to match POT (msgmerge)" hook in Weblate.

Translation: account-financial-tools-16.0/account-financial-tools-16.0-account_journal_lock_date
Translate-URL: https://translation.odoo-community.org/projects/account-financial-tools-16-0/account-financial-tools-16-0-account_journal_lock_date/
Updated by "Update PO files to match POT (msgmerge)" hook in Weblate.

Translation: account-financial-tools-16.0/account-financial-tools-16.0-account_journal_lock_date
Translate-URL: https://translation.odoo-community.org/projects/account-financial-tools-16-0/account-financial-tools-16-0-account_journal_lock_date/
OCA-git-bot and others added 6 commits January 2, 2025 09:39
Updated by "Update PO files to match POT (msgmerge)" hook in Weblate.

Translation: account-financial-tools-17.0/account-financial-tools-17.0-account_journal_lock_date
Translate-URL: https://translation.odoo-community.org/projects/account-financial-tools-17-0/account-financial-tools-17-0-account_journal_lock_date/
Currently translated at 100.0% (19 of 19 strings)

Translation: account-financial-tools-17.0/account-financial-tools-17.0-account_journal_lock_date
Translate-URL: https://translation.odoo-community.org/projects/account-financial-tools-17-0/account-financial-tools-17-0-account_journal_lock_date/it/
Currently translated at 100.0% (19 of 19 strings)

Translation: account-financial-tools-17.0/account-financial-tools-17.0-account_journal_lock_date
Translate-URL: https://translation.odoo-community.org/projects/account-financial-tools-17-0/account-financial-tools-17-0-account_journal_lock_date/ca/
Currently translated at 100.0% (19 of 19 strings)

Translation: account-financial-tools-17.0/account-financial-tools-17.0-account_journal_lock_date
Translate-URL: https://translation.odoo-community.org/projects/account-financial-tools-17-0/account-financial-tools-17-0-account_journal_lock_date/ca/
@BhaveshHeliconia BhaveshHeliconia force-pushed the 18.0-mig-account_journal_lock_date branch from 16ffc18 to 9a720d9 Compare January 2, 2025 05:21
@BhaveshHeliconia BhaveshHeliconia mentioned this pull request Jan 2, 2025
23 tasks
@BhaveshHeliconia BhaveshHeliconia force-pushed the 18.0-mig-account_journal_lock_date branch 3 times, most recently from 6ce7f06 to 085819e Compare January 15, 2025 09:15
Copy link
Member

@StefanRijnhart StefanRijnhart left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What was the reason to refactor the tests? Was it just to increase coverage or were some of the tests no longer working?

@StefanRijnhart
Copy link
Member

/ocabot migration account_journal_lock_date

@OCA-git-bot OCA-git-bot added this to the 18.0 milestone Feb 6, 2025
@BhaveshHeliconia BhaveshHeliconia force-pushed the 18.0-mig-account_journal_lock_date branch 2 times, most recently from 48d3436 to fea736b Compare February 7, 2025 06:35
@StefanRijnhart
Copy link
Member

Please check test failure:

 2025-02-07 06:37:08,338 255 ERROR odoo odoo.addons.account_journal_lock_date.tests.test_journal_lock_date: ERROR: TestJournalLockDate.test_journal_lock_date
Traceback (most recent call last):
  File "/__w/account-financial-tools/account-financial-tools/account_journal_lock_date/tests/test_journal_lock_date.py", line 129, in test_journal_lock_date
    move2.with_context(check_move_sequence_no_gap=False).action_post()
  File "/opt/odoo/addons/account/models/account_move.py", line 5192, in action_post
    self._post(soft=False)
Error: Errors detected in log.
  File "/__w/account-financial-tools/account-financial-tools/account_fiscal_position_vat_check/models/account_move.py", line 36, in _post
    return super()._post(soft=soft)
  File "/__w/account-financial-tools/account-financial-tools/account_move_post_date_user/models/account_move.py", line 11, in _post
    res = super()._post(soft)
  File "/__w/account-financial-tools/account-financial-tools/account_move_name_sequence/models/account_move.py", line 91, in _post
    return super()._post(soft=soft)
  File "/opt/odoo/addons/account/models/account_move.py", line 4908, in _post
    to_post.write({
  File "/opt/odoo/addons/account/models/account_move.py", line 3253, in write
    self._hash_moves()
  File "/opt/odoo/addons/account/models/account_move.py", line 3841, in _hash_moves
    chains_to_hash = self._get_chains_to_hash(**kwargs)
  File "/opt/odoo/addons/account/models/account_move.py", line 3943, in _get_chains_to_hash
    raise UserError(_(
odoo.exceptions.UserError: An error occurred when computing the inalterability. A gap has been detected in the sequence.

@BhaveshHeliconia BhaveshHeliconia force-pushed the 18.0-mig-account_journal_lock_date branch from fea736b to 67c5f1a Compare February 28, 2025 12:28
@BhaveshHeliconia
Copy link
Author

@StefanRijnhart, Thanks for the suggestion.Please Review.


# Use patch as a context manager as you're doing now
with patch.object(
type(self.account_move_obj), "_get_chains_to_hash", patched_get_chains
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we really need to patch this method? I'm thinking, assertRaisesRegex famously does not apply a cursor savepoint like assertRaises does (I suggested odoo/odoo#134471 for that). Maybe the error is also prevented by applying a savepoint explicitely on line 74:

        with self.assertRaisesRegex(
            UserError, ".*prior to and inclusive of the lock date.*"
        ):
            with self.env.cr.savepoint():

Can you check?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for adding the savepoint context manager, but I was hoping it could replace the patch above. Did you check if that works?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@StefanRijnhart, i changed as per your suggestions! Thanks.Please Review.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

But now the test no longer demonstrates the mechanisms to avoid the checks. Why did you change that?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

And please tell me you do not just feed my comments to your AI codebot.

@BhaveshHeliconia BhaveshHeliconia force-pushed the 18.0-mig-account_journal_lock_date branch from 67c5f1a to cc49fa7 Compare March 3, 2025 04:48
@BhaveshHeliconia
Copy link
Author

@StefanRijnhart, Please Review.

@BhaveshHeliconia BhaveshHeliconia force-pushed the 18.0-mig-account_journal_lock_date branch 2 times, most recently from 156372c to 5b055b9 Compare March 5, 2025 10:01
@BhaveshHeliconia BhaveshHeliconia force-pushed the 18.0-mig-account_journal_lock_date branch from 5b055b9 to 7b347f7 Compare March 5, 2025 12:19
@StefanRijnhart
Copy link
Member

I'm sorry, I don't like how large changes to tests appear and then disappear without any clarification, and you did not deny that you were just feeding my comments to an LLM. You're asking for a rereview before tests are green so I'm superseding this with #2048 which IMHO is a more comprehensive migration.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.