Contributors mailing list archives

contributors@odoo-community.org

Browse archives

Avatar

Re: Technical Question: Restart Odoo process after res.partner model change

by
ForgeFlow, S.L., Lois Rilo Antelo
- 20/06/2024 18:16:18
Hi Janik,

Another option is click-odoo-update, a nice contribution by Acsone. Hope it helps.

Regards,

On Thu, Jun 20, 2024 at 5:42 PM Tom Blauwendraat <notifications@odoo-community.org> wrote:
module_auto_update

20 jun. 2024 17:22:17 Janik von Rotz <notifications@odoo-community.org>:

Hello Odoo contributors,

I am developing, deploying and fixing Odoo for a while and there is one 
issue I haven't bothered enough to come up with a proper solution or 
strategy.

The problem is simple: I have an Odoo instance running with a module 
that extends the res.partner model. The res.partner code of this module 
is updated with a new field. The Odoo server is restarted and exits with 
a "column does not exist" error.

The same procedure works for modules that extend other models than 
res.partner or res.user. As I understand the res.partner (and other) 
tables are queried when the Odoo process starts. The SQL queries fail, 
because the model code does not match the database schema.

The solution to the problem seems obvious, before starting the Odoo 
server with the new code you install module (odoo-bin -i ...). However, 
automating this step in a deployment pipeline is difficult as you don't 
know which module needs to be updated. Always updating the base module 
seems like an overkill.

Do you know this problem? Have you solved this problem?

I would be glad to hear from you.

Regards,

Janik

Here is a guide to reproduce the issue with https://odoo.build/:

1. Init a new datbase and start the Odoo server: `task start db; task 
init-db; task start native`

2. Install the contacts module: `task install-module contacts`

3. Stop the Odoo process.

4. Add a new field to the res.partner code: `vi 
odoo/odoo/addons/base/models/res_partner.py`

```python

xy = fields.Char()

```

5. Start the Odoo server: `task start native`

It fails with:

```

...

psycopg2.errors.UndefinedColumn: column res_partner.xy does not exist
LINE 1: ..."message_bounce", "res_partner"."name" AS "name", "res_partn...
```                                                        ^



-- 
We are hiring: https://www.mint-system.ch/jobs
Send application to: jobs@mint-system.ch

CTO Mint System GmbH
Tel: +41 44 244 7222

_______________________________________________
Mailing-List: https://odoo-community.org/groups/contributors-15
Post to: mailto:contributors@odoo-community.org
Unsubscribe: https://odoo-community.org/groups?unsubscribe

_______________________________________________
Mailing-List: https://odoo-community.org/groups/contributors-15
Post to: mailto:contributors@odoo-community.org
Unsubscribe: https://odoo-community.org/groups?unsubscribe



--
Lois Rilo Antelo
ERP Consultant Manager at ForgeFlow S.L.

Reference