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

[16.0][FIX] account_budget_oca: fix operation error _compute_practica… #76

Conversation

polqubiq
Copy link

When an Analytic Account is selected and the Period has not been set yet, the following error appears:

image

  File "/opt/odoo/auto/addons/account_budget_oca/models/account_budget.py", line 155, in _compute_practical_amount
    self.env.cr.execute(
  File "/opt/odoo/custom/src/odoo/odoo/sql_db.py", line 321, in execute
    res = self._obj.execute(query, params)
psycopg2.errors.UndefinedFunction: operator does not exist: date >= boolean
LINE 5:                         AND (date between false
                                          ^
HINT:  No operator matches the given name and argument types. You might need to add explicit type casts.


The above server error caused the following client error:
null

The problem is that the query is comparing incompatible operators (date and boolean, because we have not selected date yet):

                self.env.cr.execute(
                    """
                    SELECT SUM(amount)
                    FROM account_analytic_line
                    WHERE account_id=%s
                        AND (date between %s
                        AND %s)
                        AND general_account_id=ANY(%s)""",
                    (line.analytic_account_id.id, date_from, date_to, acc_ids),
                )

@polqubiq
Copy link
Author

polqubiq commented Sep 20, 2024

@pedrobaeza have a look at this small FIX.

Thanks!

@pedrobaeza
Copy link
Member

Sorry, but I don't use this module.

@polqubiq
Copy link
Author

polqubiq commented Sep 20, 2024

Sorry, but I don't use this module.

And who does? Maybe @AaronHForgeFlow

@pedrobaeza pedrobaeza added this to the 16.0 milestone Sep 20, 2024
@pedrobaeza
Copy link
Member

Check commit history or maintainers.

@polqubiq
Copy link
Author

Check commit history or maintainers.

I understand. @oihane do you know something about this?

QubiQ@42af671#diff-576f4b2b41e053ce6e015b8c4f37ccfcc7c21be4093e13230aa6557f11e379e0R148

Copy link
Contributor

@oihane oihane left a comment

Choose a reason for hiding this comment

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

LGTM

@polqubiq
Copy link
Author

LGTM

Thanks @oihane !

@polqubiq
Copy link
Author

@alvarorib could you review this small fix please?

Copy link

@giarve giarve left a comment

Choose a reason for hiding this comment

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

Makes sense as if you fill the first date, supposedly right now does not allow setting the second date without the error

@polqubiq
Copy link
Author

Makes sense as if you fill the first date, supposedly right now does not allow setting the second date without the error

Thanks, @giarve do you know who is responsable for merging the PR?

@giarve
Copy link

giarve commented Oct 11, 2024

Makes sense as if you fill the first date, supposedly right now does not allow setting the second date without the error

Thanks, @giarve do you know who is responsable for merging the PR?

I do not know, sorry. It is not a very active repository.

@pedrobaeza
Copy link
Member

Trusting current reviews:

/ocabot merge patch

@OCA-git-bot
Copy link
Contributor

This PR looks fantastic, let's merge it!
Prepared branch 16.0-ocabot-merge-pr-76-by-pedrobaeza-bump-patch, awaiting test results.

@OCA-git-bot OCA-git-bot merged commit 8269312 into OCA:16.0 Oct 11, 2024
6 of 7 checks passed
@OCA-git-bot
Copy link
Contributor

Congratulations, your PR was merged at 11de32d. Thanks a lot for contributing to OCA. ❤️

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

Successfully merging this pull request may close these issues.

5 participants