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
    Food & Hospitality
    • 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
    • Brewery
    • Cadeaux d'entreprise
    Santé & Fitness
    • Club de sports
    • Opticien
    • Salle de fitness
    • Praticiens bien-être
    • Pharmacie
    • Salon de coiffure
    Trades
    • Bricoleur
    • Matériel informatique et 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
    Browse all 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 for Partners
    • 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

Custom Code: Automatically install Fiscal localization

S'inscrire

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

Cette question a été signalée
accountingfinancelocalizationodoochartofaccounts
2 Réponses
2147 Vues
Avatar
Junaid Alam

I want to automatically install the fiscal localization package to generic chart template, I wrote a code, but that is not working well as It is not installing the journals that we get when we install generic chart template manually,

I'm using model res.config.settings and field chart_template

This is my code

def _install_generic_chart_template(self,company):
try:
# Check if the company already has a chart of accounts installed
if not company.chart_template: # Assuming 'chart_template' is the name of your selection field
# Log available chart templates
available_chart_templates = self.env['res.config.settings'].search([('chart_template', '!=', False)])
_logger.info(f"Available Chart Templates: {available_chart_templates.mapped('chart_template')}")

# Find and install a generic chart of accounts template
chart_template = available_chart_templates and available_chart_templates[0].chart_template
if chart_template:
# Set the chart template for the new company
company.write({'chart_template': chart_template})
# Update res.config.settings with the selected chart template
config_settings = self.env['res.config.settings'].sudo().create({
'company_id': company.id,
'chart_template': chart_template,
})
config_settings.execute()
_logger.info(
f"Updated res.config.settings for company {company.name} with chart template: {chart_template}")

except Exception as e:
_logger.exception(f"Error installing generic chart of accounts for company {company.name}")



So anyone can help me with that?

0
Avatar
Ignorer
Junaid Alam
Auteur

The issue is that, I get message in logger that, Updates res.config.settings, but the default behavior that it installs the journals along with it is not being done.

Avatar
Nicolas Stübi
Meilleure réponse

Hello,


I'm currently using this in one of my projects, it works like a charm:

env["account.chart.template"].try_loading(template_code, company)

I'm simply using one of the following template_code depending on the company:

  • ch
  • fr
  • generic_coa

BR,

Nico

0
Avatar
Ignorer
Avatar
Maciej Burzymowski
Meilleure réponse

In your code, you’re creating a new res.config.settings record for each company and then calling the execute method. This method is responsible for installing the chart template, so if it’s not working as expected, the problem could be here.

You might want to debug this part of your code to see what’s happening. Check if the execute method is being called and if it’s running without errors. Also, verify that the correct chart template is being set on the company and the res.config.settings record.


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é
Error on Brazilian NFC-e issuance (Odoo online v18)
accounting finance
Avatar
0
oct. 25
1176
How to fix The move is not balanced error. Résolu
accounting finance
Avatar
Avatar
2
juil. 25
1900
Analytic Budget vs Financial Budget
accounting finance
Avatar
Avatar
1
juin 25
1652
How to Skip "In Progress" and Set Payment Directly to "Paid" in Odoo 18? Résolu
accounting finance
Avatar
Avatar
Avatar
3
juin 25
4635
Why Does Payment Status Change to "In Process" When Reconciling an Invoice with a Matching Payment?
accounting finance
Avatar
0
sept. 25
2483
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