Skip to Content
Odoo Meniu
  • Autentificare
  • Try it free
  • Aplicații
    Finanțe
    • Contabilitate
    • Facturare
    • Cheltuieli
    • Spreadsheet (BI)
    • Documente
    • Semn
    Vânzări
    • CRM
    • Vânzări
    • POS Shop
    • POS Restaurant
    • Abonamente
    • Închiriere
    Site-uri web
    • Constructor de site-uri
    • eCommerce
    • Blog
    • Forum
    • Live Chat
    • eLearning
    Lanț Aprovizionare
    • Inventar
    • Producție
    • PLM
    • Achiziție
    • Maintenance
    • Calitate
    Resurse Umane
    • Angajați
    • Recrutare
    • Time Off
    • Evaluări
    • Referințe
    • Flotă
    Marketing
    • Social Marketing
    • Marketing prin email
    • SMS Marketing
    • Evenimente
    • Automatizare marketing
    • Sondaje
    Servicii
    • Proiect
    • Foi de pontaj
    • Servicii de teren
    • Centru de asistență
    • Planificare
    • Programări
    Productivitate
    • Discuss
    • Aprobări
    • IoT
    • VoIP
    • Knowledge
    • WhatsApp
    Aplicații Terțe Odoo Studio Platforma Odoo Cloud
  • Industrii
    Retail
    • Book Store
    • Magazin de îmbrăcăminte
    • Magazin de Mobilă
    • Magazin alimentar
    • Magazin de materiale de construcții
    • Magazin de jucării
    Food & Hospitality
    • Bar and Pub
    • Restaurant
    • Fast Food
    • Guest House
    • Distribuitor de băuturi
    • Hotel
    Proprietate imobiliara
    • Real Estate Agency
    • Firmă de Arhitectură
    • Construcție
    • Estate Managament
    • Grădinărit
    • Asociația Proprietarilor de Proprietăți
    Consultanta
    • Firma de Contabilitate
    • Partener Odoo
    • Agenție de marketing
    • Law firm
    • Atragere de talente
    • Audit & Certification
    Producție
    • Textil
    • Metal
    • Mobilier
    • Mâncare
    • Brewery
    • Cadouri corporate
    Health & Fitness
    • Club Sportiv
    • Magazin de ochelari
    • Centru de Fitness
    • Wellness Practitioners
    • Farmacie
    • Salon de coafură
    Trades
    • Handyman
    • IT Hardware and Support
    • Asigurare socială de stat
    • Cizmar
    • Servicii de curățenie
    • HVAC Services
    Altele
    • Organizație nonprofit
    • Agenție de Mediu
    • Închiriere panouri publicitare
    • Fotografie
    • Închiriere biciclete
    • Asigurare socială
    Browse all Industries
  • Comunitate
    Învăță
    • Tutorials
    • Documentație
    • Certificări
    • Instruire
    • Blog
    • Podcast
    Empower Education
    • Program Educațional
    • Scale Up! Business Game
    • Visit Odoo
    Obține Software-ul
    • Descărcare
    • Compară Edițiile
    • Lansări
    Colaborați
    • Github
    • Forum
    • Evenimente
    • Translations
    • Devino Partener
    • Services for Partners
    • Înregistrează-ți Firma de Contabilitate
    Obține Servicii
    • Găsește un Partener
    • Găsiți un contabil
    • Meet an advisor
    • Servicii de Implementare
    • Referințe ale clienților
    • Suport
    • Actualizări
    Github Youtube Twitter Linkedin Instagram Facebook Spotify
    +1 (650) 691-3277
    Obține un demo
  • Prețuri
  • Ajutor

Odoo is the world's easiest all-in-one management software.
It includes hundreds of business apps:

  • CRM
  • e-Commerce
  • Contabilitate
  • Inventar
  • PoS
  • Proiect
  • MRP
