Skip to content

Conversation

filisbits
Copy link
Contributor

The current implementation of the function _convert_field_to_company_dependent requires a field that stores the company value, but this field is not always available.

This change aims to allow that case by passing a falsy value as company_field, then it creates a json with the current value for all companies as the new value in the column

@robodoo
Copy link
Contributor

robodoo commented Sep 4, 2025

Pull request status dashboard

@filisbits filisbits requested review from a team and Pirols September 4, 2025 11:36
@KangOl
Copy link
Contributor

KangOl commented Sep 4, 2025

upgradeci retry with always only base

@KangOl
Copy link
Contributor

KangOl commented Sep 4, 2025

Can you add a test?

@filisbits filisbits force-pushed the master-fields-allownocompanyfieldincompanydependent-agcb branch from 0dc8bd3 to f131338 Compare September 9, 2025 13:48
@aj-fuentes aj-fuentes force-pushed the master-fields-allownocompanyfieldincompanydependent-agcb branch from f131338 to c1698c8 Compare October 1, 2025 13:00
@aj-fuentes
Copy link
Contributor

I rebased and pushed a fixup for the test to avoid reading the whole JSON data back

@aj-fuentes aj-fuentes force-pushed the master-fields-allownocompanyfieldincompanydependent-agcb branch 2 times, most recently from 956d79b to 5a0bd07 Compare October 1, 2025 13:12
Comment on lines 1195 to 1196
# make the ORM re-read the info about these manual fields from the DB
self.registry._setup_models__(self.env.cr, ["res.partner"])
Copy link
Contributor

Choose a reason for hiding this comment

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

With the help of @HydrionBurst this was the missing part to make the ORM reload the manual fields with the right metadata.

@aj-fuentes aj-fuentes force-pushed the master-fields-allownocompanyfieldincompanydependent-agcb branch from 5a0bd07 to 85be83a Compare October 1, 2025 13:30

# make the ORM re-read the info about these manual fields from the DB
if hasattr(self.registry, "_setup_models__"):
self.registry._setup_models__(self.env.cr)
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
self.registry._setup_models__(self.env.cr)
args = (["res.partner"],) if util.version_gte("saas~18.4") else ()
self.registry._setup_models__(self.env.cr, *args)

Copy link
Contributor

Choose a reason for hiding this comment

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

Done, a variant of this...

The current implementation of the function `_convert_field_to_company_dependent`
requires a field that stores the company value, but this field is not always
available.

This change aims to allow that case by passing a falsy value as company_field,
then it creates a json with the current value for all companies as the new
value in the column
@aj-fuentes aj-fuentes force-pushed the master-fields-allownocompanyfieldincompanydependent-agcb branch from 85be83a to 8372b21 Compare October 1, 2025 14:55
Copy link
Contributor

@KangOl KangOl left a comment

Choose a reason for hiding this comment

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

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

Successfully merging this pull request may close these issues.

4 participants