Skip to content

Conversation

micheledic
Copy link
Contributor

@micheledic micheledic commented Jun 3, 2025

Before this PR

The group_id is not stored so it appear "group_id" is not searchable accessing account_ids

Fixes #1306

@micheledic
Copy link
Contributor Author

@OCA/accounting-maintainers

@micheledic
Copy link
Contributor Author

@OCA/accounting-maintainers ping

@micheledic
Copy link
Contributor Author

@OCA/accounting-maintainers ping

Copy link

@monen17 monen17 left a comment

Choose a reason for hiding this comment

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

Thanks for the PR!
Please shorten the commit title because it is cut with ellipsis:
image
See https://github.com/OCA/odoo-community.org/blob/master/website/Contribution/CONTRIBUTING.rst#71commit-message:

please check if the commit message is cut with ellipsis.

This should be enough:

[FIX] account_financial_report: group_id is not searchable

any other detail can go in the commit description

As I said in #1306 (comment) the issue isn't very clear to me so I can't check if this PR is fixing it.
Only did the code review and there are some points that need clarification.


def write(self, vals):
res = super().write(vals)
self.env["account.group"].invalidate_model(["account_ids"])
Copy link

Choose a reason for hiding this comment

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

Could you please explain why this is needed?

Copy link

Choose a reason for hiding this comment

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

This is done every time any field of an account is updated: is it really necessary to invalidate the cache if an account changes its name? Or it becomes reconcilable?

Maybe we should invalidate the cache only when code is modified, could you please check if that's enough?

@api.model_create_multi
def create(self, vals_list):
res = super().create(vals_list)
self.env["account.group"].invalidate_model(["account_ids"])
Copy link

Choose a reason for hiding this comment

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

Could you please explain why this is needed?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

The account_ids is now computed so the depends on


will never be called.
I have not found another way to make the compute work , any idea?

Copy link

Choose a reason for hiding this comment

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

The field account.group.account_ids should be computed on the fly every time it is needed, so I think there is no need for this cache invalidation, could you please check?

Moreover, this is done every time any field of an account is updated: is it really necessary to invalidate the cache if an account changes its name? Or it becomes reconcilable?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I have tried without invalidate but the test are failing because account_ids does not contain the account_id created. May. I guess that the reason is that if on the same transaction you create an account and than retrieve the data with a SQL query, the data of the account created is not flushed yet so it is not retrieven from the sql

Copy link

Choose a reason for hiding this comment

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

Thanks for checking!
Then we have indeed to invalidate the cache when a new account is created.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I rewrited the compute now it is not needed to invalidate the model

