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

Function field result error record[f] = res2[record['id']] KeyError: 9

S'inscrire

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

Cette question a été signalée
python6.1
5582 Vues
Avatar
klacus

Hi All!

I have this function field:

'copy_to_stock': fields.function(copy_data,method=True,type='boolean',store = False),

I call it in xml by:

 <field name="copy_to_stock" invisible="1"/>

I have this code:

def copy_data(self,cr,uid,ids,y,z,context=None):
    move = self.pool.get('stock.move')      
    product_obj = self.pool.get('product.product')
    result = {} 
    for line in self.browse(cr, uid, ids, context=context):
        result[line.id] = True
        if line.stck_mov_id == 0:
            product_ids = line.pname.id
            products = product_obj.browse(cr, uid, product_ids, context=context)
            prod_name = products.name_template
            now = datetime.datetime.now()
            move_obj_id = move.create(cr,uid,{'product_uom' : line.product_uom.id,
                            'date_expected' : now,
                            'date' : now,
                            'product_qty' : line.product_qty,
                            'location_id' : line.location_id.id,
                            'name' : prod_name,
                            'product_id' : line.pname.id,
                            'company_id' : 1,
                            'location_dest_id': line.location_dest_id.id,
                            'state' : 'done'})  


            if move_obj_id:
                self.write(cr, uid, [line.id], {'stck_mov_id': move_obj_id}, context=context)
            return result

and I have this result:

Traceback (most recent call last):
File "/usr/local/lib/python2.7/dist-packages/openerp-6.1_20121011_233149-py2.7.egg/openerp/osv/osv.py", line 121, in wrapper return f(self, dbname, args, *kwargs) File "/usr/local/lib/python2.7/dist-packages/openerp-6.1_20121011_233149-py2.7.egg/openerp/osv/osv.py", line 176, in execute res = self.execute_cr(cr, uid, obj, method, args, *kw) File "/usr/local/lib/python2.7/dist-packages/openerp-6.1_20121011_233149-py2.7.egg/openerp/osv/osv.py", line 164, in execute_cr return getattr(object, method)(cr, uid, args, *kw) File "/usr/local/lib/python2.7/dist-packages/openerp-6.1_20121011_233149-py2.7.egg/openerp/osv/orm.py", line 3416, in read result = self._read_flat(cr, user, select, fields, context, load) File "/usr/local/lib/python2.7/dist-packages/openerp-6.1_20121011_233149-py2.7.egg/openerp/osv/orm.py", line 3542, in _read_flat record[f] = res2[record['id']] KeyError: 9

I try to do a lot of things, but I do not understand what is the root cause. I try to make a lot of things with the result of the function, but It takes me into deep in the madness....

I do not want the result, I wanna forget it:-) if this is Null or nill is ok for me, sure the system may need it, but w**???? :-)

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é
new python env
python
Avatar
0
mars 25
2490
What means "Too many values to unpack" message? Résolu
python
Avatar
Avatar
Avatar
Avatar
Avatar
4
avr. 24
176176
have no data in screen. read data in my own module from different model
python
Avatar
0
déc. 23
3105
How to insert value to a one2many field in table with create method? Résolu
python
Avatar
Avatar
Avatar
Avatar
Avatar
5
juil. 25
232840
how to disable add product in sales of odoo 12
python
Avatar
Avatar
1
déc. 22
4310
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