Skip to content

Commit

Permalink
[FIX] pre-commit
Browse files Browse the repository at this point in the history
  • Loading branch information
mikevhe18 committed Mar 22, 2024
1 parent fc78c11 commit 359ed98
Show file tree
Hide file tree
Showing 2 changed files with 35 additions and 22 deletions.
21 changes: 12 additions & 9 deletions ssi_partner_portal/controllers/portal.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,11 @@
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).

import base64

import requests

from odoo import tools
from odoo.http import request, route

from odoo.addons.portal.controllers import portal
from odoo.addons.portal.controllers.portal import CustomerPortal

Expand Down Expand Up @@ -133,15 +134,17 @@ def remove_bank_account(self, **post):
def convert_url_to_base64(self, url):
return base64.b64encode(requests.get(url).content)

@route(['/my/account'], type='http', auth='user', website=True)
@route(["/my/account"], type="http", auth="user", website=True)
def account(self, redirect=None, **post):
if 'input_image_1920' in post:
post.pop('input_image_1920')
if post.get('image_1920'):
if 'base64' in post['image_1920']:
image_vals = post['image_1920'].split('base64,')
post['image_1920'] = image_vals[-1]
if "input_image_1920" in post:
post.pop("input_image_1920")
if post.get("image_1920"):
if "base64" in post["image_1920"]:
image_vals = post["image_1920"].split("base64,")
post["image_1920"] = image_vals[-1]
else:
post['image_1920'] = self.convert_url_to_base64(url=post['image_1920'])
post["image_1920"] = self.convert_url_to_base64(
url=post["image_1920"]
)
res = super().account(redirect=redirect, **post)
return res
36 changes: 23 additions & 13 deletions ssi_partner_portal/views/portal_templates.xml
Original file line number Diff line number Diff line change
Expand Up @@ -19,14 +19,21 @@
name="image_1920"
t-att-src="avatar_source_default"
/>
<br/>
<br/>
<t t-set="avatar_source_default" name="avatar_source_default" t-value="'/web/static/src/img/placeholder.png'"/>
<br />
<br />
<t
t-set="avatar_source_default"
name="avatar_source_default"
t-value="'/web/static/src/img/placeholder.png'"
/>
<t t-if="partner.image_1920">
<t t-set="avatar_source" t-value="image_data_uri(partner.image_1920)"/>
<t
t-set="avatar_source"
t-value="image_data_uri(partner.image_1920)"
/>
</t>
<t t-else="">
<t t-set="avatar_source" t-value="avatar_source_default"/>
<t t-set="avatar_source" t-value="avatar_source_default" />
</t>
<img
name="default_image_1920"
Expand All @@ -40,8 +47,12 @@
width="100px"
height="100px"
/>
<br/>
<a class="btn btn-link btn-sm" href="#" onclick="removeImage()">Remove Image</a>
<br />
<a
class="btn btn-link btn-sm"
href="#"
onclick="removeImage()"
>Remove Image</a>
</div>
<script type="text/javascript">
const setShowImage = async (e) => {
Expand All @@ -64,9 +75,7 @@
document.getElementsByName("input_image_1920")[0].value = null;
};
</script>
<div
t-attf-class="form-group col-xl-6"
/>
<div t-attf-class="form-group col-xl-6" />
</xpath>
<xpath expr="//div[hasclass('col-lg-8')]/div/div[7]" position="after">
<div
Expand All @@ -85,9 +94,10 @@
>
<label for="gender">Gender:</label>
<select
class="form-control"
name="gender"
t-attf-class="form-control #{error.get('gender') and 'is-invalid' or ''}">
class="form-control"
name="gender"
t-attf-class="form-control #{error.get('gender') and 'is-invalid' or ''}"
>
<option value="" />
<option
value="male"
Expand Down

0 comments on commit 359ed98

Please sign in to comment.