group.complete_name = group.name
@api.depends_context("company")
def _compute_account_ids(self):
"""Retrieves every account from `self` and `self`'s subgroups.
Copy link

Choose a reason for hiding this comment

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

The field account_ids used to only contain the accounts of group self; the accounts of the subgroups are added in field compute_account_ids.

Please only retrieve the accounts of group self so the existing behavior is preserved.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Hello,
on _compute_account_ids i build a SQL query that is the reverse of the compute of the group
https://github.com/odoo/odoo/blob/07626050bd0104fecd8799b56d30245d00da3f27/addons/account/models/account_account.py#L471

To compute the child of a specific group, on the 18.0 it will search for group where the code of the account is contained between prefix_start and prefix_end . I build the reverse SQL query of the compute.

The query is build so if the compute is triggered on more than 1 record, the query is done once but it will compute all the group in self

Copy link

Choose a reason for hiding this comment

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

Ok so you are not actually computing the accounts of

self's subgroups.

if that's the case, please remove this part of the docstring because it's misleading.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

done

)

@api.depends("name", "parent_id.complete_name")
def _compute_complete_name(self):
Copy link

Choose a reason for hiding this comment

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

Why has this been removed? How are we computing the complete_name now?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

my fault, i restore the compute

Copy link

Choose a reason for hiding this comment

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

👍 Thanks

Comment on lines 53 to 65
ON agroup.code_prefix_start <= LEFT(%(code_store)s->>%(root_company_id)s,
char_length(agroup.code_prefix_start))
AND agroup.code_prefix_end >= LEFT(%(code_store)s->>%(root_company_id)s,
char_length(agroup.code_prefix_end))
Copy link

Choose a reason for hiding this comment

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

Could you please clarify what is the self.env.company.root_id.id doing in a filter on account group prefixes?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

it is used on odoo 18.0 compute https://github.com/odoo/odoo/blob/18.0/addons/account/models/account_account.py#L471
I build the query so it will retrieve the information consistent with the account group compute .
I guess it is used because if a company is a branch, it will be retrieved the information only of the data from the json field "code" for the root company

Copy link

Choose a reason for hiding this comment

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

The linked query is

                 SELECT DISTINCT ON (account_code.code)
                        account_code.code,
                        agroup.id AS group_id
                   FROM (VALUES %(account_code_values)s) AS account_code (code)
              LEFT JOIN account_group agroup
                     ON agroup.code_prefix_start <= LEFT(account_code.code, char_length(agroup.code_prefix_start))
                        AND agroup.code_prefix_end >= LEFT(account_code.code, char_length(agroup.code_prefix_end))
                        AND agroup.company_id = %(root_company_id)s
               ORDER BY account_code.code, char_length(agroup.code_prefix_start) DESC, agroup.id

(from https://github.com/odoo/odoo/blob/9f8c364f056c8937409f8ed91b8d1fa436c2d7c0/addons/account/models/account_account.py#L473-L481)

In the linked query, the root_company_id is only used in the last condition

AND agroup.company_id = %(root_company_id)s

but in this PR's query root_company_id is used in combination with code_prefix_start and code_store:

ON agroup.code_prefix_start <= LEFT(%(code_store)s->>%(root_company_id)s,
char_length(agroup.code_prefix_start))
AND agroup.code_prefix_end >= LEFT(%(code_store)s->>%(root_company_id)s,
char_length(agroup.code_prefix_end))

could you please clarify why?

Moreover, I can't see any code_store in the linked query, how is it in this PR's query if this PR's query is just the opposite of the linked query?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

The code_store is a JSON field within account.account. To access the code for a specific company, we have to use field_name->>index. For example, to get the code for company ID 1, you'd use code_store->>1. In the account_account compute query, you already have the code needed to determine the group, so there's no need to retrieve data from the code_store JSON.
In my case you are computing the account of a specific group , but you have to retrieve the data from the query. The fastest way is a single query with the comparison directly in SQL getting the data from the json field

Copy link

Choose a reason for hiding this comment

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

Thanks for the explanation!
I was missing that accounts are multi-company in 18.0, then code is computed and code_store stores the account code for each account in the different companies.
I'm not 100% convinced of this query and would have preferred using the ORM but looks like it's working fine so it's ok 👍

Copy link
Contributor Author

Choose a reason for hiding this comment

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

It is better using a query because if we have to do it by ORM, it will be slowly becuase it will not use all the index.
However now i rewritten the query, before it was bugged.
Does not have any sense to pass the company in the environment because every group is linked to a company so i will do a single query that get the correct account_ids for the company we are on .

@micheledic micheledic force-pushed the 18.0_fix_account_ids_not_searchable branch 2 times, most recently from 3ecce30 to 081e0e3 Compare July 7, 2025 08:29
@api.model_create_multi
def create(self, vals_list):
res = super().create(vals_list)
self.env["account.group"].invalidate_model(["account_ids"])
Copy link

Choose a reason for hiding this comment

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

The field account.group.account_ids should be computed on the fly every time it is needed, so I think there is no need for this cache invalidation, could you please check?

Moreover, this is done every time any field of an account is updated: is it really necessary to invalidate the cache if an account changes its name? Or it becomes reconcilable?

group.complete_name = group.name
@api.depends_context("company")
def _compute_account_ids(self):
"""Retrieves every account from `self` and `self`'s subgroups.
Copy link

Choose a reason for hiding this comment

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

Ok so you are not actually computing the accounts of

self's subgroups.

if that's the case, please remove this part of the docstring because it's misleading.

Comment on lines 53 to 65
ON agroup.code_prefix_start <= LEFT(%(code_store)s->>%(root_company_id)s,
char_length(agroup.code_prefix_start))
AND agroup.code_prefix_end >= LEFT(%(code_store)s->>%(root_company_id)s,
char_length(agroup.code_prefix_end))
Copy link

