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
    • Intelligence artificielle
    • 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
    • Supermarché
    • 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
    • Homme à tout faire
    • 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
    • Devenir 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
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

Why fields doesn't save auto retrieved data?

S'inscrire

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

Cette question a été signalée
functionfieldson_change7.0
5100 Vues
Avatar
Carlos Llamacho

Hello,

I have a form that takes data with a on_change function an show it when i select an employee but i realize that when i hit the save button and check the record i just created all the data that i acquired with the on_change function is gone... why this might be?

I am putting here my on_change function and the view, thanks in advance.

def onchange_petitioner(self, cr, uid, ids, origin_employee_id, context=None):
        hr_obj = self.pool.get('hr.employee')   
        if origin_employee_id:
            employee = hr_obj.browse(cr, uid, origin_employee_id, context=None)
            return {'value':{'origin_address':employee.company_id.partner_id.street,
                        'origin_department_id':employee.department_id.id,
                        'origin_company_id':employee.company_id.id,
                        'origin_state_id':employee.company_id.partner_id.state_id.id}}
        else:
            return {}

    def onchange_petitionee(self, cr, uid, ids, employee_id, context=None):
        hr_obj = self.pool.get('hr.employee')
        hr_contract_obj = self.pool.get('hr.contract')
        if employee_id:
            emp = hr_obj.browse(cr, uid, employee_id, context=None)
            hr_first_contract = hr_contract_obj.search(cr, uid, [], limit=1, context=None)
            emp_cont = hr_contract_obj.browse(cr, uid, hr_first_contract[0], context=None)
            return {'value':{'actual_employee_code':emp.employee_code,
                        'actual_identifiaction_id':emp.identification_id,
                        'actual_dependency':emp.department_id.id,
                        'actual_ocupation':emp.job_id.id,
                        'actual_salary_scale_category':emp.salary_scale_category,
                        'actual_salary_scale_level':emp.salary_scale_level,
                        'actual_orderly_turn':emp.orderly_turn,
                        'actual_wage':emp_cont.wage
                        }}

View:

<group string="Petitioner">
                                <field name="origin_employee_id" on_change="onchange_petitioner(origin_employee_id, context)"/>
                                <field name="origin_department_id" />
                                <field name="origin_company_id" />
                                <field name="origin_address" />
                                <field name="origin_state_id" />
                            </group>
                            <group string="Petitionee">
                                <field name="employee_id" on_change="onchange_petitionee(employee_id, context)"/>
                                <field name="action_requested"/>
                                <field name="effective_date"/>
                                <field name="actual_employee_code"/>
                                <field name="actual_identification_id"/>
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é
How to set or update fields.function value of existing data ? Résolu
fields 7.0
Avatar
Avatar
Avatar
Avatar
6
déc. 23
32506
TypeError: luong_dc() takes at most 6 arguments (7 given)
function fields
Avatar
Avatar
1
mars 15
5608
ODOO: FIELDS TYPE FUNCTION
function fields odoo
Avatar
0
juil. 16
6930
is there any way to pass values from functional field to a related field????
fields on_change related
Avatar
Avatar
1
oct. 15
5716
separate long name into several field Résolu
function fields field
Avatar
Avatar
1
mars 15
7158
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
  • Devenir 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 Svenska ภาษาไทย 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