Ir al contenido
Odoo Menú
  • Iniciar sesión
  • Pruébalo gratis
  • Aplicaciones
    Finanzas
    • Contabilidad
    • Facturación
    • Gastos
    • Hoja de cálculo (BI)
    • Documentos
    • Firma electrónica
    Ventas
    • CRM
    • Ventas
    • PdV para tiendas
    • PdV para restaurantes
    • Suscripciones
    • Alquiler
    Sitios web
    • Creador de sitios web
    • Comercio electrónico
    • Blog
    • Foro
    • Chat en vivo
    • eLearning
    Cadena de suministro
    • Inventario
    • Manufactura
    • PLM
    • Compras
    • Mantenimiento
    • Calidad
    Recursos humanos
    • Empleados
    • Reclutamiento
    • Vacaciones
    • Evaluaciones
    • Referencias
    • Flotilla
    Marketing
    • Redes sociales
    • Marketing por correo
    • Marketing por SMS
    • Eventos
    • Automatización de marketing
    • Encuestas
    Servicios
    • Proyectos
    • Registro de horas
    • Servicio externo
    • Soporte al cliente
    • Planeación
    • Citas
    Productividad
    • Conversaciones
    • Aprobaciones
    • IoT
    • VoIP
    • Artículos
    • WhatsApp
    Aplicaciones externas Studio de Odoo Plataforma de Odoo en la nube
  • Industrias
    Venta minorista
    • Librería
    • Tienda de ropa
    • Mueblería
    • Tienda de abarrotes
    • Ferretería
    • Juguetería
    Alimentos y hospitalidad
    • Bar y pub
    • Restaurante
    • Comida rápida
    • Casa de huéspedes
    • Distribuidora de bebidas
    • Hotel
    Bienes inmuebles
    • Agencia inmobiliaria
    • Estudio de arquitectura
    • Construcción
    • Gestión de bienes inmuebles
    • Jardinería
    • Asociación de propietarios
    Consultoría
    • Firma contable
    • Partner de Odoo
    • Agencia de marketing
    • Bufete de abogados
    • Adquisición de talentos
    • Auditorías y certificaciones
    Manufactura
    • Textil
    • Metal
    • Muebles
    • Comida
    • Cervecería
    • Regalos corporativos
    Salud y ejercicio
    • Club deportivo
    • Óptica
    • Gimnasio
    • Especialistas en bienestar
    • Farmacia
    • Peluquería
    Trades
    • Personal de mantenimiento
    • Hardware y soporte de TI
    • Sistemas de energía solar
    • Zapateros y fabricantes de calzado
    • Servicios de limpieza
    • Servicios de calefacción, ventilación y aire acondicionado
    Otros
    • Organización sin fines de lucro
    • Agencia para la protección del medio ambiente
    • Alquiler de anuncios publicitarios
    • Fotografía
    • Alquiler de bicicletas
    • Distribuidor de software
    Descubre todas las industrias
  • Odoo Community
    Aprende
    • Tutoriales
    • Documentación
    • Certificaciones
    • Capacitación
    • Blog
    • Podcast
    Fortalece la educación
    • Programa educativo
    • Scale Up! El juego empresarial
    • Visita Odoo
    Obtén el software
    • Descargar
    • Compara ediciones
    • Versiones
    Colabora
    • GitHub
    • Foro
    • Eventos
    • Traducciones
    • Conviértete en partner
    • Servicios para partners
    • Registra tu firma contable
    Obtén servicios
    • Encuentra un partner
    • Encuentra un contador
    • Contacta a un consultor
    • Servicios de implementación
    • Referencias de clientes
    • Soporte
    • Actualizaciones
    GitHub YouTube Twitter LinkedIn Instagram Facebook Spotify
    +1 (650) 691-3277
    Solicita una demostración
  • Precios
  • Ayuda

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

  • CRM
  • e-Commerce
  • Contabilidad
  • Inventario
  • PoS
  • Proyectos
  • MRP
All apps
Debe estar registrado para interactuar con la comunidad.
Todas las publicaciones Personas Insignias
Etiquetas (Ver todo)
odoo accounting v14 pos v15
Acerca de este foro
Debe estar registrado para interactuar con la comunidad.
Todas las publicaciones Personas Insignias
Etiquetas (Ver todo)
odoo accounting v14 pos v15
Acerca de este foro
Ayuda

Error On Saving : ProgrammingError: can't adapt type 'dict'

Suscribirse

Reciba una notificación cuando haya actividad en esta publicación

Se marcó esta pregunta
many2one odoo openerp
1 Responder
16848 Vistas
Avatar
MoayadRayyan

Greetingz,

after i have added many2one field , once i tried to save i got this error : ProgrammingError: can't adapt type 'dict'

File "/opt/odoo/odoo-server/openerp/sql_db.py", line 158, in wrapper return f(self, *args, **kwargs) File "/opt/odoo/odoo-server/openerp/sql_db.py", line 234, in execute res = self._obj.execute(query, params) ProgrammingError: can't adapt type 'dict'

