Skip to Content
Odoo Menu
  • Prihlásiť sa
  • Vyskúšajte zadarmo
  • Aplikácie
    Financie
    • Účtovníctvo
    • Fakturácia
    • Výdavky
    • Tabuľka (BI)
    • Dokumenty
    • Podpis
    Predaj
    • CRM
    • Predaj
    • POS Shop
    • POS Restaurant
    • Manažment odberu
    • Požičovňa
    Webstránky
    • Tvorca webstránok
    • eShop
    • Blog
    • Fórum
    • Živý chat
    • eLearning
    Supply Chain
    • Sklad
    • Výroba
    • Správa životného cyklu produktu
    • Nákup
    • Údržba
    • Manažment kvality
    Ľudské zdroje
    • Zamestnanci
    • Nábor zamestnancov
    • Voľné dni
    • Hodnotenia
    • Odporúčania
    • Vozový park
    Marketing
    • Marketing sociálnych sietí
    • Email marketing
    • SMS marketing
    • Eventy
    • Marketingová automatizácia
    • Prieskumy
    Služby
    • Projektové riadenie
    • Pracovné výkazy
    • Práca v teréne
    • Helpdesk
    • Plánovanie
    • Schôdzky
    Produktivita
    • Tímová komunikácia
    • Schvalovania
    • IoT
    • VoIP
    • Znalosti
    • WhatsApp
    Third party apps Odoo Studio Odoo Cloud Platform
  • Priemyselné odvetvia
    Retail
    • Book Store
    • Clothing Store
    • Furniture Store
    • Grocery Store
    • Hardware Store
    • Toy Store
    Food & Hospitality
    • Bar and Pub
    • Reštaurácia
    • Fast Food
    • Guest House
    • Beverage distributor
    • Hotel
    Reality
    • Real Estate Agency
    • Architecture Firm
    • Konštrukcia
    • Estate Managament
    • Gardening
    • Property Owner Association
    Poradenstvo
    • Accounting Firm
    • Odoo Partner
    • Marketing Agency
    • Law firm
    • Talent Acquisition
    • Audit & Certification
    Výroba
    • Textile
    • Metal
    • Furnitures
    • Jedlo
    • Brewery
    • Corporate Gifts
    Health & Fitness
    • Sports Club
    • Eyewear Store
    • Fitness Center
    • Wellness Practitioners
    • Pharmacy
    • Hair Salon
    Trades
    • Handyman
    • IT Hardware and Support
    • Solar Energy Systems
    • Shoe Maker
    • Cleaning Services
    • HVAC Services
    Iní
    • Nonprofit Organization
    • Environmental Agency
    • Billboard Rental
    • Photography
    • Bike Leasing
    • Software Reseller
    Browse all Industries
  • Komunita
    Vzdelávanie
    • Tutoriály
    • Dokumentácia
    • Certifikácie
    • Školenie
    • Blog
    • Podcast
    Empower Education
    • Vzdelávací program
    • Scale Up! Business Game
    • Visit Odoo
    Softvér
    • Stiahnuť
    • Porovnanie Community a Enterprise vierzie
    • Releases
    Spolupráca
    • Github
    • Fórum
    • Eventy
    • Preklady
    • Staň sa partnerom
    • Services for Partners
    • Register your Accounting Firm
    Služby
    • Nájdite partnera
    • Nájdite účtovníka
    • Meet an advisor
    • Implementation Services
    • Zákaznícke referencie
    • Podpora
    • Upgrades
    ​Github Youtube Twitter Linkedin Instagram Facebook Spotify
    +1 (650) 691-3277
    Získajte demo
  • Cenník
  • Pomoc

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

  • CRM
  • e-Commerce
  • Účtovníctvo
  • Sklady
  • PoS
  • Projektové riadenie
  • MRP
All apps
You need to be registered to interact with the community.
All Posts People Badges
Tagy (View all)
odoo accounting v14 pos v15
About this forum
You need to be registered to interact with the community.
All Posts People Badges
Tagy (View all)
odoo accounting v14 pos v15
About this forum
Pomoc

Custom Code: Automatically install Fiscal localization

Odoberať

Get notified when there's activity on this post

This question has been flagged
accountingfinancelocalizationodoochartofaccounts
2 Replies
2143 Zobrazenia
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
Zrušiť
Junaid Alam
Autor

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

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
Zrušiť
Avatar
Maciej Burzymowski
Best Answer

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
Zrušiť
Enjoying the discussion? Don't just read, join in!

Create an account today to enjoy exclusive features and engage with our awesome community!

Registrácia
Related Posts Replies Zobrazenia Aktivita
Error on Brazilian NFC-e issuance (Odoo online v18)
accounting finance
Avatar
0
okt 25
1175
How to fix The move is not balanced error. Solved
accounting finance
Avatar
Avatar
2
júl 25
1898
Analytic Budget vs Financial Budget
accounting finance
Avatar
Avatar
1
jún 25
1649
How to Skip "In Progress" and Set Payment Directly to "Paid" in Odoo 18? Solved
accounting finance
Avatar
Avatar
Avatar
3
jún 25
4621
Why Does Payment Status Change to "In Process" When Reconciling an Invoice with a Matching Payment?
accounting finance
Avatar
0
sep 25
2481
Komunita
  • Tutoriály
  • Dokumentácia
  • Fórum
Open Source
  • Stiahnuť
  • Github
  • Runbot
  • Preklady
Služby
  • Odoo.sh hosting
  • Podpora
  • Vyššia verzia
  • Custom Developments
  • Vzdelávanie
  • Nájdite účtovníka
  • Nájdite partnera
  • Staň sa partnerom
O nás
  • Naša spoločnosť
  • Majetok značky
  • Kontaktujte nás
  • Pracovné ponuky
  • Eventy
  • Podcast
  • Blog
  • Zákazníci
  • Právne dokumenty • Súkromie
  • Bezpečnosť
الْعَرَبيّة 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 je sada podnikových aplikácií s otvoreným zdrojovým kódom, ktoré pokrývajú všetky potreby vašej spoločnosti: CRM, e-shop, účtovníctvo, skladové hospodárstvo, miesto predaja, projektový manažment atď.

Odoo prináša vysokú pridanú hodnotu v jednoduchom použití a súčasne plne integrovanými biznis aplikáciami.

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