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

I encounter a very strange bug when I am developing a website.

I have two templates, called myself_male and myself_female, with exactly the same fields, only their data are to be stored in different tables, males and females respectively. So I let the template  myself_female inherit the template myself_male and change the action which stores data from creat_myself_male to creat_myself_female. The xml files are as below:


   
     


       

       

   
       

           
         

   
 






   
           creat_myself_female
   

My controller file is as below:

@http.route('/myself_male', auth='public', website=True)
def myself_male(self, **kw):
 return http.request.render('eden.myself_male', {})

The strange thing is that when I click the url: localhost:8069/myself_male, suppose controller will render myself_male and when I finish typing input and click submit, it will trigger the action creat_myself_male, but actually it trigger creat_myself_female, i.e. the inheriting template changes the content of the original one. This sounds incredible, but I repeat changing the name of the template many times, the result is the same. Can someone help me figure out what is wrong with my code? Thank you very much in advance.

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

You inheritance is alter the parent template, if you want to create a new child template from the parented one you have to add primary="True"

The below link will help you to understand how to create a new template from another once.

How to create new QWeb report with inheriting existing one - Odoo NinjaOdoo Ninja

Ảnh đại diện
Huỷ bỏ
Tác giả

Thank you very much

Bài viết liên quan Trả lời Lượt xem Hoạt động
1
thg 6 24
3412
1
thg 12 22
4254
4
thg 4 25
2513
0
thg 4 21
4609
1
thg 11 20
8592