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

Odoo Client Error: Cannot read properties of null (reading 'isDirty') When rapidly clicking through records in Bank Reconcile #806

Open
StanislavBerezovskii opened this issue Feb 20, 2025 · 0 comments
Labels

Comments

@StanislavBerezovskii
Copy link

StanislavBerezovskii commented Feb 20, 2025

Image

Module

account_reconcile_oca

Describe the bug

[Problem:]
Given I click through the items in Bank Reconcile (Accounting > Reconcile)
When I keep clicking through the items on the list
Then I see Odoo Client Error Uncaught Promise > Cannot read properties of null (reading 'isDirty')
But it does NOT happen, when clicking thru the items slowly

To Reproduce

Affected versions:
getting the error on version 16.0.2.1.2 of the account_reconcile_oca addon

Steps to reproduce the behavior:

  1. Populate the account.reconcile menu. (or another that is affected by the reconcile_controller.esm.js)
  2. Rapidly click through the records in the menu (record panel on the left side)
  3. Error message Uncaught Promise > Cannot read properties of null (reading 'isDirty') will pop up

Expected behavior
The error pops up because the records are being loaded slower that the user clicks through them.
SO the expected behavior is simply no error message pop up when the records are being loaded normally.
I have found the solution myself and would like to suggest it here:

  1. Navigate to account_reconcile_oca\static\src\js\reconcile\reconcile_controller.esm.js
  2. Find the function async selectRecord(record)
  3. in the async selectRecord(record) function find the following code block:
        if (this.state.selectedRecordId && this.state.selectedRecordId !== resId) {
            if (this.form_controller && this.form_controller.model.root.isDirty) {
                await this.form_controller.model.root.save({
                    noReload: true,
                    stayInEdition: true,
                    useSaveErrorDialog: true,
                });
                await this.model.root.load();
                await this.render(true);
            }
        }
  1. Add an additional check to the if (this.form_controller && this.form_controller.model.root.isDirty) { line, like this:
    if (this.form_controller && this.form_controller.model.root && this.form_controller.model.root.isDirty) {
  2. This prevents the error pop up in the UI.

Thank you for your attention!

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

No branches or pull requests

1 participant