Hi,
I'm working with the website module in odoo 13 .
How is it done so that when I press the button "delete" and "update" , it will generate a second URL to delete or update patient with the specified Id.
//.xml
<table class="table table-striped">
<thead>
<tr>
<td>Name</td>
<td>ID</td>
<td> Delete</td>
<td>Update</td>
</tr>
</thead>
<body>
<t t-foreach="patients" t-as="patient">
<tr>
<td>
<t t-esc="patient.name"/>
</td>
<td>
<t t-esc="patient.id"/>
</td>
<td>
<form action="/delete/patient" method="post">
<input type="hidden" name="csrf_token" t-att-value="request.csrf_token()"/>
<button type="submit" class="btn btn-primary pull-left">Delete</button>
</form>
</td>
<td>
<form action="/update/patient" method="post">
<input type="hidden" name="csrf_token" t-att-value="request.csrf_token()"/>
<button type="submit" class="btn btn-primary pull-left">Update</button>
</form>
</td>
</tr>
</t>
</body>
</table>
//.py
@http.route('/delete/patient', type="http", website=True, auth="public")
def delete_patient(self, **kw):
rec = request.env["hospital.patient"].search([])
p_id = int(kw.get('id', patient.id))
@http.route('/update/patient', type="http", website=True, auth="public")
def update_patient(self, **kw):
Any help please ?
Thanks.