Skip to Content
เมนู
คุณต้องลงทะเบียนเพื่อโต้ตอบกับคอมมูนิตี้
คำถามนี้ถูกตั้งค่าสถานะ
2 ตอบกลับ
2415 มุมมอง

hello everyone

I have created a form on a website page so that users can enter their product information, after submitting the form I want to save all the information as a new product. How do I do that?


อวตาร
ละทิ้ง
คำตอบที่ดีที่สุด

 Hi
You can add a controller to do that

1.In website form add the action and method as post-

action="/create/product" method="POST" 


2.Add a controller
@http.route('/create/product', type="http", auth="public", website=True) 
 def create_product(self, **kw): 
request.env['product.patient'].sudo().create(kw)


Make sure that the fields in the website form is same as product,otherwise add them as a dict instead of kw

อวตาร
ละทิ้ง
คำตอบที่ดีที่สุด

Hello, 

it is very simple with the help of Studio. You can go to the inventory => Products. Then click on the studio icon and go the website tab. Then click on the form and prepare the form in the website. 



อวตาร
ละทิ้ง
Related Posts ตอบกลับ มุมมอง กิจกรรม
2
ก.ย. 25
512
1
ต.ค. 25
650
2
มิ.ย. 25
2180
0
มี.ค. 25
2055
0
ก.พ. 25
1554