diff --git a/ssi_partner_portal/__manifest__.py b/ssi_partner_portal/__manifest__.py index b777553..a626d96 100644 --- a/ssi_partner_portal/__manifest__.py +++ b/ssi_partner_portal/__manifest__.py @@ -11,6 +11,7 @@ "application": True, "depends": [ "portal", + "web", "ssi_partner", ], "data": [ diff --git a/ssi_partner_portal/controllers/portal.py b/ssi_partner_portal/controllers/portal.py index 9d58d57..654c761 100644 --- a/ssi_partner_portal/controllers/portal.py +++ b/ssi_partner_portal/controllers/portal.py @@ -2,12 +2,21 @@ # Copyright 2023 PT. Simetri Sinergi Indonesia # License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). -from odoo.http import request, route +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 -CustomerPortal.OPTIONAL_BILLING_FIELDS.append("mobile") +CustomerPortal.OPTIONAL_BILLING_FIELDS += [ + "mobile", + "gender", + "birth_city", + "birthdate_date", + "image_1920", +] class CustomerPortalExtended(CustomerPortal): @@ -120,3 +129,19 @@ def remove_bank_account(self, **post): ) bank_account_id.unlink() return request.redirect("/my/bank_accounts") + + def convert_url_to_base64(self, url): + return base64.b64encode(requests.get(url).content) + + @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] + else: + post['image_1920'] = self.convert_url_to_base64(url=post['image_1920']) + res = super().account(redirect=redirect, **post) + return res diff --git a/ssi_partner_portal/static/src/css/bootstrap.css b/ssi_partner_portal/static/src/css/bootstrap.css new file mode 100644 index 0000000..c635ffd --- /dev/null +++ b/ssi_partner_portal/static/src/css/bootstrap.css @@ -0,0 +1,5 @@ +.col-image { + padding-right: 15px; + padding-left: 15px; + position: relative; +} diff --git a/ssi_partner_portal/views/assets.xml b/ssi_partner_portal/views/assets.xml index 41a7be1..f05faed 100644 --- a/ssi_partner_portal/views/assets.xml +++ b/ssi_partner_portal/views/assets.xml @@ -12,6 +12,11 @@ type="text/scss" href="/ssi_partner_portal/static/src/scss/portal.scss" /> + diff --git a/ssi_partner_portal/views/portal_templates.xml b/ssi_partner_portal/views/portal_templates.xml index 91f02a8..1d4dadd 100644 --- a/ssi_partner_portal/views/portal_templates.xml +++ b/ssi_partner_portal/views/portal_templates.xml @@ -4,6 +4,70 @@ License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). -->