Skip ke Konten
Odoo Menu
  • Login
  • Uji coba gratis
  • Aplikasi
    Keuangan
    • Akuntansi
    • Faktur
    • Pengeluaran
    • Spreadsheet (BI)
    • Dokumen
    • Tanda Tangan
    Sales
    • CRM
    • Sales
    • POS Toko
    • POS Restoran
    • Langganan
    • Rental
    Website
    • Website Builder
    • eCommerce
    • Blog
    • Forum
    • Live Chat
    • eLearning
    Rantai Pasokan
    • Inventaris
    • Manufaktur
    • PLM
    • Purchase
    • Maintenance
    • Kualitas
    Sumber Daya Manusia
    • Karyawan
    • Rekrutmen
    • Cuti
    • Appraisal
    • Referensi
    • Armada
    Marketing
    • Social Marketing
    • Email Marketing
    • SMS Marketing
    • Acara
    • Otomatisasi Marketing
    • Survei
    Layanan
    • Project
    • Timesheet
    • Layanan Lapangan
    • Meja Bantuan
    • Planning
    • Appointment
    Produktivitas
    • Diskusi
    • Approval
    • IoT
    • VoIP
    • Pengetahuan
    • WhatsApp
    Aplikasi pihak ketiga Odoo Studio Platform Odoo Cloud
  • Industri-Industri
    Retail
    • Toko Buku
    • Toko Baju
    • Toko Furnitur
    • Toko Kelontong
    • Toko Hardware
    • Toko Mainan
    Makanan & Hospitality
    • Bar dan Pub
    • Restoran
    • Fast Food
    • Rumah Tamu
    • Distributor Minuman
    • Hotel
    Real Estate
    • Agensi Real Estate
    • Firma Arsitektur
    • Konstruksi
    • Estate Management
    • Perkebunan
    • Asosiasi Pemilik Properti
    Konsultansi
    • Firma Akuntansi
    • Mitra Odoo
    • Agensi Marketing
    • Firma huku
    • Talent Acquisition
    • Audit & Sertifikasi
    Manufaktur
    • Tekstil
    • Logam
    • Perabotan
    • Makanan
    • Brewery
    • Corporate Gift
    Kesehatan & Fitness
    • Sports Club
    • Toko Kacamata
    • Fitness Center
    • Wellness Practitioners
    • Farmasi
    • Salon Rambut
    Perdagangan
    • Handyman
    • IT Hardware & Support
    • Sistem-Sistem Energi Surya
    • Pembuat Sepatu
    • Cleaning Service
    • Layanan HVAC
    Lainnya
    • Organisasi Nirlaba
    • Agen Lingkungan
    • Rental Billboard
    • Fotografi
    • Penyewaan Sepeda
    • Reseller Software
    Browse semua Industri
  • Komunitas
    Belajar
    • Tutorial-tutorial
    • Dokumentasi
    • Sertifikasi
    • Pelatihan
    • Blog
    • Podcast
    Empower Education
    • Program Edukasi
    • Game Bisnis 'Scale Up!'
    • Kunjungi Odoo
    Dapatkan Softwarenya
    • Download
    • Bandingkan Edisi
    • Daftar Rilis
    Kolaborasi
    • Github
    • Forum
    • Acara
    • Terjemahan
    • Menjadi Partner
    • Layanan untuk Partner
    • Daftarkan perusahaan Akuntansi Anda.
    Dapatkan Layanan
    • Temukan Mitra
    • Temukan Akuntan
    • Temui penasihat
    • Layanan Implementasi
    • Referensi Pelanggan
    • Bantuan
    • Upgrades
    Github Youtube Twitter Linkedin Instagram Facebook Spotify
    +1 (650) 691-3277
    Dapatkan demo
  • Harga
  • Bantuan

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

  • CRM
  • e-Commerce
  • Akuntansi
  • Inventaris
  • PoS
  • Project
  • MRP
All apps
Anda harus terdaftar untuk dapat berinteraksi di komunitas.
Semua Post Orang Lencana-Lencana
Label (Lihat semua)
odoo accounting v14 pos v15
Mengenai forum ini
Anda harus terdaftar untuk dapat berinteraksi di komunitas.
Semua Post Orang Lencana-Lencana
Label (Lihat semua)
odoo accounting v14 pos v15
Mengenai forum ini
Help

odoo 8: How to get list of languages in module WebClient class

Langganan

Dapatkan notifikasi saat terdapat aktivitas pada post ini

Pertanyaan ini telah diberikan tanda
webclientmodulesodooodooV8Languages
2 Replies
5967 Tampilan
Avatar
Morteza

I've installed a module that should works with translations defined in the odoo 8. But when i checked the path, there is no defined directories. 

class WebClient(openerpweb.Controller):
    @http.route('/web/webclient/translations', type='json', auth="none")
    def translations(self, mods=None, lang=None):


