Skip to content

Commit

Permalink
[MIG] website_portal_address
Browse files Browse the repository at this point in the history
[FIX] Remove rule already in parent module
[I18N] Italian translations
[REF] New README format
[FIX] Restore controllers inheritance
[MIG] Adapt to changed templates in dependency
[REF] Do not overwrite parent template
  • Loading branch information
SirTakobi committed Jul 7, 2023
1 parent 4b6c34c commit 67bceb2
Show file tree
Hide file tree
Showing 13 changed files with 179 additions and 115 deletions.
72 changes: 52 additions & 20 deletions website_portal_address/README.rst
Original file line number Diff line number Diff line change
@@ -1,13 +1,36 @@
.. image:: https://img.shields.io/badge/licence-LGPL--3-blue.svg
:target: http://www.gnu.org/licenses/lgpl-3.0-standalone.html
:alt: License: LGPL-3

===========================================
Contact's Address Manager In Website Portal
===========================================

This module extends the functionality of the website portal to allow your
users to manage their Addresses of contact.
.. !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!! This file is generated by oca-gen-addon-readme !!
!! changes will be overwritten. !!
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
.. |badge1| image:: https://img.shields.io/badge/maturity-Beta-yellow.png
:target: https://odoo-community.org/page/development-status
:alt: Beta
.. |badge2| image:: https://img.shields.io/badge/licence-AGPL--3-blue.png
:target: http://www.gnu.org/licenses/agpl-3.0-standalone.html
:alt: License: AGPL-3
.. |badge3| image:: https://img.shields.io/badge/github-OCA%2Fwebsite-lightgray.png?logo=github
:target: https://github.com/OCA/website/tree/12.0/website_portal_address
:alt: OCA/website
.. |badge4| image:: https://img.shields.io/badge/weblate-Translate%20me-F47D42.png
:target: https://translation.odoo-community.org/projects/website-12-0/website-12-0-website_portal_address
:alt: Translate me on Weblate
.. |badge5| image:: https://img.shields.io/badge/runbot-Try%20me-875A7B.png
:target: https://runbot.odoo-community.org/runbot/186/12.0
:alt: Try me on Runbot

|badge1| |badge2| |badge3| |badge4| |badge5|

This module extends the functionality of the website portal to allow your users to manage their Addresses of contact.

**Table of contents**

.. contents::
:local:

Usage
=====
Expand All @@ -19,37 +42,46 @@ To use this module, you need to:
#. Go to `your contacts manager </my/contacts>`_.
#. Read, create, edit or delete (disable) any contacts you want!

.. image:: https://odoo-community.org/website/image/ir.attachment/5784_f2813bd/datas
:alt: Try me on Runbot
:target: https://runbot.odoo-community.org/runbot/186/9.0

Bug Tracker
===========

Bugs are tracked on `GitHub Issues
<https://github.com/OCA/website/issues>`_. In case of trouble, please
check there if your issue has already been reported. If you spotted it first,
help us smashing it by providing a detailed and welcomed feedback.
Bugs are tracked on `GitHub Issues <https://github.com/OCA/website/issues>`_.
In case of trouble, please check there if your issue has already been reported.
If you spotted it first, help us smashing it by providing a detailed and welcomed
`feedback <https://github.com/OCA/website/issues/new?body=module:%20website_portal_address%0Aversion:%2012.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**>`_.

Do not contact contributors directly about support or help with technical issues.

Credits
=======

Authors
~~~~~~~

* Serpent Consulting Services Pvt. Ltd.
* Agile Business Group

Contributors
------------
~~~~~~~~~~~~

* Serpent Consulting Services Pvt. Ltd. <[email protected]>
* `TAKOBI <https://takobi.online>`_:

* Simone Rubino <[email protected]>

Maintainers
~~~~~~~~~~~

Maintainer
----------
This module is maintained by the OCA.

.. image:: https://odoo-community.org/logo.png
:alt: Odoo Community Association
:target: https://odoo-community.org

This module is maintained by the OCA.

OCA, or the Odoo Community Association, is a nonprofit organization whose
mission is to support the collaborative development of Odoo features and
promote its widespread use.

To contribute to this module, please visit https://odoo-community.org.
This module is part of the `OCA/website <https://github.com/OCA/website/tree/12.0/website_portal_address>`_ project on GitHub.

