Skip to content

Commit

Permalink
[FIX] sale_planner_calendar: Remove partner name from default locatio…
Browse files Browse the repository at this point in the history
…n address

By passing `True` to the `_display_address` method,
the company/partner name is omitted from the address
format, ensuring that only address details are displayed.
This change was to calculate the GPS location exactly.

TT51008
  • Loading branch information
pilarvargas-tecnativa committed Sep 30, 2024
1 parent 3704f72 commit f0c895a
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
3 changes: 2 additions & 1 deletion sale_planner_calendar/models/res_partner.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,8 @@ def action_calendar_planner(self):
action["context"] = {
"default_target_partner_id": self.id,
"default_categ_ids": [(4, categ.id)],
"default_location": self._display_address(),
# Passing True omits the partner name, ensuring precise calculation of GPS location.
"default_location": self._display_address(True).replace("\n", " "),
"default_duration": categ.duration,
"default_name": categ.name,
"default_start": fields.Datetime.now(),
Expand Down
5 changes: 4 additions & 1 deletion sale_planner_calendar/tests/test_sale_planner_calendar.py
Original file line number Diff line number Diff line change
Expand Up @@ -197,7 +197,10 @@ def test_create_calendar_planner_event(self):
event = self.planned_events[0]
self.assertTrue(event.user_id in self.commercial_users)
self.assertEqual(event.rrule_type, "weekly")
self.assertEqual(event.location, event.target_partner_id._display_address())
self.assertEqual(
event.location,
event.target_partner_id._display_address(True).replace("\n", " "),
)

def test_planner_calendar_wizard(self):
wiz_form = Form(self.env["sale.planner.calendar.wizard"])
Expand Down

0 comments on commit f0c895a

Please sign in to comment.