All apps
Trebuie să fiți înregistrat pentru a interacționa cu comunitatea.
All Posts Oameni Insigne
Etichete (View all)
odoo accounting v14 pos v15
Despre acest forum
Trebuie să fiți înregistrat pentru a interacționa cu comunitatea.
All Posts Oameni Insigne
Etichete (View all)
odoo accounting v14 pos v15
Despre acest forum
Suport

ODOO13 ORM problem?

Abonare

Primiți o notificare când există activitate la acestă postare

Această întrebare a fost marcată
postgresqlormOdoo13.0
2 Răspunsuri
5002 Vizualizări
Imagine profil
Some ODOO newbie developer

I'm trying to add a field on res.partner, but everytime that I upgrade the module the field just doesn't appear, even on postgresql...
And after I restart the server, I got a error psycopg2.errors.UndefinedColumn: column res_partner.distrito does not exist

distrito = fields.Char(string='Bairro') <= field problem

I have no idea what is happening. 

My code:

from odoo import models, fields, api


class ResPartner(models.Model):
 _inherit = 'res.partner'

tipo_cliente = fields.Selection( string= 'Tipo do cliente', selection=[('gov','Governo'),('pri','Privado')])
tipo_contato_id = fields.Many2one( string='Tipo do contato', comodel_name='tipo.contato')
orgao_id = fields.Many2one( string='Orgão', comodel_name='orgao.governo')
distrito = fields.Char(string='Bairro') #<- field that doesn't appear
partido_id = fields.Many2one( string='Partido', comodel_name='partido.governo')
departamento_id = fields.Many2one( string='Departamento', comodel_name='departamento')
is_customer = fields.Boolean( string='É cliente?', default=False)

class Departamento(models.Model):
 _name = 'departamento'
 _description = 'Departamento'


name = fields.Char(string='Nome do departamento')

class TipoContato(models.Model):
 _name = 'tipo.contato'
 _description = 'Tipo do contato'


name = fields.Char(string='Tipo')


class OrgaoGoverno(models.Model): 
_name = 'orgao.governo'
 _description = 'Orgão do governo'
name = fields.Char(string='Nome')
​

class PartidoGoverno(models.Model):
 _name = 'partido.governo'
 _description = 'Partido'
name = fields.Char(string='Sigla')

ERROR:

During handling of the above exception, another exception occurred:
odoo_13 |
odoo_13 | Traceback (most recent call last):
odoo_13 | File "/usr/lib/python3/dist-packages/odoo/addons/base/models/ir_cron.py", line 230, in _process_jobs
odoo_13 | registry[cls._name]._process_job(job_cr, job, lock_cr)
odoo_13 | File "/usr/lib/python3/dist-packages/odoo/addons/base/models/ir_cron.py", line 131, in _process_job
odoo_13 | now = fields.Datetime.context_timestamp(cron, datetime.now())
odoo_13 | File "/usr/lib/python3/dist-packages/odoo/fields.py", line 1776, in context_timestamp
odoo_13 | tz_name = record._context.get('tz') or record.env.user.tz
odoo_13 | File "/usr/lib/python3/dist-packages/odoo/fields.py", line 1063, in __get__
odoo_13 | self.compute_value(recs)
odoo_13 | File "/usr/lib/python3/dist-packages/odoo/fields.py", line 1144, in compute_value
odoo_13 | records._compute_field_value(self)
odoo_13 | File "/usr/lib/python3/dist-packages/odoo/models.py", line 3827, in _compute_field_value
odoo_13 | field.compute(self)
odoo_13 | File "/usr/lib/python3/dist-packages/odoo/fields.py", line 635, in _compute_related
odoo_13 | record[self.name] = self._process_related(value[self.related_field.name])
odoo_13 | File "/usr/lib/python3/dist-packages/odoo/models.py", line 5454, in __getitem__
odoo_13 | return self._fields[key].__get__(self, type(self))
odoo_13 | File "/usr/lib/python3/dist-packages/odoo/fields.py", line 1046, in __get__
odoo_13 | recs._fetch_field(self)
odoo_13 | File "/usr/lib/python3/dist-packages/odoo/models.py", line 2871, in _fetch_field
odoo_13 | self._read(fnames)
odoo_13 | File "/usr/lib/python3/dist-packages/odoo/models.py", line 2942, in _read
odoo_13 | cr.execute(query_str, params)
odoo_13 | File "/usr/lib/python3/dist-packages/odoo/sql_db.py", line 163, in wrapper
odoo_13 | return f(self, *args, **kwargs)
odoo_13 | File "/usr/lib/python3/dist-packages/odoo/sql_db.py", line 240, in execute
odoo_13 | res = self._obj.execute(query, params)
odoo_13 | psycopg2.errors.UndefinedColumn: column res_partner.distrito does not exist
odoo_13 | LINE 1: ...ontato_id","res_partner"."orgao_id" as "orgao_id","res_partn...
odoo_13 | ^