Choose a reason for hiding this comment

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

The linked query is

                 SELECT DISTINCT ON (account_code.code)
                        account_code.code,
                        agroup.id AS group_id
                   FROM (VALUES %(account_code_values)s) AS account_code (code)
              LEFT JOIN account_group agroup
                     ON agroup.code_prefix_start <= LEFT(account_code.code, char_length(agroup.code_prefix_start))
                        AND agroup.code_prefix_end >= LEFT(account_code.code, char_length(agroup.code_prefix_end))
                        AND agroup.company_id = %(root_company_id)s
               ORDER BY account_code.code, char_length(agroup.code_prefix_start) DESC, agroup.id

(from https://github.com/odoo/odoo/blob/9f8c364f056c8937409f8ed91b8d1fa436c2d7c0/addons/account/models/account_account.py#L473-L481)

In the linked query, the root_company_id is only used in the last condition

AND agroup.company_id = %(root_company_id)s

but in this PR's query root_company_id is used in combination with code_prefix_start and code_store:

ON agroup.code_prefix_start <= LEFT(%(code_store)s->>%(root_company_id)s,
char_length(agroup.code_prefix_start))
AND agroup.code_prefix_end >= LEFT(%(code_store)s->>%(root_company_id)s,
char_length(agroup.code_prefix_end))

could you please clarify why?

Moreover, I can't see any code_store in the linked query, how is it in this PR's query if this PR's query is just the opposite of the linked query?

)

@api.depends("name", "parent_id.complete_name")
def _compute_complete_name(self):
Copy link

Choose a reason for hiding this comment

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

👍 Thanks

@micheledic micheledic force-pushed the 18.0_fix_account_ids_not_searchable branch from 081e0e3 to 56413b7 Compare July 9, 2025 07:44
Copy link
Contributor Author

@micheledic micheledic left a comment

Choose a reason for hiding this comment

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

fatto

@micheledic micheledic requested a review from monen17 July 9, 2025 08:43
@api.model_create_multi
def create(self, vals_list):
res = super().create(vals_list)
self.env["account.group"].invalidate_model(["account_ids"])
Copy link

Choose a reason for hiding this comment

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

Thanks for checking!
Then we have indeed to invalidate the cache when a new account is created.


def write(self, vals):
res = super().write(vals)
self.env["account.group"].invalidate_model(["account_ids"])
Copy link

Choose a reason for hiding this comment

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

This is done every time any field of an account is updated: is it really necessary to invalidate the cache if an account changes its name? Or it becomes reconcilable?

Maybe we should invalidate the cache only when code is modified, could you please check if that's enough?

Comment on lines 53 to 65
ON agroup.code_prefix_start <= LEFT(%(code_store)s->>%(root_company_id)s,
char_length(agroup.code_prefix_start))
AND agroup.code_prefix_end >= LEFT(%(code_store)s->>%(root_company_id)s,
char_length(agroup.code_prefix_end))
Copy link

Choose a reason for hiding this comment

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

Thanks for the explanation!
I was missing that accounts are multi-company in 18.0, then code is computed and code_store stores the account code for each account in the different companies.
I'm not 100% convinced of this query and would have preferred using the ORM but looks like it's working fine so it's ok 👍

