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

[MIG][15.0]crm_lead_vat: Migration V15 #420

Closed
wants to merge 34 commits into from

Conversation

bizzappdev
Copy link
Contributor

No description provided.

@bizzappdev bizzappdev mentioned this pull request Feb 10, 2022
15 tasks
@bizzappdev bizzappdev force-pushed the 15.0-mig-crm-lead-vat-BAD-RUS branch 2 times, most recently from a1a834b to 082e6e5 Compare February 14, 2022 12:39
@bizzappdev bizzappdev changed the title [WIP][MIG][15.0]crm_lead_vat: Migration V15 [MIG][15.0]crm_lead_vat: Migration V15 Mar 2, 2022
@yajo
Copy link
Member

yajo commented Mar 30, 2022

/ocabot migration crm_lead_vat

@OCA-git-bot OCA-git-bot added this to the 15.0 milestone Mar 30, 2022
Copy link
Member

@yajo yajo left a comment

Choose a reason for hiding this comment

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

@moduon MT-518

Comment on lines 6 to 8
from odoo.addons.crm.models.crm_lead import PARTNER_ADDRESS_FIELDS_TO_SYNC

# Add vat in list
PARTNER_ADDRESS_FIELDS_TO_SYNC += ["vat"]

Copy link
Member

Choose a reason for hiding this comment

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

This code is loaded when the module is scanned by Odoo, at boot.

🛑 Thus you shouldn't alter this global variable (actually a pseudo-constant, as stated by the UPPER_CASE name).

Comment on lines 22 to 27
result = super(Lead, self)._prepare_values_from_partner(partner)
if not partner:
return result
if partner.vat:
result["vat"] = partner.vat
result = super(Lead, self)._prepare_address_values_from_partner(partner)
Copy link
Member

Choose a reason for hiding this comment

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

Following from the above comment, you should undo this diff and leave it as it was before.

This way, we only alter the behavior when a database has the module installed, and not only when it is available.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

changes are done.

@rafaelbn
Copy link
Member

@bizzappdev are you going to continue with this PR? Thanks! 😄

@RikiBalthazar
Copy link

def _prepare_address_values_from_partner(self, partner):
"""Recover VAT from partner if available."""
result = super(Lead, self)._prepare_address_values_from_partner(partner)
if not partner:
return result
if partner.vat:
result["vat"] = partner.vat
return result

Hello!
I made this work changing "_prepare_values_from_partner" whit > "_prepare_address_values_from_partner"
I hope this helps

@bizzappdev bizzappdev force-pushed the 15.0-mig-crm-lead-vat-BAD-RUS branch 2 times, most recently from 2bb42e1 to 05b7be2 Compare May 4, 2022 08:54
@bizzappdev bizzappdev force-pushed the 15.0-mig-crm-lead-vat-BAD-RUS branch from 05b7be2 to f605f2c Compare May 4, 2022 08:57
@github-actions
Copy link

github-actions bot commented Sep 4, 2022

There hasn't been any activity on this pull request in the past 4 months, so it has been marked as stale and it will be closed automatically if no further activity occurs in the next 30 days.
If you want this PR to never become stale, please ask a PSC member to apply the "no stale" label.

@github-actions github-actions bot added the stale PR/Issue without recent activity, it'll be soon closed automatically. label Sep 4, 2022
@github-actions github-actions bot closed this Oct 9, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
needs review stale PR/Issue without recent activity, it'll be soon closed automatically.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet