Skip to content

Conversation

@hbrunn
Copy link
Member

@hbrunn hbrunn commented May 12, 2025

I don't think the hr migration should touch partner data at all: If a partner was marked as private in v16, its data is masked in the migration of the base module. If it's not private, it hasn't been protected before and we shouldn't overwrite it (think address_id == address_home_id == user_id.partner_id).

Also for handling private partners, we need to take the data from ou_res_partner_private if it exists, as otherwise we copy garbage into the employee fields.

Copy link
Contributor

@legalsylvain legalsylvain 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 !

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.

The UPDATE is needed, as we don't want to leak private information, now that there's no record rule protection on private addresses. You can restrict the update to type="private", but not to remove it.

@pedrobaeza pedrobaeza added this to the 17.0 milestone May 12, 2025
@hbrunn
Copy link
Member Author

hbrunn commented May 12, 2025

please read the link to what the base migration does and reconsider

@pedrobaeza
Copy link
Member

OK, we can remove it then, but with that code, you may have "NOT NULL" constraints over that fields if they have been added by third-party modules, so it's better to add "***" as I did, don't you think?

@hbrunn
Copy link
Member Author

hbrunn commented May 12, 2025

the hr.employee#private_* fields are new in v17, so any constraints added by other modules won't be in effect yet. And whatever constraints exist on partner fields, will have been satisfied or violated before, so not really an issue here.

If you mean a v16 module adding ie a column private_email with a not null constraint on hr.employee, well, that's just tough luck I think, but no reason to insert bogus data for everyone. Users with such a setting might want to contribute detecting such constraints then and add the asterisks if they exist. (that case is covered now by adding he.$fieldname to the fallback chain)

@hbrunn hbrunn force-pushed the 17.0-hr-fix-private_address branch from 8bc8638 to e61c409 Compare May 12, 2025 11:47
@pedrobaeza
Copy link
Member

pedrobaeza commented May 12, 2025

No, I mean that you have for example a not null constraint on res.partner~state_id, or country_id.

@hbrunn
Copy link
Member Author

hbrunn commented May 12, 2025

then all partners have this field set (or not and then the constraint is not effect) - I don't see the relevance of this for either this PR or the code from base?

@pedrobaeza
Copy link
Member

I mean the UPDATE sentence in base migration: https://github.com/OCA/OpenUpgrade/blob/17.0/openupgrade_scripts/scripts/base/17.0.1.3/pre-migration.py#L167 that is setting to NULL.

@hbrunn
Copy link
Member Author

hbrunn commented May 12, 2025

ah, I was confused because that's your own code and you talked about street before. well that could be a problem, but still not relevant for this PR, right?

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.

Yes, but it's just to take that into account. It's true that I mention street because I didn't see that field was correctly masked.

@pedrobaeza pedrobaeza merged commit 5e159f0 into OCA:17.0 May 12, 2025
4 checks passed
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