0
Imagine profil
Abandonează
Imagine profil
Ravi Gadhia
Cel mai bun răspuns

it seems cron(Scheduled Actions) run before the module update has been completed and rollback transaction. 

so disable cron for the time being while module upgrade or upgrade with --max-cron-threads=0 command it will not start any cron thread/process for cron

0
Imagine profil
Abandonează
Imagine profil
Jake Robinson
Cel mai bun răspuns

Does the field exist in Settings -> Technical -> Fields? If so, try:

distrito = fields.Char(string='Bairro', store=True) 

If this field was set to a compute originally, and then the compute was removed, the store=False that is automatically applied by a compute remains even after the compute is gone. This is the main reason I've had this kind of issue before.

Cheers

Jake Robinson

0
Imagine profil
Abandonează
Some ODOO newbie developer
Autor

I've checked both on field and models on settings and wasn't there....

After I restart the server, that error appear and the only way to fix is removing the field on the .py file

Enjoying the discussion? Don't just read, join in!

Create an account today to enjoy exclusive features and engage with our awesome community!

Înscrie-te
Related Posts Răspunsuri Vizualizări Activitate
odoo13 : Database creation error
postgresql Odoo13.0
Imagine profil
0
ian. 20
4377
psycopg2.ProgrammingError: can't adapt type 'dict'
postgresql odoo Odoo13.0
Imagine profil
0
mai 22
2779
Error 503 - After restoring Backup
error postgresql Odoo13.0
Imagine profil
1
aug. 20
6249
Postgresql version for Odoo 13 Rezolvat
postgresql versions Odoo13.0
Imagine profil
Imagine profil
2
aug. 20
18902
How to call a postgres function with odoo-connect
javascript postgresql node Odoo13.0
Imagine profil
0
oct. 20
5109
Comunitate
  • Tutorials
  • Documentație
  • Forum
Open Source
  • Descărcare
  • Github
  • Runbot
  • Translations
Servicii
  • Hosting Odoo.sh
  • Suport
  • Actualizare
  • Custom Developments
  • Educație
  • Găsiți un contabil
  • Găsește un Partener
  • Devino Partener
Despre Noi
  • Compania noastră
  • Active de marcă
  • Contactați-ne
  • Locuri de muncă
  • Evenimente
  • Podcast
  • Blog
  • Clienți
  • Aspecte juridice • Confidențialitate
  • Securitate
الْعَرَبيّة Català 简体中文 繁體中文 (台灣) Čeština Dansk Nederlands English Suomi Français Deutsch हिंदी Bahasa Indonesia Italiano 日本語 한국어 (KR) Lietuvių kalba Język polski Português (BR) română русский язык Slovenský jazyk slovenščina Español (América Latina) Español ภาษาไทย Türkçe українська Tiếng Việt

Odoo este o suită de aplicații de afaceri open source care acoperă toate nevoile companiei dvs.: CRM, comerț electronic, contabilitate, inventar, punct de vânzare, management de proiect etc.

Propunerea de valoare unică a Odoo este să fie în același timp foarte ușor de utilizat și complet integrat.

Website made with

Odoo Experience on YouTube

1. Use the live chat to ask your questions.
2. The operator answers within a few minutes.

Live support on Youtube
Watch now