Passa al contenuto
Menu
È necessario essere registrati per interagire con la community.
La domanda è stata contrassegnata
1 Rispondi
761 Visualizzazioni

Some time ago, I had someone help me by adding a custom field to a contact. They created a file:


/opt/odoo/customized_addons/odoo-custom-addons/partner_extra/models/res_partner.py

which contains this code:

class ResPartner(models.Model):

    """Adds ."""


    _inherit = "res.partner"


    recruitment = fields.Selection([

                                    ('c2c', 'Corp to Corp (C2C)'),

                                    ('w2', 'Full Time (W-2)')

                                   ],'Recruiter'

                                  )



And this works ok. But I would like to add additional options and maybe even additional whole fields. I am fluent in Python and have worked with Django and other things so I'm familiar with MVC and databases etc. But I have never written custom code for Odoo before.


I have changed the above to add an option like so:

    recruitment = fields.Selection([

                                    ('c2c', 'Corp to Corp (C2C)'),

                                    ('w2', 'Full Time (W-2)'),

                                    ('new option','New Option'),

                                   ],'Recruiter'

                                  )


and deleted the compiled and cached __pycache__/res_partner.cpython-36.pyc but the change does not appear in Odoo. Is there some other step I need to take? Maybe some command I need to run to update the database schema to allow for this new option?

Thanks!

Avatar
Abbandona
Autore

I forgot to mention that I was restarting odoo after my change. But you gave me an important clue that I was missing: I needed to upgrade the app in by clicking the three dots on the tile in the odoo apps screen. Then my changes appeared! Thanks! Upvoting and marking your answer correct...

Risposta migliore

Hello Tracy

In Odoo After changing anything in Python whether its model, wizard, controller 

You will need to restart the odoo service on the machine

for example if you run it on ubuntu you will need to run 

systemcl restart odoo(in this case odoo is the name of the service)

if you change anything in the XMl file you will need to upgrade the module

the cached file you are talking about is not related to Odoo, its related to pycharm

I hope this helps, 

If it helps please upvote my answer and Mark it as Correct


Avatar
Abbandona
Post correlati Risposte Visualizzazioni Attività
1
giu 25
155
1
giu 25
205
0
giu 25
146
2
giu 25
222
2
giu 25
565