Bỏ qua để đến Nội dung
Menu
Câu hỏi này đã bị gắn cờ
2 Trả lời
7657 Lượt xem

I want to mail the open state invoices of a customer such that the mail body has a button called approve which will open up a webpage listing all the open state invoices and an approve button . The open state invoices are listed using checkboxes and the invoices thus selected by the customer using the checkboxes are approved by the approve button should change their state from open to paid.

please help


Ảnh đại diện
Huỷ bỏ
Câu trả lời hay nhất

You need to do a form submit and then do what you want with the submitted values.

Form template example: 

<form method="post"
	  class="s_website_form"
	  action="/routing-value"
	  enctype="multipart/form-data">
	<input type="hidden" name="csrf_token" t-att-value="request.csrf_token()"/>
	<div style="float: right;">
		<!-- html form input fields -->
		<select name="group_selection" style="padding: 3px;">
			<t t-foreach="selection_options" t-as="option">
				<t t-raw="option"/>
			</t>
		</select>
		<button type="submit" class="btn btn-primary">Show</button>
	</div>
</form>

Controller example

from odoo import http, _
from odoo.http import request
import odoo.addons.web.controllers.main

@http.route('/routing-value', type='http', auth='user', website=True) def get_form_values(self, **kwargs): if request.httprequest.method == 'POST': selection_value = request.params.get('group_selection') user_id = http.request.env.context.get('uid')         user = request.env['res.users'].search([('id', '=', user_id)])[0] # DO STUFF WITH THE GOTTEN DATA
                



 

Ảnh đại diện
Huỷ bỏ