check my code bellow :

PYTHON FILE

from openerp.osv import fields, osv

class product_rolls(osv.osv):
      _name = 'product.template'
      _inherit = "product.template"

      _columns = {
        'product_rolls_id': fields.char('Product Pices'),
    'product_rolls_rolls':fields.many2one('new.roll','roll_id'),
      }

      _defaults ={
        'product_rolls_id': 10
      }
product_rolls()


class new_roll(osv.osv):
   _name='new.roll'
   _columns={
       'roll_id':fields.integer("ID"),
           'roll':fields.char('Roll'),
           'size':fields.char("Size"),
           }
new_roll()

XML FILE :

<?xml version="1.0" encoding="utf-8"?>
    <openerp>
    <data>
    <record model="ir.ui.view" id="product_rolls_product_product">
        <field name="name">product.template.stock.property.form.inherit</field>
        <field name="model">product.template</field>
        <field name="inherit_id" ref="stock.view_template_property_form" />
        <field name="arch" type="xml">
        <xpath expr="//field[@name='qty_available']" position="after">
        <newline/>
        <label for="product_rolls_id" />
            
            <field name="product_rolls_id" on_change="onchange_product_rolls_id(product_rolls_id)" />
            <field name="product_rolls_rolls" widget="one2many_list" colspan="4" nolabel="1">
                <tree editable='bottom'>
                <field name="roll"/>  
                <field name="size"/>                           
                </tree>
                <form>
                <field name="roll"/>
                <field name="size"/>
                </form>
            </field>
        </xpath>
        </field>
    </record>
        </data>
    </openerp>

note : before adding the many2one tree it was working perfectly .

 

Regards

1
Avatar
Descartar
Emipro Technologies Pvt. Ltd.

@moayad your field 'product_rolls_rolls' is a 'many2one' field and in 'xml' file you are trying to treat it as one2many field. I am not getting it why? This kind of widgets are used one2many fields not for many2one field. Also another thing, although this thing is not affecting your code but I can see is that you are trying to add "ID" field in the "new_roll" table, because Openerp automatically adds ID field in the table.

MoayadRayyan
Autor

Ok , i make it one2many and i removed ID field , now there is no errors but no value saved ! Regrads

Emipro Technologies Pvt. Ltd.

@moayad if possible please share your code with latest changes that you have made, which will give better idea to solve the issue.

Avatar
sameer alhwety
Mejor respuesta

Try this :

class product_rolls(osv.osv):
      _name = 'product.rolls'
      _inherit = "product.template"

      _columns = {
        'product_rolls': fields.char('Product Pices'),
    'product_rolls_id':fields.many2one('new.roll','Product Roll'),
      }

      _defaults ={
        'product_rolls': 10
      }
product_rolls()


class new_roll(osv.osv):
   _name='new.roll'
   _columns={
       'roll_id':fields.one2many('product.rolls','product_rolls_id','Column Name'),
           'roll':fields.char('Roll'),
           'size':fields.char("Size"),
           }
new_roll()

0
Avatar
Descartar
¿Le interesa esta conversación? ¡Participe en ella!

Cree una cuenta para poder utilizar funciones exclusivas e interactuar con la comunidad.

Registrarse
Publicaciones relacionadas Respuestas Vistas Actividad
Update computed field value to Many2one field of another model
relational many2one odoo openerp Odoo13.0
Avatar
Avatar
1
ago 24
6225
Odoo10: Dynamic domain Resuelto
domain domain_filter many2one odoo openerp odoo10
Avatar
Avatar
Avatar
Avatar
3
may 24
18861
I can't see the value of field Many2one odoo 9 Resuelto
many2one field many2one odoo openerp odoo9
Avatar
Avatar
3
jul 17
4496
Need price from related quality item for further calculations
one2many selecting odoo8.0 many2one odoo openerp
Avatar
2
mar 16
3810
How to show a column on tree Resuelto
treeview foreign noob columns many2one odoo openerp
Avatar
Avatar
2
mar 15
6362
Comunidad
  • Tutoriales
  • Documentación
  • Foro
Código abierto
  • Descargar
  • GitHub
  • Runbot
  • Traducciones
Servicios
  • Alojamiento en Odoo.sh
  • Soporte
  • Actualizaciones del software
  • Desarrollos personalizados
  • Educación
  • Encuentra un contador
  • Encuentra un partner
  • Conviértete en partner
Sobre nosotros
  • Nuestra empresa
  • Activos de marca
  • Contáctanos
  • Empleos
  • Eventos
  • Podcast
  • Blog
  • Clientes
  • Legal • Privacidad
  • Seguridad
الْعَرَبيّة 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 es un conjunto de aplicaciones de código abierto que cubren todas las necesidades de tu empresa: CRM, comercio electrónico, contabilidad, inventario, punto de venta, gestión de proyectos, etc.

La propuesta única de valor de Odoo es ser muy fácil de usar y estar totalmente integrado.

Sitio web hecho con

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