Hi ,
I want to update model from web controller , but I got this error when getting the current record id :
TypeError: int() argument must be a string, a bytes-like object or a number, not 'NoneType'
<form action="/update/teacher">
<input type="text" class="form-control" id="teacher_name" name="teacher_name"
t-att-value="teacher_id.teacher_name"/>
<button type="submit" class="btn btn-default">Submit</button>
</form>
@http.route('/update/teacher', type="http", website=True, auth="public")
def update_teacher(self, **kw):
http.request.env['academy.teacher'].browse(kw.get('id')).write(
{
'teacher_name': kw.get('teacher_name')
}
)
Any help please ?
Thanks.
Odoo is the world's easiest all-in-one management software.
It includes hundreds of business apps:
- CRM
- e-Commerce
- Accounting
- Inventory
- PoS
- Project management
- MRP
This question has been flagged
2
Replies
6434
Views
you have to add input hidden in your post call like
<input type="hidden" name="id" t-att-value="teacher.id"/>
Enjoying the discussion? Don't just read, join in!
Create an account today to enjoy exclusive features and engage with our awesome community!
Sign upRelated Posts | Replies | Views | Activity | |
---|---|---|---|---|
|
3
Apr 24
|
1004 | ||
|
0
May 24
|
46 | ||
|
1
Apr 24
|
1822 | ||
|
4
Sep 23
|
3076 | ||
|
2
Sep 23
|
5592 |
An idea of Odoo Web Controller:
1- http://bit.ly/odoo-web-controller
2- http://bit.ly/get-checkbox-value-in-odoo-controller