Se rendre au contenu
Odoo Menu
  • Se connecter
  • Essai gratuit
  • Applications
    Finance
    • Comptabilité
    • Facturation
    • Notes de frais
    • Feuilles de calcul (BI)
    • Documents
    • Signature
    Ventes
    • CRM
    • Ventes
    • PdV Boutique
    • PdV Restaurant
    • Abonnements
    • Location
    Sites web
    • Site Web
    • eCommerce
    • Blog
    • Forum
    • Live Chat
    • eLearning
    Chaîne d'approvisionnement
    • Inventaire
    • Fabrication
    • PLM
    • Achats
    • Maintenance
    • Qualité
    Ressources Humaines
    • Employés
    • Recrutement
    • Congés
    • Évaluations
    • Recommandations
    • Parc automobile
    Marketing
    • Marketing Social
    • E-mail Marketing
    • SMS Marketing
    • Événements
    • Marketing Automation
    • Sondages
    Services
    • Projet
    • Feuilles de temps
    • Services sur Site
    • Assistance
    • Planification
    • Rendez-vous
    Productivité
    • Discussion
    • Validations
    • Internet des Objets
    • VoIP
    • Connaissances
    • WhatsApp
    Applications tierces Odoo Studio Plateforme Cloud d'Odoo
  • Industries
    Commerce de détail
    • Librairie
    • Magasin de vêtements
    • Magasin de meubles
    • Épicerie
    • Quincaillerie
    • Magasin de jouets
    Restauration & Hôtellerie
    • Bar et Pub
    • Restaurant
    • Fast-food
    • Maison d’hôtes
    • Distributeur de boissons
    • Hôtel
    Immobilier
    • Agence immobilière
    • Cabinet d'architecture
    • Construction
    • Gestion immobilière
    • Jardinage
    • Association de copropriétaires
    Consultance
    • Cabinet d'expertise comptable
    • Partenaire Odoo
    • Agence Marketing
    • Cabinet d'avocats
    • Aquisition de talents
    • Audit & Certification
    Fabrication
    • Textile
    • Métal
    • Meubles
    • Alimentation
    • Brasserie
    • Cadeaux d'entreprise
    Santé & Fitness
    • Club de sports
    • Opticien
    • Salle de fitness
    • Praticiens bien-être
    • Pharmacie
    • Salon de coiffure
    Commerce
    • Bricoleur
    • Matériel informatique & support
    • Systèmes photovoltaïques
    • Cordonnier
    • Services de nettoyage
    • Services CVC
    Autres
    • Organisation à but non lucratif
    • Agence environnementale
    • Location de panneaux d'affichage
    • Photographie
    • Leasing de vélos
    • Revendeur de logiciel
    Parcourir toutes les industries
  • Communauté
    Apprenez
    • Tutoriels
    • Documentation
    • Certifications
    • Formation
    • Blog
    • Podcast
    Renforcer l'éducation
    • Programme éducatif
    • Business Game Scale-Up!
    • Rendez-nous visite
    Obtenir le logiciel
    • Téléchargement
    • Comparez les éditions
    • Versions
    Collaborer
    • Github
    • Forum
    • Événements
    • Traductions
    • Devenez partenaire
    • Services pour partenaires
    • Enregistrer votre cabinet comptable
    Nos Services
    • Trouver un partenaire
    • Trouver un comptable
    • Rencontrer un conseiller
    • Services de mise en œuvre
    • Références clients
    • Assistance
    • Mises à niveau
    Github Youtube Twitter Linkedin Instagram Facebook Spotify
    +1 (650) 691-3277
    Obtenir une démonstration
  • Tarification
  • Aide

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

  • CRM
  • e-Commerce
  • Comptabilité
  • Inventaire
  • PoS
  • Projet
  • MRP
All apps
Vous devez être inscrit pour interagir avec la communauté.
Toutes les publications Personnes Badges
Étiquettes (Voir toutl)
odoo accounting v14 pos v15
À propos de ce forum
Vous devez être inscrit pour interagir avec la communauté.
Toutes les publications Personnes Badges
Étiquettes (Voir toutl)
odoo accounting v14 pos v15
À propos de ce forum
Aide

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

S'inscrire

Recevez une notification lorsqu'il y a de l'activité sur ce poste

Cette question a été signalée
many2one odoo openerp
1 Répondre
16879 Vues
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
Ignorer
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
Auteur

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
Meilleure réponse

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
Ignorer
Vous appréciez la discussion ? Ne vous contentez pas de lire, rejoignez-nous !

Créez un compte dès aujourd'hui pour profiter de fonctionnalités exclusives et échanger avec notre formidable communauté !

S'inscrire
Publications associées Réponses Vues Activité
Update computed field value to Many2one field of another model
relational many2one odoo openerp Odoo13.0
Avatar
Avatar
1
août 24
6247
Odoo10: Dynamic domain Résolu
domain domain_filter many2one odoo openerp odoo10
Avatar
Avatar
Avatar
Avatar
3
mai 24
18865
I can't see the value of field Many2one odoo 9 Résolu
many2one field many2one odoo openerp odoo9
Avatar
Avatar
3
juil. 17
4505
Need price from related quality item for further calculations
one2many selecting odoo8.0 many2one odoo openerp
Avatar
2
mars 16
3815
How to show a column on tree Résolu
treeview foreign noob columns many2one odoo openerp
Avatar
Avatar
2
mars 15
6375
Communauté
  • Tutoriels
  • Documentation
  • Forum
Open Source
  • Téléchargement
  • Github
  • Runbot
  • Traductions
Services
  • Hébergement Odoo.sh
  • Assistance
  • Migration
  • Développements personnalisés
  • Éducation
  • Trouver un comptable
  • Trouver un partenaire
  • Devenez partenaire
À propos
  • Notre société
  • Actifs de la marque
  • Contactez-nous
  • Emplois
  • Événements
  • Podcast
  • Blog
  • Clients
  • Informations légales • Confidentialité
  • Sécurité.
الْعَرَبيّة 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 est une suite d'applications open source couvrant tous les besoins de votre entreprise : CRM, eCommerce, Comptabilité, Inventaire, Point de Vente, Gestion de Projet, etc.

Le positionnement unique d'Odoo est d'être à la fois très facile à utiliser et totalement intégré.

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