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] crm_location: make computes multi-record aware #516

Merged
merged 1 commit into from
Sep 8, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 11 additions & 10 deletions crm_location/models/crm_lead.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,20 +22,21 @@
@api.depends("location_id")
def _compute_partner_address_values(self):
res = super()._compute_partner_address_values()
if self.location_id:
self.update(
for lead in self.filtered("location_id"):
lead.update(
{
"zip": self.location_id.name,
"city": self.location_id.city_id.name,
"state_id": self.location_id.city_id.state_id,
"country_id": self.location_id.city_id.country_id,
"zip": lead.location_id.name,
"city": lead.location_id.city_id.name,
"state_id": lead.location_id.city_id.state_id,
"country_id": lead.location_id.city_id.country_id,
}
)
return res

@api.depends("partner_id")
def _compute_location_id(self):
if self.partner_id.zip_id:
self.location_id = self.partner_id.zip_id.id
elif self.location_id:
self.location_id = self.location_id.id
for lead in self:
if lead.partner_id.zip_id:
lead.location_id = lead.partner_id.zip_id.id
elif lead.location_id:
lead.location_id = lead.location_id.id

Check warning on line 42 in crm_location/models/crm_lead.py

View check run for this annotation

Codecov / codecov/patch

crm_location/models/crm_lead.py#L42

Added line #L42 was not covered by tests
Loading