Skip to content

Commit

Permalink
[IMP] website_portal_contact: Go back to contacts list after creation…
Browse files Browse the repository at this point in the history
… or update
  • Loading branch information
SirTakobi committed Apr 7, 2022
1 parent fca3640 commit 603c4e4
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 10 deletions.
10 changes: 5 additions & 5 deletions website_portal_contact/controllers/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -149,13 +149,13 @@ def portal_my_contacts_new(self):
return self.portal_my_contacts_read(request.env["res.partner"].new())

@route("/my/contacts/create", auth="user", website=True)
def portal_my_contacts_create(self, redirect="/my/contacts/{}", **kwargs):
def portal_my_contacts_create(self, redirect="/my/contacts", **kwargs):
"""Create a contact."""
self._contacts_fields_check(kwargs.keys())
values = self._contacts_clean_values(kwargs)
_logger.debug("Creating contact with: %s", values)
contact = request.env["res.partner"].create(values)
return local_redirect(redirect.format(contact.id))
request.env["res.partner"].create(values)
return local_redirect(redirect)

def _contact_get_page_view_values(self, contact, access_token, **kwargs):
values = {
Expand Down Expand Up @@ -187,14 +187,14 @@ def portal_my_contacts_read(self, contact, access_token=None, **kw):
website=True,
)
def portal_my_contacts_update(
self, contact, redirect="/my/contacts/{}", **kwargs
self, contact, redirect="/my/contacts", **kwargs
):
"""Update a contact."""
self._contacts_fields_check(kwargs.keys())
values = self._contacts_clean_values(kwargs, contact=contact)
_logger.debug("Updating %r with: %s", contact, values)
contact.write(values)
return local_redirect(redirect.format(contact.id))
return local_redirect(redirect)

@route(
"/my/contacts/<model('res.partner'):contact>/disable",
Expand Down
5 changes: 0 additions & 5 deletions website_portal_contact/static/src/js/portal_contact.tour.js
Original file line number Diff line number Diff line change
Expand Up @@ -40,11 +40,6 @@ odoo.define('website_portal_contact.tour_test', function (require) {
run: 'click',
wait: 11500,
},
{
content: 'Return to list',
trigger: 'a[href="/my/contacts"]',
run: 'click',
},
{
content: 'Search for Guybrush',
trigger: '#wrap > div > div.row.mb-2 > div:nth-child(2) > form > div > input',
Expand Down

0 comments on commit 603c4e4

Please sign in to comment.