return
for record in self:
record.account_ids = list(
map(int, group_by_code.get(record.id, "").split(", "))
Copy link

Choose a reason for hiding this comment

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

Trying this in runboat results in an error for the following use-case:

  1. Create a group
  2. Create a new company
  3. Open the group
  4. Select both companies (the original company is still the active one)
  5. Select the new company as active

Actual
This error is raised:

Trace
Traceback (most recent call last):
  File "/opt/odoo/odoo/http.py", line 2123, in _transactioning
    return service_model.retrying(func, env=self.env)
  File "/opt/odoo/odoo/service/model.py", line 156, in retrying
    result = func()
  File "/opt/odoo/odoo/http.py", line 2090, in _serve_ir_http
    response = self.dispatcher.dispatch(rule.endpoint, args)
  File "/opt/odoo/odoo/http.py", line 2338, in dispatch
    result = self.request.registry['ir.http']._dispatch(endpoint)
  File "/opt/odoo/odoo/addons/base/models/ir_http.py", line 333, in _dispatch
    result = endpoint(**request.params)
  File "/opt/odoo/odoo/http.py", line 754, in route_wrapper
    result = endpoint(self, *args, **params_ok)
  File "/opt/odoo/addons/web/controllers/dataset.py", line 36, in call_kw
    return call_kw(request.env[model], method, args, kwargs)
  File "/opt/odoo/odoo/api.py", line 533, in call_kw
    result = getattr(recs, name)(*args, **kwargs)
  File "/opt/odoo/addons/web/models/models.py", line 86, in web_read
    values_list: list[dict] = self.read(fields_to_read, load=None)
  File "/opt/odoo/odoo/models.py", line 3843, in read
    return self._read_format(fnames=fields, load=load)
  File "/opt/odoo/odoo/models.py", line 4074, in _read_format
    vals[name] = convert(record[name], record, use_display_name)
  File "/opt/odoo/odoo/models.py", line 7061, in __getitem__
    return self._fields[key].__get__(self)
  File "/opt/odoo/odoo/fields.py", line 4620, in __get__
    return super().__get__(records, owner)
  File "/opt/odoo/odoo/fields.py", line 3059, in __get__
    return super().__get__(records, owner)
  File "/opt/odoo/odoo/fields.py", line 1303, in __get__
    self.compute_value(recs)
  File "/opt/odoo/odoo/fields.py", line 1485, in compute_value
    records._compute_field_value(self)
  File "/opt/odoo/odoo/models.py", line 5280, in _compute_field_value
    fields.determine(field.compute, self)
  File "/opt/odoo/odoo/fields.py", line 110, in determine
    return needle(*args)
  File "/mnt/data/odoo-addons-dir/account_financial_report/models/account_group.py", line 81, in _compute_account_ids
    map(int, group_by_code.get(record.id, "").split(", "))
AttributeError: 'NoneType' object has no attribute 'split'

Expected
no error

Here is the video of the error being raised:

Screencast.From.2025-07-11.15-15-03.mp4

Copy link
Contributor Author

Choose a reason for hiding this comment

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

fixed by rewrite of the query

Copy link

Choose a reason for hiding this comment

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

Thanks!
I tried the same steps as above and no error is raised 👏
but as soon as I edit the code_prefix_end of the created group the following is raised:

Details
Traceback (most recent call last):
  File "/opt/odoo/odoo/http.py", line 2123, in _transactioning
    return service_model.retrying(func, env=self.env)
  File "/opt/odoo/odoo/service/model.py", line 156, in retrying
    result = func()
  File "/opt/odoo/odoo/http.py", line 2090, in _serve_ir_http
    response = self.dispatcher.dispatch(rule.endpoint, args)
  File "/opt/odoo/odoo/http.py", line 2338, in dispatch
    result = self.request.registry['ir.http']._dispatch(endpoint)
  File "/opt/odoo/odoo/addons/base/models/ir_http.py", line 333, in _dispatch
    result = endpoint(**request.params)
  File "/opt/odoo/odoo/http.py", line 754, in route_wrapper
    result = endpoint(self, *args, **params_ok)
  File "/opt/odoo/addons/web/controllers/dataset.py", line 36, in call_kw
    return call_kw(request.env[model], method, args, kwargs)
  File "/opt/odoo/odoo/api.py", line 533, in call_kw
    result = getattr(recs, name)(*args, **kwargs)
  File "/opt/odoo/addons/web/models/models.py", line 1012, in onchange
    todo = [
  File "/opt/odoo/addons/web/models/models.py", line 1015, in 
    if field_name not in done and snapshot0.has_changed(field_name)
  File "/opt/odoo/addons/web/models/models.py", line 1129, in has_changed
    return self[field_name].keys() != set(self.record[field_name]._ids) or any(
  File "/opt/odoo/odoo/models.py", line 7061, in __getitem__
    return self._fields[key].__get__(self)
  File "/opt/odoo/odoo/fields.py", line 4620, in __get__
    return super().__get__(records, owner)
  File "/opt/odoo/odoo/fields.py", line 3059, in __get__
    return super().__get__(records, owner)
  File "/opt/odoo/odoo/fields.py", line 1303, in __get__
    self.compute_value(recs)
  File "/opt/odoo/odoo/fields.py", line 1485, in compute_value
    records._compute_field_value(self)
  File "/opt/odoo/odoo/models.py", line 5280, in _compute_field_value
    fields.determine(field.compute, self)
  File "/opt/odoo/odoo/fields.py", line 110, in determine
    return needle(*args)
  File "/mnt/data/odoo-addons-dir/account_financial_report/models/account_group.py", line 78, in _compute_account_ids
    record.account_ids = list(
ValueError: invalid literal for int() with base 10: ''
Video is
Screencast.From.2025-07-18.17-56-36.mp4

Copy link
Contributor Author

Choose a reason for hiding this comment

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

fixed!

@micheledic micheledic force-pushed the 18.0_fix_account_ids_not_searchable branch 3 times, most recently from 0311fad to 1f0094a Compare July 11, 2025 15:43
@micheledic micheledic requested a review from monen17 July 11, 2025 15:51
)
)
group_by_code = dict(results)
self.account_ids = self.env["account.account"]
Copy link

Choose a reason for hiding this comment

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

Suggested change
self.account_ids = self.env["account.account"]

This is already assigned at the beginning of the method and hasn't changed since.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

removed

return
for record in self:
record.account_ids = list(
map(int, group_by_code.get(record.id, "").split(", "))
Copy link

Choose a reason for hiding this comment

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

Thanks!
I tried the same steps as above and no error is raised 👏
but as soon as I edit the code_prefix_end of the created group the following is raised:

Details
Traceback (most recent call last):
  File "/opt/odoo/odoo/http.py", line 2123, in _transactioning
    return service_model.retrying(func, env=self.env)
  File "/opt/odoo/odoo/service/model.py", line 156, in retrying
    result = func()
  File "/opt/odoo/odoo/http.py", line 2090, in _serve_ir_http
    response = self.dispatcher.dispatch(rule.endpoint, args)
  File "/opt/odoo/odoo/http.py", line 2338, in dispatch
    result = self.request.registry['ir.http']._dispatch(endpoint)
  File "/opt/odoo/odoo/addons/base/models/ir_http.py", line 333, in _dispatch
    result = endpoint(**request.params)
  File "/opt/odoo/odoo/http.py", line 754, in route_wrapper
    result = endpoint(self, *args, **params_ok)
  File "/opt/odoo/addons/web/controllers/dataset.py", line 36, in call_kw
    return call_kw(request.env[model], method, args, kwargs)
  File "/opt/odoo/odoo/api.py", line 533, in call_kw
    result = getattr(recs, name)(*args, **kwargs)
  File "/opt/odoo/addons/web/models/models.py", line 1012, in onchange
    todo = [
  File "/opt/odoo/addons/web/models/models.py", line 1015, in 
    if field_name not in done and snapshot0.has_changed(field_name)
  File "/opt/odoo/addons/web/models/models.py", line 1129, in has_changed
    return self[field_name].keys() != set(self.record[field_name]._ids) or any(
  File "/opt/odoo/odoo/models.py", line 7061, in __getitem__
    return self._fields[key].__get__(self)
  File "/opt/odoo/odoo/fields.py", line 4620, in __get__
    return super().__get__(records, owner)
  File "/opt/odoo/odoo/fields.py", line 3059, in __get__
    return super().__get__(records, owner)
  File "/opt/odoo/odoo/fields.py", line 1303, in __get__
    self.compute_value(recs)
  File "/opt/odoo/odoo/fields.py", line 1485, in compute_value
    records._compute_field_value(self)
  File "/opt/odoo/odoo/models.py", line 5280, in _compute_field_value
    fields.determine(field.compute, self)
  File "/opt/odoo/odoo/fields.py", line 110, in determine
    return needle(*args)
  File "/mnt/data/odoo-addons-dir/account_financial_report/models/account_group.py", line 78, in _compute_account_ids
    record.account_ids = list(
ValueError: invalid literal for int() with base 10: ''
Video is
Screencast.From.2025-07-18.17-56-36.mp4

char_length(agroup.code_prefix_start))
AND agroup.code_prefix_end >= LEFT(%(code_store)s->>agroup.company_id::text,
char_length(agroup.code_prefix_end))
AND agroup.id IN (%(group_ids)s)
Copy link

Choose a reason for hiding this comment

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

Suggested change
AND agroup.id IN (%(group_ids)s)
WHERE agroup.id IN (%(group_ids)s)

I don't know if it changes the result of the query, but it seems reasonable for this to be a WHERE condition, let me know what you think.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

fixed

@micheledic micheledic force-pushed the 18.0_fix_account_ids_not_searchable branch from 1f0094a to a3a9952 Compare July 21, 2025 07:23
@micheledic micheledic requested a review from monen17 July 21, 2025 07:36
@micheledic
Copy link
Contributor Author

@OCA/accounting-maintainers ping

@micheledic
Copy link
Contributor Author

@OCA/accounting-maintainers ping

@micheledic
Copy link
Contributor Author

@OCA/accounting-maintainers ping

@pedrobaeza pedrobaeza changed the title [FIX] account_financial_report: fix for "group_id" is not searchable accessing account_ids [18.0][FIX] account_financial_report: fix for "group_id" is not searchable accessing account_ids Sep 11, 2025
@pedrobaeza pedrobaeza added this to the 18.0 milestone Sep 11, 2025
results = self.env.execute_query(
SQL(
"""
SELECT
Copy link
Member

Choose a reason for hiding this comment

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

Please don't use SQL and do it by ORM.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

The query compares the same character length of the prefix length, it is not possible in Odoo ORM. because it means that we have to do a search with the WHOLE database of account and filter them in python.
It is very slowly than a query that uses indexes.
The prefix start and end may have different length so the logic is to compare the same length of character of the prefix and it is not possible with the search but only with filtered on the entire databse recordset

Copy link
Member

Choose a reason for hiding this comment

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

Uhm, I don't think the penalization is so high, as the number of accounts is limited (thousands at maximum). Anyway, at least put the query at the same indentation level that corresponds to Python code.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

done!

@micheledic micheledic force-pushed the 18.0_fix_account_ids_not_searchable branch 2 times, most recently from a26bacf to 7f9ad3e Compare September 11, 2025 10:13
Copy link
Member

@pedrobaeza pedrobaeza left a comment

Choose a reason for hiding this comment

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

OK, let's fix the problem

/ocabot merge patch

@OCA-git-bot
Copy link
Contributor

What a great day to merge this nice PR. Let's do it!
Prepared branch 18.0-ocabot-merge-pr-1327-by-pedrobaeza-bump-patch, awaiting test results.

OCA-git-bot added a commit that referenced this pull request Sep 11, 2025
Signed-off-by pedrobaeza
@pedrobaeza
Copy link
Member

Thanks for the patch

@OCA-git-bot
Copy link
Contributor

@pedrobaeza your merge command was aborted due to failed check(s), which you can inspect on this commit of 18.0-ocabot-merge-pr-1327-by-pedrobaeza-bump-patch.

After fixing the problem, you can re-issue a merge command. Please refrain from merging manually as it will most probably make the target branch red.

It happens because on 18.0 the group_id is not stored so the one2many account_ids
is not working
@micheledic micheledic force-pushed the 18.0_fix_account_ids_not_searchable branch from 7f9ad3e to 8535b91 Compare September 11, 2025 10:19
@micheledic
Copy link
Contributor Author

@pedrobaeza fixed the pre-commit error, now you can retrigger the merge!

@pedrobaeza
Copy link
Member

/ocabot merge patch

@OCA-git-bot
Copy link
Contributor

What a great day to merge this nice PR. Let's do it!
Prepared branch 18.0-ocabot-merge-pr-1327-by-pedrobaeza-bump-patch, awaiting test results.

@OCA-git-bot OCA-git-bot merged commit 074a2a2 into OCA:18.0 Sep 11, 2025
6 of 7 checks passed
@OCA-git-bot
Copy link
Contributor

Congratulations, your PR was merged at 51b2077. 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.

[18.0] account_financial_report: error non-stored field cannot be searched breaks odoo sh project update
4 participants