Skip to content

Commit

Permalink
refactor: ordenar métodos alfabéticamente
Browse files Browse the repository at this point in the history
  • Loading branch information
rubencabrera committed Apr 8, 2023
1 parent 08afdfe commit b8c2b71
Showing 1 changed file with 29 additions and 28 deletions.
57 changes: 29 additions & 28 deletions partner_portal_extra_details/controllers/portal.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,23 @@ class RayitoCustomerPortal(CustomerPortal):
"zipcode",
]

def _attach_payment_receipt(self, post):
Attachment = request.env['ir.attachment']
partner = request.env.user.partner_id
name = post.get('attachment').filename
file = post.get('attachment')
data = file.read()
attachment = Attachment.sudo().create({
'name': name,
'datas_fname': name,
'res_name': name,
'type': 'binary',
'res_model': 'res.partner',
'res_id': partner.id,
'datas': base64.b64encode(data)
})
return attachment

def _get_mandatory_billing_fields(self):
MANDATORY_BILLING_FIELDS = [
"birthdate_date",
Expand All @@ -54,6 +71,18 @@ def _get_optional_billing_fields(self):
]
return OPTIONAL_BILLING_FIELDS

def _render_receipt_payment(self, values):
response = request.render(
"partner_portal_extra_details.portal_my_details_receipt_payment",
values
)
response.headers['X-Frame-Options'] = 'DENY'
return response

def _set_partner_data(self):
partner = request.env.user.partner_id
partner.write({'attach_receipt': True})

@route(['/my/account'], type='http', auth='user', website=True)
def account(self, redirect=None, **post):
values = self._prepare_portal_layout_values()
Expand Down Expand Up @@ -115,31 +144,3 @@ def receipt(self, redirect=None, **post):
return request.redirect('/my')
return response

def _attach_payment_receipt(self, post):
Attachment = request.env['ir.attachment']
partner = request.env.user.partner_id
name = post.get('attachment').filename
file = post.get('attachment')
data = file.read()
attachment = Attachment.sudo().create({
'name': name,
'datas_fname': name,
'res_name': name,
'type': 'binary',
'res_model': 'res.partner',
'res_id': partner.id,
'datas': base64.b64encode(data)
})
return attachment

def _render_receipt_payment(self, values):
response = request.render(
"partner_portal_extra_details.portal_my_details_receipt_payment",
values
)
response.headers['X-Frame-Options'] = 'DENY'
return response

def _set_partner_data(self):
partner = request.env.user.partner_id
partner.write({'attach_receipt': True})

0 comments on commit b8c2b71

Please sign in to comment.