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

Hi, I created a custom module in Odoo14 named "piani_formazione" which contains two models named "azienda.py" (defined by _name="piani_formazione.azienda") and "dipendente.py" (defined by _name="piani_formazione.dipendente"). The two models work correctly. Then, I tried adding the following many2one field in the "dipendente.py", to show the azienda (=company, in English) in which every dipendente (=employee, in English) works: 

dipendente_azienda = fields.Many2one('piani_formazione.azienda', string="Azienda")
(I've tried even specifying comodel_name='piani_formazione.azienda')

and I added this field (dipendente_azienda) in the form and tree views of dipendente. But if I try to upgrade the module in Odoo, the programme gives back the following error (which I'll translate in English):

"dipendente_azienda" field doesn't exist in the "piani_formazione.dipendente" model
Ảnh đại diện
Huỷ bỏ
Câu trả lời hay nhất

If you did any changes in python you need to restart the odoo service and then upgrade your module.

if the above solution not worked

Try to comment this field in the form view and upgrade the module and after that, you can uncomment it in the view and upgrade your module. 

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

@CorTex IT Solutions Ltd

I found out I wasn't restarting Odoo how I was supposed to, thank you very much!!

Ảnh đại diện
Huỷ bỏ
Bài viết liên quan Trả lời Lượt xem Hoạt động
3
thg 9 25
1974
2
thg 2 25
6539
1
thg 11 22
16460
3
thg 8 22
13825
2
thg 8 22
5007