Skip to Content
Odoo Menú
  • Registra entrada
  • Prova-ho gratis
  • Aplicacions
    Finances
    • Comptabilitat
    • Facturació
    • Despeses
    • Full de càlcul (IA)
    • Documents
    • Signatura
    Vendes
    • CRM
    • Vendes
    • Punt de venda per a botigues
    • Punt de venda per a restaurants
    • Subscripcions
    • Lloguer
    Imatges de llocs web
    • Creació de llocs web
    • Comerç electrònic
    • Blog
    • Fòrum
    • Xat en directe
    • Aprenentatge en línia
    Cadena de subministrament
    • Inventari
    • Fabricació
    • PLM
    • Compres
    • Manteniment
    • Qualitat
    Recursos humans
    • Empleats
    • Reclutament
    • Absències
    • Avaluacions
    • Recomanacions
    • Flota
    Màrqueting
    • Màrqueting Social
    • Màrqueting per correu electrònic
    • Màrqueting per SMS
    • Esdeveniments
    • Automatització del màrqueting
    • Enquestes
    Serveis
    • Projectes
    • Fulls d'hores
    • Servei de camp
    • Suport
    • Planificació
    • Cites
    Productivitat
    • Converses
    • Validacions
    • IoT
    • VoIP
    • Coneixements
    • WhatsApp
    Aplicacions de tercers Odoo Studio Plataforma d'Odoo al núvol
  • Sectors
    Comerç al detall
    • Llibreria
    • Botiga de roba
    • Botiga de mobles
    • Botiga d'ultramarins
    • Ferreteria
    • Botiga de joguines
    Food & Hospitality
    • Bar i pub
    • Restaurant
    • Menjar ràpid
    • Guest House
    • Distribuïdor de begudes
    • Hotel
    Immobiliari
    • Agència immobiliària
    • Estudi d'arquitectura
    • Construcció
    • Gestió immobiliària
    • Jardineria
    • Associació de propietaris de béns immobles
    Consultoria
    • Empresa comptable
    • Partner d'Odoo
    • Agència de màrqueting
    • Bufet d'advocats
    • Captació de talent
    • Auditoria i certificació
    Fabricació
    • Textile
    • Metal
    • Mobles
    • Menjar
    • Brewery
    • Regals corporatius
    Salut i fitness
    • Club d'esport
    • Òptica
    • Centre de fitness
    • Especialistes en benestar
    • Farmàcia
    • Perruqueria
    Trades
    • Servei de manteniment
    • Hardware i suport informàtic
    • Sistemes d'energia solar
    • Shoe Maker
    • Serveis de neteja
    • Instal·lacions HVAC
    Altres
    • Nonprofit Organization
    • Agència del medi ambient
    • Lloguer de panells publicitaris
    • Fotografia
    • Lloguer de bicicletes
    • Distribuïdors de programari
    Browse all Industries
  • Comunitat
    Aprèn
    • Tutorials
    • Documentació
    • Certificacions
    • Formació
    • Blog
    • Pòdcast
    Potenciar l'educació
    • Programa educatiu
    • Scale-Up! El joc empresarial
    • Visita Odoo
    Obtindre el programari
    • Descarregar
    • Comparar edicions
    • Novetats de les versions
    Col·laborar
    • GitHub
    • Fòrum
    • Esdeveniments
    • Traduccions
    • Converteix-te en partner
    • Services for Partners
    • Registra la teva empresa comptable
    Obtindre els serveis
    • Troba un partner
    • Troba un comptable
    • Contacta amb un expert
    • Serveis d'implementació
    • Referències del client
    • Suport
    • Actualitzacions
    Github Youtube Twitter Linkedin Instagram Facebook Spotify
    +1 (650) 691-3277
    Programar una demo
  • Preus
  • Ajuda

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

  • CRM
  • e-Commerce
  • Comptabilitat
  • Inventari
  • PoS
  • Projectes
  • MRP
All apps
You need to be registered to interact with the community.
All Posts People Badges
Etiquetes (View all)
odoo accounting v14 pos v15
About this forum
You need to be registered to interact with the community.
All Posts People Badges
Etiquetes (View all)
odoo accounting v14 pos v15
About this forum
Ajuda

Regarding one2many field

Subscriure's

Get notified when there's activity on this post

This question has been flagged
errorone2manylistunhashable
2 Respostes
7396 Vistes
Avatar
Krishna

I was trying to add a one2many field..but its giving the following error.

Server Traceback (most recent call last):
 File "C:\Program Files\OpenERP 7.0-20130627-231102\Server\server\openerp\addons\web\session.py", line 89, in send
 File "C:\Program Files\OpenERP 7.0-20130627-231102\Server\server\.\openerp\netsvc.py", line 292, in dispatch_rpc
 File "C:\Program Files\OpenERP 7.0-20130627-231102\Server\server\.\openerp\service\web_services.py", line 626, in dispatch
 File "C:\Program Files\OpenERP 7.0-20130627-231102\Server\server\.\openerp\osv\osv.py", line 188, in execute_kw
 File "C:\Program Files\OpenERP 7.0-20130627-231102\Server\server\.\openerp\osv\osv.py", line 131, in wrapper
 File "C:\Program Files\OpenERP 7.0-20130627-231102\Server\server\.\openerp\osv\osv.py", line 197, in execute
 File "C:\Program Files\OpenERP 7.0-20130627-231102\Server\server\.\openerp\osv\osv.py", line 185, in execute_cr
 File "C:\Program Files\OpenERP 7.0-20130627-231102\Server\server\.\openerp\osv\orm.py", line 3604, in read
 File "C:\Program Files\OpenERP 7.0-20130627-231102\Server\server\.\openerp\osv\orm.py", line 3724, in _read_flat
 File "C:\Program Files\OpenERP 7.0-20130627-231102\Server\server\.\openerp\osv\fields.py", line 538, in get