You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute.
2 changes: 1 addition & 1 deletion website_portal_address/__manifest__.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
# Copyright 2016 Jairo Llopis <[email protected]>
# Copyright 2016-Today Serpent Consulting Services Pvt. Ltd.
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html)
{
Expand All @@ -14,7 +15,6 @@
"website_portal_contact",
],
"data": [
"security/ir.rule.csv",
"views/assets.xml",
"views/contact_address.xml",
"views/layout.xml",
Expand Down
30 changes: 9 additions & 21 deletions website_portal_address/controllers/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,32 +3,26 @@

import logging

from odoo.http import request, route
from odoo.http import request
from odoo.addons.website_portal_contact.controllers.main import WebsiteAccount

_logger = logging.getLogger(__name__)


class WebsiteAccount(WebsiteAccount):
@route(
"/my/contacts/<model('res.partner'):contact>",
auth="user",
website=True,
)
def portal_my_contacts_read(self, contact, access_token=None, **kw):
values = self._contact_get_page_view_values(contact, access_token, **kw)
class PortalAddress (WebsiteAccount):

def _contact_get_page_view_values(self, contact, access_token, **kwargs):
values = super()._contact_get_page_view_values(contact, access_token, **kwargs)
values.update(
{
"state_id": request.env["res.country.state"].sudo().search([]),
"country_id": request.env["res.country"].sudo().search([]),
}
)
return request.render(
"website_portal_contact.contacts_followup", values
)
return values

def _contacts_fields(self):
res = super(WebsiteAccount, self)._contacts_fields()
res = super()._contacts_fields()
res += [
"type",
"street",
Expand All @@ -42,6 +36,7 @@ def _contacts_fields(self):

def _contacts_clean_values(self, values, contact=False):
"""Set values to a write-compatible format"""
# Validate the new fields before cleaning values
if "state_id" not in values:
# Force erase the data
values["state_id"] = False
Expand All @@ -57,11 +52,4 @@ def _contacts_clean_values(self, values, contact=False):
except ValueError:
_logger.warning(
'Cannot parse "country_id" : %s' % (values["country_id"]))

result = {k: v or False for k, v in values.items()}
result.setdefault("type", "contact")
if not contact or contact.id != request.env.user.commercial_partner_id.id:
result.setdefault(
"parent_id", request.env.user.commercial_partner_id.id
)
return result
return super()._contacts_clean_values(values, contact=contact)
65 changes: 42 additions & 23 deletions website_portal_address/i18n/it.po
Original file line number Diff line number Diff line change
@@ -1,87 +1,106 @@
# Translation of Odoo Server.
# This file contains the translation of the following modules:
# * website_portal_address
# * website_portal_address
#
msgid ""
msgstr ""
"Project-Id-Version: Odoo Server 9.0c\n"
"Project-Id-Version: Odoo Server 12.0\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2016-11-10 09:29+0000\n"
"PO-Revision-Date: 2016-11-10 09:29+0000\n"
"Last-Translator: <>\n"
"POT-Creation-Date: 2022-03-21 17:27+0000\n"
"PO-Revision-Date: 2022-03-21 17:27+0000\n"
"Last-Translator: Simone Rubino <[email protected]>\n"
"Language-Team: \n"
"Language: \n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: \n"
"Plural-Forms: \n"

#. module: website_portal_address
#: model:ir.ui.view,arch_db:website_portal_address.contact_address_type
#: model_terms:ir.ui.view,arch_db:website_portal_address.contact_address_type
msgid "Address"
msgstr "Indirizzo"

#. module: website_portal_address
#: model:ir.ui.view,arch_db:website_portal_address.contact_address_type
#: model_terms:ir.ui.view,arch_db:website_portal_address.contact_address_type
msgid "City"
msgstr "Città"

#. module: website_portal_address
#: model_terms:ir.ui.view,arch_db:website_portal_address.contact_address_type
msgid "Contact"
msgstr "Contatto"

#. module: website_portal_address
#: model:ir.ui.view,arch_db:website_portal_address.contact_address_type
#: model_terms:ir.ui.view,arch_db:website_portal_address.contact_address_type
msgid "Country"
msgstr "Nazione"

#. module: website_portal_address
#: model:ir.ui.view,arch_db:website_portal_address.contact_address_type
#: model_terms:ir.ui.view,arch_db:website_portal_address.contact_address_type
msgid "Country..."
msgstr "Nazione..."

#. module: website_portal_address
#: model:ir.ui.view,arch_db:website_portal_address.contact_address_type
#: model_terms:ir.ui.view,arch_db:website_portal_address.contact_address_type
msgid "Invoice address"
msgstr "Indirizzo Fatturazione"

#. module: website_portal_address
#: model:ir.ui.view,arch_db:website_portal_address.contact_address_type
#: model_terms:ir.ui.view,arch_db:website_portal_address.contact_address_type
msgid "Other address"
msgstr "Altro Indirizzo"

#. module: website_portal_address
#: model:ir.ui.view,arch_db:website_portal_address.contact_address_type
#: model_terms:ir.ui.view,arch_db:website_portal_address.contact_address_type
msgid "Shipping address"
msgstr "Indirizzo di Consegna"

#. module: website_portal_address
#: model:ir.ui.view,arch_db:website_portal_address.contact_address_type
#: model_terms:ir.ui.view,arch_db:website_portal_address.contact_address_type_website_form
msgid "Society"
msgstr "Società"

#. module: website_portal_address
#: model_terms:ir.ui.view,arch_db:website_portal_address.contact_address_type
msgid "State"
msgstr "Stato"
msgstr "Provincia"

#. module: website_portal_address
#: model:ir.ui.view,arch_db:website_portal_address.contact_address_type
#: model_terms:ir.ui.view,arch_db:website_portal_address.contact_address_type
msgid "State / Province"
msgstr "Provincia"

#. module: website_portal_address
#: model_terms:ir.ui.view,arch_db:website_portal_address.contact_address_type
msgid "State..."
msgstr "Stato..."
msgstr "Provincia..."

#. module: website_portal_address
#: model:ir.ui.view,arch_db:website_portal_address.contact_address_type
#: model_terms:ir.ui.view,arch_db:website_portal_address.contact_address_type
msgid "Street..."
msgstr "Via..."

#. module: website_portal_address
#: model:ir.ui.view,arch_db:website_portal_address.contact_address_type
#: model_terms:ir.ui.view,arch_db:website_portal_address.contact_address_type
msgid "Street2..."
msgstr "Via 2..."

#. module: website_portal_address
#: model:ir.ui.view,arch_db:website_portal_address.contact_address_type_website_form
#: model_terms:ir.ui.view,arch_db:website_portal_address.contact_address_type_website_form
msgid "Type"
msgstr "Tipo"
msgstr "Tipologia"

#. module: website_portal_address
#: model_terms:ir.ui.view,arch_db:website_portal_address.contact_address_type
msgid "Zip"
msgstr "CAP"

#. module: website_portal_address
#: model:ir.ui.view,arch_db:website_portal_address.contact_address_type
#: model_terms:ir.ui.view,arch_db:website_portal_address.contact_address_type
msgid "city..."
msgstr "città..."

#. module: website_portal_address
#: model:ir.ui.view,arch_db:website_portal_address.contact_address_type
#: model_terms:ir.ui.view,arch_db:website_portal_address.contact_address_type
msgid "zip..."
msgstr "cap..."
4 changes: 4 additions & 0 deletions website_portal_address/readme/CONTRIBUTORS.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
* Serpent Consulting Services Pvt. Ltd. <[email protected]>
* `TAKOBI <https://takobi.online>`_:

* Simone Rubino <[email protected]>
1 change: 1 addition & 0 deletions website_portal_address/readme/DESCRIPTION.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
This module extends the functionality of the website portal to allow your users to manage their Addresses of contact.
6 changes: 6 additions & 0 deletions website_portal_address/readme/USAGE.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
To use this module, you need to:

#. Log in as a portal user.
#. Go to `your portal home </my/home>`_.
#. Go to `your contacts manager </my/contacts>`_.
#. Read, create, edit or delete (disable) any contacts you want!
2 changes: 0 additions & 2 deletions website_portal_address/security/ir.rule.csv

This file was deleted.

14 changes: 7 additions & 7 deletions website_portal_address/static/src/js/portal_address.tour.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,8 @@ odoo.define('website_portal_address.tour_test', function (require) {
var steps = [
{
content: 'Click to add Guybrush',
trigger: 'div.col-md-4.col-md-offset-4.mt8 > a',
waitFor: 'div.col-md-4.col-md-offset-4.mt8 > a',
trigger: '#wrap > div > div.row.mb-2 > div:nth-child(1) > a',
waitFor: '#wrap > div > div.row.mb-2 > div:nth-child(1) > a',
position: 'top',
run: 'click',
},
Expand Down Expand Up @@ -89,7 +89,7 @@ odoo.define('website_portal_address.tour_test', function (require) {
// },
{
content: 'Save new contact Guybrush',
trigger: '#portal_contact > section > div > button',
trigger: '#portal_contact > div.form-group.row.float-right > div:nth-child(2) > button',
run: 'click',
wait: 11500,
},
Expand All @@ -100,20 +100,20 @@ odoo.define('website_portal_address.tour_test', function (require) {
},
{
content: 'Search for Guybrush',
trigger: '#wrap > div.container.mb64 > div.row.mt16.mb16 > div.col-md-4.mt8 > form > div > input',
waitFor: '#wrap > div.container.mb64 > div.row.mt16.mb16 > div.col-md-4.mt8 > form > div > input',
trigger: '#wrap > div > div.row.mb-2 > div:nth-child(2) > form > div > input',
waitFor: '#wrap > div > div.row.mb-2 > div:nth-child(2) > form > div > input',
position: 'top',
run: 'text guybrush',
},
{
content: 'Click search for Guybrush',
position: 'top',
trigger: '#wrap > div.container.mb64 > div.row.mt16.mb16 > div.col-md-4.mt8 > form > div > span > button',
trigger: '#wrap > div > div.row.mb-2 > div:nth-child(2) > form > div > span > button',
run: 'click',
},
{
content: 'Delete Guybrush',
trigger: 'tr:contains("Guybrush") td.text-center > a',
trigger: 'tr:contains("Guybrush") > td.text-center > a',
waitFor: 'tr:contains("Guybrush")',
run: 'click',
},
Expand Down
4 changes: 2 additions & 2 deletions website_portal_address/tests/__init__.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Copyright 2016 Jairo Llopis <[email protected]>
# License LGPL-3.0 or later (http://www.gnu.org/licenses/lgpl).
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html)

from . import test_main
from . import test_ui
Loading

0 comments on commit 67bceb2

Please sign in to comment.