I would like to create products through a form from the web. it's possible??
Odoo is the world's easiest all-in-one management software.
It includes hundreds of business apps:
- CRM
- e-Commerce
- Kế toán
- Tồn kho
- PoS
- Project
- MRP
Câu hỏi này đã bị gắn cờ
Hi,
You can create a website form which takes all the product information which is to be created through website as inputs.All input values of the form will be available in the controller of the form action route.Then you can create a new record in the product model using create method by passing all the input values of the form
Eg:
< form action="/create_product" method="post">
< input type="hidden" name="csrf_token" t-att-value="request.csrf_token()"/>
< div class="clearfix">
< button type="submit" class="btn btn-primary float-right mb32 ">
Confirm
< span class="fa fa-long-arrow-right"/>
< /button>
< /div>
< div class="row o_portal_details">
< div class="col-lg-8">
< div class="row">
< div t-attf-class="form-group col-xl-6">
< label class="col-form-label" for="name">Name
< input type="text" name="name" t-attf-class="form-control"/>
< /div>
< /div>
< /div>
< /div>
< /form>
Controller method :
@route(['/create_product], type='http', auth='user', website=True)
def form_submit(self, **post):
product = request.env[product.template].sudo().create({
name: post['name'],
'field_2': post['field2'],
………….
})
Hope it helps
Bạn có hứng thú với cuộc thảo luận không? Đừng chỉ đọc, hãy tham gia nhé!
Tạo tài khoản ngay hôm nay để tận hưởng các tính năng độc đáo và tham gia cộng đồng tuyệt vời của chúng tôi!
Đăng kýBài viết liên quan | Trả lời | Lượt xem | Hoạt động | |
---|---|---|---|---|
|
3
thg 11 18
|
3252 | ||
|
0
thg 3 15
|
3762 | ||
|
0
thg 8 22
|
1350 | ||
|
0
thg 6 21
|
2428 | ||
How to create my own view?
Đã xử lý
|
|
4
thg 12 23
|
19477 |
See With code: https://www.youtube.com/watch?v=KBVwHkUSnuI&list=PLqRRLx0cl0hofGW8Nn9RH8Y3gtHIemlC8&index=2
Without code: https://www.youtube.com/watch?v=8uYxWRlxL_U&list=PLqRRLx0cl0hofGW8Nn9RH8Y3gtHIemlC8&index=1