In the /web/ directory only i18n directory exists and only contains .po files. because i'm new in odoo i think it is not correct in the module. so how i could change this request and fix the problem?


The full source code:

from openerp.osv import osv,fields

from openerp.addons.web import http

import os, platform

from datetime import datetime

openerpweb = http

import werkzeug.local

import itertools


_request_stack = werkzeug.local.LocalStack()

request = _request_stack()

import openerp


class res_users(osv.osv):

    _inherit="res.users"

    _columns={                

              'context_jcalendar': fields.boolean('Jalali Calendar?', help="Using persian numbers and jalali calendar throughout views.")

             }

    _defaults = {

        'context_jcalendar': True,

 }


class WebClient(openerpweb.Controller):

    @http.route('/web/webclient/translations', type='json', auth="none")

    def translations(self, mods=None, lang=None):

        request.disable_db = False

        uid = openerp.SUPERUSER_ID

        if mods is None:

            m = request.registry.get('ir.module.module')

            mods = [x['name'] for x in m.search_read(request.cr, uid,

                [('state','=','installed')], ['name'])]

        if lang is None:

            lang = request.context["lang"]

        res_lang = request.registry.get('res.lang')

        ids = res_lang.search(request.cr, uid, [("code", "=", lang)])

        lang_params = None

        if ids:

            lang_params = res_lang.read(request.cr, uid, ids[0], ["direction", "date_format", "time_format",

                                                "grouping", "decimal_point", "thousands_sep"])

            user_context = request.session.get_context() if request.session._uid else {}

            jcalendar = user_context.get('jcalendar',True)

                

            lang_params.update({'jcalendar': jcalendar,})

            if jcalendar == True:

                lang_params.update({"grouping" : '[3,0]',

                                    "decimal_point":u'.',

                                    "thousands_sep":u'‚',

                                    "direction":u'rtl'})

            

        # Regional languages (ll_CC) must inherit/override their parent lang (ll), but this is

        # done server-side when the language is loaded, so we only need to load the user's lang.

        ir_translation = request.registry.get('ir.translation')

        translations_per_module = {}

        messages = ir_translation.search_read(request.cr, uid, [('module','in',mods),('lang','=',lang),

                                               ('comments','like','openerp-web'),('value','!=',False),

                                               ('value','!=','')],

                                              ['module','src','value','lang'], order='module')

        for mod, msg_group in itertools.groupby(messages, key=operator.itemgetter('module')):

            translations_per_module.setdefault(mod,{'messages':[]})

            translations_per_module[mod]['messages'].extend({'id': m['src'],

                                                             'string': m['value']} \

                                                                for m in msg_group)

        return {"modules": translations_per_module,

                "lang_parameters": lang_params}

   


0
Avatar
Buang
Avatar
Denis Baranov
Jawaban Terbai

The controller path is not a path on the server: it is just a json request to use.

What are you trying to achieve? Would you like to get the list of languages? If so, you may just search them as self.env['res.lang'].search([]). Have also look at base_update_translations in the base module

0
Avatar
Buang
Menikmati diskusi? Jangan hanya membaca, ikuti!

Buat akun sekarang untuk menikmati fitur eksklufi dan agar terlibat dengan komunitas kami!

Daftar
Post Terkait Replies Tampilan Aktivitas
Update Module List odoo Diselesaikan
modules terminal odoo odooV8 modulelist
Avatar
Avatar
1
Des 15
13926
cannot install any module into odoo8!!! <<OpenERP Server Error>>
installation modules error odoo odooV8
Avatar
Avatar
2
Mar 15
6140
Module Install Error! Diselesaikan
modules odooV8
Avatar
Avatar
1
Des 22
7055
Add a button to a ValidationError
odoo odooV8
Avatar
Avatar
1
Nov 22
4317
How to get values of one record of a many2many relation displayed in a tree view when clicking on a button
odoo odooV8
Avatar
0
Jun 21
6843
Komunitas
  • Tutorial-tutorial
  • Dokumentasi
  • Forum
Open Source
  • Download
  • Github
  • Runbot
  • Terjemahan
Layanan
  • Odoo.sh Hosting
  • Bantuan
  • Peningkatan
  • Custom Development
  • Pendidikan
  • Temukan Akuntan
  • Temukan Mitra
  • Menjadi Partner
Tentang Kami
  • Perusahaan kami
  • Aset Merek
  • Hubungi kami
  • Tugas
  • Acara
  • Podcast
  • Blog
  • Pelanggan
  • Hukum • Privasi
  • Keamanan
الْعَرَبيّة 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 adalah rangkaian aplikasi bisnis open source yang mencakup semua kebutuhan perusahaan Anda: CRM, eCommerce, akuntansi, inventaris, point of sale, manajemen project, dan seterusnya.

Mudah digunakan dan terintegrasi penuh pada saat yang sama adalah value proposition unik Odoo.

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