TypeError: unhashable type: 'list'

any idea??? Please answer..

0
Avatar
Descartar
Qutechs, Ahmed M.Elmubarak

hello, can you put some lines of the code ...

Qutechs, Ahmed M.Elmubarak

is the sale.order model inherited or customized, if customized, if it contains m2o field called 'order_line' from 'hotel.sale.line'?

Krishna
Autor

yaah..I have added m2o field in sale.order model

Krishna
Autor

code is....'order_line': fields.one2many('sale.order.line', 'order_id', 'Order Lines', readonly=True, states={'draft': [('readonly', False)], 'sent': [('readonly', False)]}), 'sale_line':fields.many2one('hotel.sale.line','order_lines'),

Avatar
Krishna
Autor Best Answer

in .py file

class hotel_sale_line(osv.osv):
    _name = 'hotel.sale.line'
    _description = "Sale Line"
    _columns ={          
       'folio_id':fields.many2one('hotel.folio'),
        'order_lines':fields.one2many('sale.order','order_line','Sales Order'),
}

and in .xml file---

<separator string="Sale Order Lines" colspan="4"/> 
<field name="sale_lines" colspan="4" nolabel="1"> 
<form string="Sales Order">
 <separator string="Sales Order"/>
 <field name="order_lines" select="1" colspan="4" nolabel="1"/>
 </form> <tree string="Sales Order Lines" editable="bottom"> 
 <field name="order_lines"/>
 </tree>
 </field>
0
Avatar
Descartar
Simplify it!

I am not sure what you want to do, but all the concept is wrong. If you are inheriting the sales.order then you don't have to create another model, you have to add some fields to sale.order. If you are creating a new model then you can't have the order.lines because sale.order is already using that. If you want to add sale.order to your model you have to have 2 fields that relate them. a many2one and one2many, then its going to work

Krishna
Autor

I am new to openerp. So, Please can you post one example for that.Thanks for your help.

Qutechs, Ahmed M.Elmubarak

@Krishna please check this like https://doc.openerp.com/v6.0/developer/2_5_Objects_Fields_Methods/field_type.html/ for one2many field, and as @Grover said please tell us what do you aim to do, is it your own customized module , or you want to inherit the sale module

Krishna
Autor

ok..i want to add the sale order line in my custom module then what should I have to do for that?

Krishna
Autor

using my code..i can see the sale order form from sales module..everything is working fine..but when i confirm my whole form then it gives error of such type.that i have shown you..So where is problem i can't undestand???

Abhishek H Menon

Please don't put direct link to the existing models in openerp, it is a bad practise. Instead of that inherit an existing class here it is sale.order, and add your required fields you want to display additionally and along with that, give a many2one id inorder to create an inverse relationship with the former model that is here it is hotel.sale.line. then onlye you can create a one2many relationship. But at first you have to define the inherited hotel.sale.line after that define sale.order in your custom module, Thanks

Avatar
Abhishek H Menon
Best Answer
from osv import fields,osv
    class hotel_sale_line(osv.osv):
        _name='hotel.sale.line'
        _description='Hotel Sale'
        _columns= {
             'folio_id':fields.many2one('hotel.folio'),
             'order_lines':fields.one2many('sale.order','order_line','Sales Order'),
             }
    hotel_sale_line()

    class sale_order(osv.osv):
        _inherit='sale.order'
        _columns={
            'order_line': fields.many2one('hotel.sale.line','Order')
            }   
    sale_order()
0
Avatar
Descartar
Enjoying the discussion? Don't just read, join in!

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

Registrar-se
Related Posts Respostes Vistes Activitat
TypeError: unhashable type: 'list' | Odoo 9
error list unhashable v9
Avatar
Avatar
2
de juny 21
4513
One2Many field not records more than one value
error one2many
Avatar
0
de des. 17
4747
unhashable type: 'list' -many2many
list many2many unhashable
Avatar
1
de des. 17
6974
Odoo15 error with one2many field write method
error one2many writeMethod v15
Avatar
Avatar
1
d’abr. 23
3070
How append the values in one2many field in odoo10? Solved
one2many list dictionary odoo10
Avatar
Avatar
2
de nov. 21
33874
Community
  • Tutorials
  • Documentació
  • Fòrum
Codi obert
  • Descarregar
  • GitHub
  • Runbot
  • Traduccions
Serveis
  • Allotjament a Odoo.sh
  • Suport
  • Actualització
  • Desenvolupaments personalitzats
  • Educació
  • Troba un comptable
  • Troba un partner
  • Converteix-te en partner
Sobre nosaltres
  • La nostra empresa
  • Actius de marca
  • Contacta amb nosaltres
  • Llocs de treball
  • Esdeveniments
  • Pòdcast
  • Blog
  • Clients
  • Informació legal • Privacitat
  • Seguretat
الْعَرَبيّة 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 és un conjunt d'aplicacions empresarials de codi obert que cobreix totes les necessitats de la teva empresa: CRM, comerç electrònic, comptabilitat, inventari, punt de venda, gestió de projectes, etc.

La proposta única de valor d'Odoo és ser molt fàcil d'utilitzar i estar totalment integrat, ambdues alhora.

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