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
    • Artificial Intelligence
    • 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

[Solved] Odoo 9 - Importing accounting entry with python code

S'inscrire

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

Cette question a été signalée
2 Réponses
5326 Vues
Avatar
Eric CATTELIN

Hello,

I try to import this files in my account journal entry.

NUMJL;DTOPE;NPIEC;INPIE;MONNAIE_IDENT;COURS;NUMCP;VMTDEB;VMTCRE;
PAY;30042016;0000000001;O.D.;EUR;0;633300;0.1;0;
PAY;30042016;0000000001;O.D.;EUR;0;448600;0;0.1;

For this i use this code :

def _import_data(self, data):
move_obj = self.env['account.move']
 line_obj = self.env['account.move.line']
 move = None
  for row in data:
if move and row['NPIEC'] != move.name:
move.post()
 move = None
move_vals = {}
line_vals = {}
for col in row:
value = row[col]
 if not move:
if col == 'NUMJL':
move_vals['journal_id'] = self._get_record_id(value, 'account.journal')
elif col == 'NUMPIEC':
move_vals['name'] = value
 elif col == 'DTOPE':
move_vals['ref'] = 'PAY-%s%s-01' % (value[4:],value[2:4])
 move_vals['date'] = self._get_date(value)
 if col == 'NUMCP':
line_vals['account_id'] = self._get_record_id(value, 'account.account')
 elif col == 'INPIE':
line_vals['name'] = value
 elif col == 'VMTDEB':
line_vals['debit'] = self._get_amount(value)
 elif col == 'VMTCRE':
line_vals['credit'] = self._get_amount(value)
 if not move:
move = move_obj.create(move_vals)
 line_vals['move_id'] = move.id
 line = line_obj.create(line_vals)
 if move:
 move.post()

But i've this message warning box in odoo :

"Cannot create unbalanced journal entry."

I've try to change my code like this without success

                 elif col == 'VMTDEB':
line_vals['debit'] = self._get_amount(value)
 if value <> 0:
line_vals['balance'] = self._get_amount(value)
 elif col == 'VMTCRE':
line_vals['credit'] = self._get_amount(value)
 if value <> 0:
line_vals['balance'] = self._get_amount(value) * -1

Can you help me please ?


I've finaly found the solution.
For line, we need to inhibit some controll by remplacing this
"line = line_obj.create(line_vals)"
by this
"line =line_obj.with_context(check_move_validity=False).create(line_vals)"


1
Avatar
Ignorer
Avatar
Eric CATTELIN
Auteur Meilleure réponse

Thanks for you help Artem

I use french accounting so that why i've this format for accounting_id. My fonction self._get_record_id(value, 'account.account') helps me to find the right accounting_id with the name of my account.

I change my code and come soon to tell about the result.

0
Avatar
Ignorer
Artem

'if col == 'NUMCP'' I think this does not work because 'col' is not equal 'NUMCP'. So to help I need to know 'data' variable format. Is it a list or dictionary or string or whatever....

Eric CATTELIN
Auteur

I've finaly found the solution.

For line, we need to inhibit some controll by remplacing this

"line = line_obj.create(line_vals)"

by this

"line =line_obj.with_context(check_move_validity=False).create(line_vals)"

Artem

Using such context you create problems in the future. Suppose you will not able to post this entries later.

Avatar
Artem
Meilleure réponse

Field of account_move that are required : state, journal_id, date, name
Fields of account_move_line are required: date,  account_id, journal_id, debit, credit, date_maturity, move_id, name
For multi currency: currency_id, amount_currency
What is 'data' format? I'm not sure that 'if col == 'NUMCP'' works.

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
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