def render_page4(self, **post): """ this method store data from current(4) page, and redirect to page next page(5) ------------------------------------------ @param self : object pointer @param type : http @param auth : public @param website : True @return : """ env = request.env(context=dict(request.env.context, show_address=True, no_tag_br=True)) student_obj = env['res.partner'] student_rec = student_obj.sudo().browse(int(post.get('student_id'))) if not student_rec.id: return request.redirect("/student/verification/expired") else: student_data = { 'hobbies_interests': post.get('Hobbies_Interests') or '', 'has_play_any_musical_instrument': post.get('Has_Play_any_Musical_Instrument') or '', 'musical_instrument_details': post.get('Musical_Instrument_Details') or '', 'has_formal_training_in_music': post.get('Has_Formal_Training_in_Music') or '', 'training_in_music_details': post.get('Training_in_Music_Details') or '', 'sport_child_play': post.get('Sport_Child_Play') or '', 'has_training_or_interest_art': post.get('Has_Training_or_Interest_Art') or '', 'has_training_or_interest_art_details': post.get('Training_or_Interest_Art_Details') or '', 'inter_school_competitions': post.get('Inter_School_Competitions') or '', 'inter_school_competitions_details': post.get('Inter_School_Competitions_Details') or '', 'special_activity_interested': post.get('Special_Activity_Interested') or '', 'adjusts_new_situations_with_ease': self.get_check_box_value( post.get('Adjusts_New_Situations_with_Ease')) or '', 'has_small_group_of_friends': self.get_check_box_value( post.get('Has_Small_Group_of_Friends')) or '', 'has_never_adjust_new_situation': self.get_check_box_value( post.get('Has_Never_Adjust_New_Situation')) or '', 'has_many_friends': self.get_check_box_value( post.get('Has_Many_Friends')) or '', 'likes_be_active_in_school': self.get_check_box_value( post.get('Likes_be_Active_in_School')) or '', 'expressions_describe_your_child': post.get('Expressions_Describe_your_Child') or '', 'social_emotional_behavioural_difficulties': post.get('Social_Emotional_Behavioural_Difficulties') or '', 'social_emotional_behavioural_difficulties_details': post.get( 'Social_Emotional_Behavioural_Difficulties_Details') or '', 'useful_information_for_educating': post.get('Useful_Information_for_Educating') or '', 'person_to_call' : post.get('Person_to_Call') or '', 'emergency_relationship' : post.get('Emergency_Relationship') or '', 'emergency_contact' : post.get('Emergency_Tel_No') or '', 'has_use_bus_facility' : post.get('Has_Use_Bus_Facility') or '', 'pick_up' : post.get('Pick_Up') or '', } student_rec.sudo().write(student_data) reg_obj = env['registration'] reg_rec = reg_obj.sudo().search([('enquiry_no','=',student_rec.reg_no)],limit=1) reg_rec.sudo().write(student_data) e_page_code = base64.b64encode('5') e_student_id = base64.b64encode(str(post.get('student_id'))) return request.redirect("/student/verification/pagecode?page_code=%s&student_id=%s" % (e_page_code,e_student_id))
def cart_update(self, product_id, add_qty=1, set_qty=0, **kw): """This is used to handle event of add to cart button redirect from detail page but only add fron shop page""" super(WebsiteSale, self).cart_update(product_id, add_qty, set_qty, **kw) if kw.get('express'): return request.redirect("/shop/checkout?express=1") elif 'product_template_id' in kw or 'timer' in kw: return request.redirect("/shop/cart") else: return request.redirect('/shop')
def render_page3(self, **post): """ this method store data from current(3) page, and redirect to page next page(4) ------------------------------------------ @param self : object pointer @param type : http @param auth : public @param website : True @return : """ env = request.env(context=dict(request.env.context, show_address=True, no_tag_br=True)) student_obj = env['res.partner'] student_rec = student_obj.sudo().browse(int(post.get('student_id'))) if not student_rec.id: return request.redirect("/student/verification/expired") else: Special_Learning_Disability_Details = False if post.get('Special_Learning_Disability'): Special_Learning_Disability_Details = post.get('Special_Learning_Disability_Details') student_data = { 'prev_institute': post.get('Current_School_Name') or '', 'prev_academic_city': post.get('Prev_Academic_City') or '', 'curriculum': post.get('Curriculum') or '', 'medium_of_instruction': post.get('Medium_of_Instruction') or '', 'last_attendance': post.get('Last_Attendance_Date') or False, 'tranfer_reason': post.get('Reason_for_Transfer') or '', 'received_double_promotion': post.get('Received_Double_Promotion') or '', 'identified_gifted_or_talented': post.get('Identified_Gifted_or_Talented') or '', 'has_child_detained': post.get('Has_Child_Detained') or '', 'child_received_academic_distinction': post.get('Child_Received_Academic_Distinction') or '', 'child_received_academic_distinction_details': post.get( 'Child_Received_Academic_Distinction_Details') or '', 'has_suspended_expelled_by_school' : post.get('Has_Suspended_Expelled_by_School') or '', 'has_suspended_expelled_by_school_details' : post.get('Has_Suspended_Expelled_by_School_Details') or '', 'child_associated_with_awareness' : post.get('Child_Associated_with_Awareness') or '', 'child_associated_with_awareness_details' : post.get('Child_Associated_with_Awareness_Details') or '', 'member_of_environment_protection' : post.get('Member_of_Environment_Protection') or '', 'member_of_environment_protection_details' : post.get('Member_of_Environment_Protection_Details') or '', 'leadership_positions_in_school' : post.get('Leadership_Positions_in_School') or '', 'leadership_positions_in_school_details' : post.get('Leadership_Positions_in_School_Details') or '', 'special_education_programme' : post.get('Special_Education_Programme') or '', 'special_education_programme_details' : post.get('Special_Education_Programme_Details') or '', 'special_learning_disability' : post.get('Special_Learning_Disability') or False, 'special_learning_disability_details' : Special_Learning_Disability_Details or False, 'has_other_than_english_languages' : post.get('Has_Other_than_English_Languages') or '', 'other_than_english_languages' : post.get('Other_than_English_Languages') or '', 'other_lang_id' : post.get('Optional_Lang') or '', 'has_child_detained_grade' : post.get('Has_Child_Detained_Grade') or '', } student_rec.sudo().write(student_data) reg_obj = env['registration'] reg_rec = reg_obj.sudo().search([('enquiry_no','=',student_rec.reg_no)],limit=1) reg_rec.sudo().write(student_data) e_page_code = base64.b64encode('4') e_student_id = base64.b64encode(str(post.get('student_id'))) return request.redirect("/student/verification/pagecode?page_code=%s&student_id=%s" % (e_page_code,e_student_id))
def render_student_verification(self, **post): """ inherit render_student_verification method, student additional form should student admission form. ------------------------------------------------------ @param self : object pointer @param type : http @param auth : public @param website : booleab(True) @return : """ if 'DATE' in post and post['DATE']: data = post['DATE'] link_date = self.decode_base64(data) if link_date == '': return request.render("website_student_enquiry.student_link_expired_templet",{}) if 'ENQUIRY' in post and post['ENQUIRY']: eq_no = str(post['ENQUIRY']) env = request.env(context=dict(request.env.context, show_address=True, no_tag_br=True)) reg_obj = env['registration'] reg_rec = reg_obj.sudo().search([('enquiry_no','=',eq_no)],limit=1) if reg_rec.id: if reg_rec.add_form_filled != True: if link_date != '0000-00-00': s_date = datetime.strptime(link_date, '%Y-%m-%d').date() l_date = s_date + timedelta(days=10) c_date = date.today() if s_date <= c_date < l_date: if 'ENQUIRY' in post and post['ENQUIRY']: student_obj = env['res.partner'] student_rec = student_obj.sudo().search(['|',('active','=',True), ('strike_off','=',True), ('is_student','=',True), ('reg_no','=',eq_no)],limit=1) if student_rec.id: e_student_id = base64.b64encode(str(student_rec.id)) return request.redirect( "/student/verification/pagecode?student_id=%s" % (e_student_id)) else: return request.render("website_student_enquiry.student_link_expired_templet",{}) else: if 'ENQUIRY' in post and post['ENQUIRY']: eq_no = str(post['ENQUIRY']) env = request.env(context=dict(request.env.context, show_address=True, no_tag_br=True)) student_obj = env['res.partner'] student_rec = student_obj.sudo().search(['|',('active','=',True), ('strike_off','=',True), ('is_student','=',True), ('reg_no','=',eq_no)],limit=1) if student_rec.id: e_student_id = base64.b64encode(str(student_rec.id)) return request.redirect( "/student/verification/pagecode?student_id=%s" % (e_student_id)) else: return request.render("website_student_enquiry.student_link_expired_templet",{})
def payment_token(self, pm_id, reference, amount, currency_id, return_url=None, **kwargs): token = request.env['payment.token'].browse(int(pm_id)) order_id = kwargs.get('order_id') if not token: return request.redirect('/website_payment/pay?error_msg=%s' % _('Cannot setup the payment.')) partner_id = request.env.user.partner_id.id if not request.env.user._is_public( ) else False values = { 'acquirer_id': token.acquirer_id.id, 'reference': reference, 'amount': float(amount), 'currency_id': int(currency_id), 'partner_id': partner_id, 'payment_token_id': pm_id, 'type': 'form_save' if token.acquirer_id.save_token != 'none' and partner_id else 'form', 'return_url': return_url, } if order_id: values['sale_order_ids'] = [(6, 0, [order_id])] tx = request.env['payment.transaction'].sudo().with_context( lang=None).create(values) PaymentProcessing.add_payment_transaction(tx) try: res = tx.s2s_do_transaction() if tx.state == 'done': tx.return_url = return_url or '/website_payment/confirm?tx_id=%d' % tx.id valid_state = 'authorized' if tx.acquirer_id.capture_manually else 'done' if not res or tx.state != valid_state: tx.return_url = '/website_payment/pay?error_msg=%s' % _( 'Payment transaction failed.') return request.redirect('/payment/process') except Exception as e: return request.redirect('/payment/process')
def portal_contract_page(self, contract=None, access_token=None, **kw): try: contract_sudo = self._contract_check_access(contract, access_token) except AccessError: return request.redirect('/my') except Exception: _logger.info("-------- Unknown Error-------") return request.redirect('/my') values = self._contract_get_page_view_values(contract_sudo, access_token, **kw) return request.render("eagle_saas_kit.portal_contract_page", values)
def account(self, redirect=None, **post): values = self._prepare_portal_layout_values() partner = request.env.user.partner_id values.update({ 'error': {}, 'error_message': [], }) if post and request.httprequest.method == 'POST': error, error_message = self.details_form_validate(post) values.update({'error': error, 'error_message': error_message}) values.update(post) if not error: values = { key: post[key] for key in self.MANDATORY_BILLING_FIELDS } values.update({ key: post[key] for key in self.OPTIONAL_BILLING_FIELDS if key in post }) values.update({'country_id': int(values.pop('country_id', 0))}) values.update({'zip': values.pop('zipcode', '')}) if values.get('state_id') == '': values.update({'state_id': False}) partner.sudo().write(values) if redirect: return request.redirect(redirect) return request.redirect('/my/home') countries = request.env['res.country'].sudo().search([]) states = request.env['res.country.state'].sudo().search([]) values.update({ 'partner': partner, 'countries': countries, 'states': states, 'has_check_vat': hasattr(request.env['res.partner'], 'check_vat'), 'redirect': redirect, 'page_name': 'my_details', }) response = request.render("portal.portal_my_details", values) response.headers['X-Frame-Options'] = 'DENY' return response
def render_page5(self, **post): """ this method store data from current(5) page, and redirect to page next page(6) ------------------------------------------ @param self : object pointer @param type : http @param auth : public @param website : True @return : call templet also pass dictonary for required data """ env = request.env(context=dict(request.env.context, show_address=True, no_tag_br=True)) student_obj = env['res.partner'] student_rec = student_obj.sudo().browse(int(post.get('student_id'))) if not student_rec.id: return request.redirect("/student/verification/expired") else: under_medi = False if post.get('Under_Medication') == True or post.get('Under_Medication') == 'True': under_medi = True student_data = { 'normal_delivery' : post.get('Normal_Delivery') or '', 'caesarean' : post.get('Caesarean') or '', 'premature' : post.get('Premature') or '', # 'developmental_milestones' : post.get('Developmental_Milestones') or '', 'age_your_child_talk' : post.get('Age_Your_Child_Talk') or '', 'hand_preference' : post.get('Hand_Preference') or '', 'can_button_his_shirt' : post.get('Can_Button_his_Shirt') or '', 'can_zip_his_pant' : post.get('Can_Zip_his_Pant') or '', 'can_child_indicate_his_toilet_needs' : post.get('Can_Child_Indicate_his_Toilet_Needs') or '', 'child_indicate_his_toilet_needs_details' : post.get('Child_Indicate_his_Toilet_Needs_Details') or '', 'child_know_his_phone_number' : post.get('Child_Know_his_Phone_Number') or '', 'toys_likes_to_play_with' : post.get('Toys_Likes_to_Play_With') or '', 'special_interest' : post.get('Special_Interest') or '', 'child_like_to_play_with' : post.get('Child_Like_to_Play_With') or '', 'child_like_to_look_at_picture' : post.get('Child_Like_to_Look_at_Picture') or '', 'child_like_to_watch_tv_programmes' : post.get('Child_Like_to_Watch_TV_Programmes') or '', 'channels_like_to_watch' : post.get('Channels_Like_to_Watch') or '', 'child_have_any_health_problem' : post.get('Child_Have_Any_Health_Problem') or '', 'health_problem_details' : post.get('Health_Problem_Details') or '', 'under_medication' : under_medi or False, 'w_medication_mention' : post.get('W_Medication_Mention') or '', } student_rec.sudo().write(student_data) reg_obj = env['registration'] reg_rec = reg_obj.sudo().search([('enquiry_no','=',student_rec.reg_no)],limit=1) reg_rec.sudo().write(student_data) e_page_code = base64.b64encode('6') e_student_id = base64.b64encode(str(post.get('student_id'))) return request.redirect("/student/verification/pagecode?page_code=%s&student_id=%s" % (e_page_code,e_student_id))
def validate_email(self, token, id, email, forum_id=None, **kwargs): if forum_id: try: forum_id = int(forum_id) except ValueError: forum_id = None done = request.env['res.users'].sudo().browse( int(id)).process_forum_validation_token(token, email, forum_id=forum_id)[0] if done: request.session['validation_email_done'] = True if forum_id: return request.redirect("/forum/%s" % int(forum_id)) return request.redirect('/forum')
def validate_email(self, token, user_id, email, **kwargs): done = request.env['res.users'].sudo().browse( int(user_id))._process_profile_validation_token(token, email) if done: request.session['validation_email_done'] = True url = kwargs.get('redirect_url', '/') return request.redirect(url)
def actions_server(self, path_or_xml_id_or_id, **post): ServerActions = request.env['ir.actions.server'] action = action_id = None # find the action_id: either an xml_id, the path, or an ID if isinstance(path_or_xml_id_or_id, str) and '.' in path_or_xml_id_or_id: action = request.env.ref(path_or_xml_id_or_id, raise_if_not_found=False) if not action: action = ServerActions.search( [('website_path', '=', path_or_xml_id_or_id), ('website_published', '=', True)], limit=1) if not action: try: action_id = int(path_or_xml_id_or_id) except ValueError: pass # check it effectively exists if action_id: action = ServerActions.browse(action_id).exists() # run it, return only if we got a Response object if action: if action.state == 'code' and action.website_published: action_res = action.run() if isinstance(action_res, werkzeug.wrappers.Response): return action_res return request.redirect('/')
def survey_retry(self, survey_token, answer_token, **post): """ This route is called whenever the user has attempts left and hits the 'Retry' button after failing the survey.""" access_data = self._get_access_data(survey_token, answer_token, ensure_token=True) if access_data['validity_code'] is not True and access_data[ 'validity_code'] != 'answer_done': return self._redirect_with_error(access_data, access_data['validity_code']) survey_sudo, answer_sudo = access_data['survey_sudo'], access_data[ 'answer_sudo'] if not answer_sudo: # attempts to 'retry' without having tried first return werkzeug.utils.redirect("/") try: retry_answer_sudo = survey_sudo._create_answer( user=request.env.user, partner=answer_sudo.partner_id, email=answer_sudo.email, invite_token=answer_sudo.invite_token, **self._prepare_retry_additional_values(answer_sudo)) except: return werkzeug.utils.redirect("/") return request.redirect( '/survey/start/%s?%s' % (survey_sudo.access_token, keep_query('*', answer_token=retry_answer_sudo.token)))
def registration_confirm(self, event, **post): order = request.website.sale_get_order(force_create=1) attendee_ids = set() registrations = self._process_registration_details(post) for registration in registrations: ticket = request.env['event.event.ticket'].sudo().browse( int(registration['ticket_id'])) cart_values = order.with_context( event_ticket_id=ticket.id, fixed_price=True)._cart_update( product_id=ticket.product_id.id, add_qty=1, registration_data=[registration]) attendee_ids |= set(cart_values.get('attendee_ids', [])) # free tickets -> order with amount = 0: auto-confirm, no checkout if not order.amount_total: order.action_confirm() # tde notsure: email sending ? attendees = request.env['event.registration'].browse( list(attendee_ids)).sudo() # clean context and session, then redirect to the confirmation page request.website.sale_reset() urls = event._get_event_resource_urls(list(attendee_ids)) return request.render( "website_event.registration_complete", { 'attendees': attendees, 'event': event, 'google_url': urls.get('google_url'), 'iCal_url': urls.get('iCal_url') }) return request.redirect("/shop/checkout")
def confirm(self, **kw): tx_id = int(kw.get('tx_id', 0)) access_token = kw.get('access_token') if tx_id: if access_token: tx = request.env['payment.transaction'].sudo().browse(tx_id) secret = request.env['ir.config_parameter'].sudo().get_param( 'database.secret') valid_token_str = '%s%s%s' % (tx.id, tx.reference, tx.amount) valid_token = hmac.new(secret.encode('utf-8'), valid_token_str.encode('utf-8'), hashlib.sha256).hexdigest() if not consteq(ustr(valid_token), access_token): raise werkzeug.exceptions.NotFound else: tx = request.env['payment.transaction'].browse(tx_id) if tx.state in ['done', 'authorized']: status = 'success' message = tx.acquirer_id.done_msg elif tx.state == 'pending': status = 'warning' message = tx.acquirer_id.pending_msg PaymentProcessing.remove_payment_transaction(tx) return request.render('payment.confirm', { 'tx': tx, 'status': status, 'message': message }) else: return request.redirect('/my/home')
def reset_template(self, templates, redirect='/', **kwargs): """ This method will try to reset a list of broken views ids. It will read the original `arch` from the view's XML file (arch_fs). Views without an `arch_fs` can't be reset, except views created when dropping a snippet in specific oe_structure that create an inherited view doing an xpath. Note: The `arch_fs` field is automatically erased when there is a write on the `arch` field. This method is typically useful to reset specific views. In that case we read the XML file from the generic view. """ templates = request.httprequest.form.getlist('templates') for temp_id in templates: view = request.env['ir.ui.view'].browse(int(temp_id)) if 'oe_structure' in view.key: # Particular xpathing view created in edit mode view.unlink() continue xml_view = view._get_original_view( ) # view might already be the xml_view if xml_view.arch_fs: view_file_arch = xml_view.with_context( read_arch_from_file=True).arch # Deactivate COW to not fix a generic view by creating a specific view.with_context(website_id=None).arch_db = view_file_arch if view == xml_view: view.model_data_id.write({'noupdate': False}) return request.redirect(redirect)
def jobs_add(self, **kwargs): # avoid branding of website_description by setting rendering_bundle in context job = request.env['hr.job'].with_context(rendering_bundle=True).create( { 'name': _('Job Title'), }) return request.redirect("/jobs/detail/%s?enable_editor=1" % slug(job))
def decline(self, order_id, access_token=None, **post): try: order_sudo = self._document_check_access('sale.order', order_id, access_token=access_token) except (AccessError, MissingError): return request.redirect('/my') message = post.get('decline_message') query_string = False if order_sudo.has_to_be_signed() and message: order_sudo.action_cancel() _message_post_helper(message=message, res_id=order_id, res_model='sale.order', **{'token': access_token} if access_token else {}) else: query_string = "&message=cant_reject" return request.redirect(order_sudo.get_portal_url(query_string=query_string))
def product_compare(self, **post): values = {} product_ids = [ int(i) for i in post.get('products', '').split(',') if i.isdigit() ] if not product_ids: return request.redirect("/shop") # use search to check read access on each record/ids products = request.env['product.product'].search([('id', 'in', product_ids)]) values['products'] = products.with_context(display_default_code=False) res = {} for num, product in enumerate(products): for var in product.product_tmpl_id._get_valid_product_template_attribute_lines( ): cat_name = var.attribute_id.category_id.name or _( 'Uncategorized') att_name = var.attribute_id.name if not var.attribute_id.create_variant: continue res.setdefault(cat_name, OrderedDict()).setdefault( att_name, [' - '] * len(products)) val = product.attribute_value_ids.filtered( lambda x: x.attribute_id == var.attribute_id) if val: res[cat_name][att_name][num] = val[0].name values['specs'] = res values['compute_currency'] = self._get_compute_currency_and_context( products[:1].product_tmpl_id)[0] return request.render("website_sale_comparison.product_compare", values)
def shop(self, page=0, category=None, search='', ppg=False, **post): if post.get('filter_clear'): return request.redirect('/shop') if post.get('filter_remove'): category = None values = self.ks_getShopValues(page, category, search, ppg, **post) return request.render("website_sale.products", values)
def add(self, order_id, option_id, access_token=None, **post): try: order_sudo = self._document_check_access('sale.order', order_id, access_token=access_token) except (AccessError, MissingError): return request.redirect('/my') option_sudo = request.env['sale.order.option'].sudo().browse(option_id) if order_sudo != option_sudo.order_id: return request.redirect(order_sudo.get_portal_url()) option_sudo.add_option_to_order() return request.redirect( option_sudo.order_id.get_portal_url(anchor='details'))
def portal_my_purchase_order(self, order_id=None, access_token=None, **kw): try: order_sudo = self._document_check_access('purchase.order', order_id, access_token=access_token) except (AccessError, MissingError): return request.redirect('/my') values = self._purchase_order_get_page_view_values(order_sudo, access_token, **kw) return request.render("purchase.portal_my_purchase_order", values)
def portal_chatter_post(self, res_model, res_id, message, **kw): url = request.httprequest.referrer if message: # message is received in plaintext and saved in html message = plaintext2html(message) _message_post_helper(res_model, int(res_id), message, **kw) url = url + "#discussion" return request.redirect(url)
def portal_my_project(self, project_id=None, access_token=None, **kw): try: project_sudo = self._document_check_access('project.project', project_id, access_token) except (AccessError, MissingError): return request.redirect('/my') values = self._project_get_page_view_values(project_sudo, access_token, **kw) return request.render("project.portal_my_project", values)
def pricelist(self, promo, **post): order = request.website.sale_get_order() coupon_status = request.env['sale.coupon.apply.code'].sudo().apply_coupon(order, promo) if coupon_status.get('not_found'): return super(WebsiteSale, self).pricelist(promo, **post) elif coupon_status.get('error'): request.session['error_promo_code'] = coupon_status['error'] return request.redirect(post.get('r', '/shop/cart'))
def payment_token(self, pm_id, reference, amount, currency_id, partner_id=False, return_url=None, **kwargs): token = request.env['payment.token'].browse(int(pm_id)) order_id = kwargs.get('order_id') if not token: return request.redirect('/website_payment/pay?error_msg=%s' % _('Cannot setup the payment.')) values = { 'acquirer_id': token.acquirer_id.id, 'reference': reference, 'amount': float(amount), 'currency_id': int(currency_id), 'partner_id': int(partner_id), 'payment_token_id': int(pm_id), 'type': 'server2server', 'return_url': return_url, } if order_id: values['sale_order_ids'] = [(6, 0, [int(order_id)])] tx = request.env['payment.transaction'].sudo().with_context( lang=None).create(values) PaymentProcessing.add_payment_transaction(tx) try: tx.s2s_do_transaction() secret = request.env['ir.config_parameter'].sudo().get_param( 'database.secret') token_str = '%s%s%s' % (tx.id, tx.reference, tx.amount) token = hmac.new(secret.encode('utf-8'), token_str.encode('utf-8'), hashlib.sha256).hexdigest() tx.return_url = return_url or '/website_payment/confirm?tx_id=%d&access_token=%s' % ( tx.id, token) except Exception as e: _logger.exception(e) return request.redirect('/payment/process')
def get_wishlist(self, count=False, **kw): values = request.env['product.wishlist'].with_context(display_default_code=False).current() if count: return request.make_response(json.dumps(values.mapped('product_id').ids)) if not len(values): return request.redirect("/shop") return request.render("website_sale_wishlist.product_wishlist", dict(wishes=values))
def portal_my_task(self, task_id, access_token=None, **kw): try: task_sudo = self._document_check_access('project.task', task_id, access_token) except (AccessError, MissingError): return request.redirect('/my') values = self._task_get_page_view_values(task_sudo, access_token, **kw) return request.render("project.portal_my_task", values)
def render_page2(self, **post): """ this method store data from current(2) page, and redirect to page next page(3) ------------------------------------------ @param self : object pointer @param type : http @param auth : public @param website : True @return : """ env = request.env(context=dict(request.env.context, show_address=True, no_tag_br=True)) student_obj = env['res.partner'] student_rec = student_obj.sudo().browse(int(post.get('student_id'))) if not student_rec.id: return request.redirect("/student/verification/expired") else: parent_data = { 'name' : post.get('Father_name') or '', 'father_nationality' : post.get('Father_Nationality') or '', 'father_passport' : post.get('Father_Passport') or '', 'father_emirates_id' : post.get('Father_Emirates_Id') or '', 'parent_profession' : post.get('Father_Designation') or '', 'parent_address' : post.get('Parent_Address') or '', 'parents_office_contact' : post.get('Parents_Office_Contact') or '', 'parent_contact' : post.get('Parent_Contact') or '', 'parents_email' : post.get('Parents_Email') or '', 'mother_name' : post.get('Mother_Name') or '', 'mother_nationality' : post.get('Mother_Nationality') or '', 'mother_passport' : post.get('Mother_Passport') or '', 'mother_emirates_id' : post.get('Mother_Emirates_Id') or '', 'mother_profession' : post.get('Mother_Designation') or '', 'mother_address' : post.get('Mother_Address') or '', 'mother_office_contact' : post.get('Mother_Office_Contact') or '', 'mother_contact' : post.get('Mother_Contact') or '', 'mother_email' : post.get('Mother_Email') or '', 'spe_contribution' : post.get('Special_Contribution') or '', 'special_contribution_any_other' : post.get('Special_Contribution_Any_Other') or '', } student_rec.parents1_id.sudo().write(parent_data) e_page_code = base64.b64encode('3') e_student_id = base64.b64encode(str(post.get('student_id'))) return request.redirect("/student/verification/pagecode?page_code=%s&student_id=%s" % (e_page_code,e_student_id))
def post_toggle_correct(self, forum, post, **kwargs): if post.parent_id is False: return request.redirect('/') if not request.session.uid: return {'error': 'anonymous_user'} # set all answers to False, only one can be accepted (post.parent_id.child_ids - post).write(dict(is_correct=False)) post.is_correct = not post.is_correct return post.is_correct
def checkout_redirection(self, order): res = super(Controller, self).checkout_redirection(order=order) order = request.website.with_context(request.context).sale_get_order() if not all([ line.product_uom_qty <= line.product_id.virtual_available for line in order.order_line if not line.is_delivery ]): return request.redirect("/shop/cart") return res