Zum Inhalt springen
Odoo Menü
  • Anmelden
  • Jetzt gratis testen
  • Apps
    Finanzen
    • Buchhaltung
    • Rechnungsstellung
    • Spesenabrechnung
    • Tabellenkalkulation (BI)
    • Dokumente
    • E-Signatur
    Vertrieb
    • CRM
    • Vertrieb
    • Kassensystem – Shop
    • Kassensystem – Restaurant
    • Abonnements
    • Vermietung
    Websites
    • Website-Builder
    • E-Commerce
    • Blog
    • Forum
    • Livechat
    • E-Learning
    Lieferkette
    • Lager
    • Fertigung
    • PLM
    • Einkauf
    • Wartung
    • Qualität
    Personalwesen
    • Mitarbeiter
    • Personalbeschaffung
    • Abwesenheiten
    • Mitarbeiterbeurteilung
    • Personalempfehlungen
    • Fuhrpark
    Marketing
    • Social Marketing
    • E-Mail-Marketing
    • SMS-Marketing
    • Veranstaltungen
    • Marketing-Automatisierung
    • Umfragen
    Dienstleistungen
    • Projekte
    • Zeiterfassung
    • Außendienst
    • Kundendienst
    • Planung
    • Termine
    Produktivität
    • Dialog
    • Genehmigungen
    • IoT
    • VoIP
    • Wissensdatenbank
    • WhatsApp
    Apps von Drittanbietern Odoo Studio Odoo Cloud-Plattform
  • Branchen
    Einzelhandel
    • Buchladen
    • Kleidergeschäft
    • Möbelhaus
    • Lebensmittelgeschäft
    • Baumarkt
    • Spielwarengeschäft
    Essen & Gastgewerbe
    • Bar und Kneipe
    • Restaurant
    • Fast Food
    • Gästehaus
    • Getränkehändler
    • Hotel
    Immobilien
    • Immobilienagentur
    • Architekturbüro
    • Baugewerbe
    • Immobilienverwaltung
    • Gartenarbeit
    • Eigentümervereinigung
    Beratung
    • Buchhaltungsfirma
    • Odoo-Partner
    • Marketingagentur
    • Anwaltskanzlei
    • Talentakquise
    • Prüfung & Zertifizierung
    Fertigung
    • Textil
    • Metall
    • Möbel
    • Speisen
    • Brauerei
    • Firmengeschenke
    Gesundheit & Fitness
    • Sportklub
    • Brillengeschäft
    • Fitnessstudio
    • Therapeut
    • Apotheke
    • Friseursalon
    Handel
    • Handyman
    • IT-Hardware & -Support
    • Solarenergiesysteme
    • Schuster
    • Reinigungsdienstleistungen
    • HLK-Dienstleistungen
    Sonstiges
    • Gemeinnützige Organisation
    • Umweltschutzagentur
    • Plakatwandvermietung
    • Fotostudio
    • Fahrrad-Leasing
    • Software-Händler
    Alle Branchen ansehen
  • Community
    Lernen
    • Tutorials
    • Dokumentation
    • Zertifizierungen
    • Schulung
    • Blog
    • Podcast
    Bildung fördern
    • Bildungsprogramm
    • Scale-Up! Planspiel
    • Odoo besuchen
    Software anfragen
    • Herunterladen
    • Editionen vergleichen
    • Releases
    Zusammenarbeiten
    • Github
    • Forum
    • Veranstaltungen
    • Übersetzungen
    • Partner werden
    • Dienstleistungen für Partner
    • Buchhaltungsfirma registrieren
    Services anfragen
    • Partner finden
    • Buchhalter finden
    • Einen Experten treffen
    • Implementierungsservices
    • Kundenreferenzen
    • Support
    • Upgrades
    Github Youtube Twitter Linkedin Instagram Facebook Spotify
    +1 (650) 691-3277
    Eine Demo erhalten
  • Preiskalkulation
  • Hilfe

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

  • CRM
  • e-Commerce
  • Buchhaltung
  • Lager
  • PoS
  • Projekte
  • MRP
All apps
Sie müssen registriert sein, um mit der Community zu interagieren.
Alle Beiträge Personen Abzeichen
Stichwörter (Alle anzeigen)
odoo accounting v14 pos v15
Über dieses Forum
Sie müssen registriert sein, um mit der Community zu interagieren.
Alle Beiträge Personen Abzeichen
Stichwörter (Alle anzeigen)
odoo accounting v14 pos v15
Über dieses Forum
Hilfe

hi how call a function python in file javascript in odoo 15 please help

Abonnieren

Erhalten Sie eine Benachrichtigung, wenn es eine Aktivität zu diesem Beitrag gibt

Diese Frage wurde gekennzeichnet
4 Antworten
9545 Ansichten
Avatar
amine ah

hi how call a function python in file javascript in odoo 15 please help


0
Avatar
Verwerfen
Avatar
Cybrosys Techno Solutions Pvt.Ltd
Beste Antwort

Hi,

It is not possible to call a Python function from JavaScript in Odoo 15 directly, as they are two separate programming languages and run on different environments (Python on the server side, JavaScript on the client side). However, you can achieve this by making an API call to the server, where the Python function is located, from your JavaScript code. In Odoo 15, this is typically done using the 'rpc' method provided by the odoo.define JavaScript method.

Here is an example of how you can call a Python function named 'my_python_function' that is defined in an Odoo model named 'my.model' from JavaScript in an Odoo 15:

odoo.define('my_module', function (require) {
var rpc = require('web.rpc');

// Call the Python function
rpc.query({
model: 'my.model',
method: 'my_python_function',
args: [arg1, arg2, ...],
}).then(function (result) {
console.log(result);
});
});

You can pass any arguments you want to the Python function by including them in the 'args' array.
The result of python function will be returned as a promise and you can use the then function to catch it.

Regards

1
Avatar
Verwerfen
Avatar
Iwan Prasetya
Beste Antwort

Hello when i try to call function using this._rpc on the js file, i got error "TypeError: this._rpc is not a function", can someone help me ?

0
Avatar
Verwerfen
Avatar
amine ah
Autor Beste Antwort

My function python call a action view how and i need every 1h show this action

0
Avatar
Verwerfen
MUHAMMAD Imran

You can use the Python built-in library schedule to schedule the execution of your function that calls the action view every hour. Here's an example:

Copy code
import schedule
import time

def call_action_view():
# Code to call the action view goes here

schedule.every(1).hour.do(call_action_view)

while True:
schedule.run_pending()
time.sleep(1)
This code will run the call_action_view function every hour indefinitely.

In Odoo, you can also schedule the execution of a function using the ir.cron model. You would need to create a new record in the ir.cron model with the following fields:

name: A name for the cron job
model_id: The model where the function is located
function: The name of the function you want to execute
interval_number: The frequency at which the function should be executed (e.g. 1 for every hour)
interval_type: The unit of time for the frequency (e.g. 'hours')
nextcall: The next time the cron job will be run
You can also use another odoo module that is odoo-automation it will help you to schedule the function you want to execute and also you can use it to execute any odoo functionality as well.

Avatar
MUHAMMAD Imran
Beste Antwort

If you need to call a Python function from JavaScript in Odoo 15, you can use the Odoo's RPC (Remote Procedure Call) mechanism to call the Python function on the server and get the result back to the browser.


You can use the odoo.jsonRpc() method provided by the Odoo JavaScript API to call a Python method. The first parameter of this method is the name of the method to call, the second parameter is an object containing the method's parameters, the third parameter is a callback function that will be called when the server returns a response.


For example, if you have a Python method named my_python_method that you want to call from JavaScript, you can use the following code:



odoo.jsonRpc("/your/controller/path", 'call', {

    'method': 'my_python_method',

    'params': {'param1': 'value1', 'param2': 'value2'}

}).then(function (result) {

    // do something with the result here

});

Please note that you need to specify the correct path to your controller, and also need to make sure that you have a corresponding method defined in your controller.

0
Avatar
Verwerfen
Diskutieren Sie gerne? Treten Sie bei, statt nur zu lesen!

Erstellen Sie heute ein Konto, um exklusive Funktionen zu nutzen und mit unserer tollen Community zu interagieren!

Registrieren
Community
  • Tutorials
  • Dokumentation
  • Forum
Open Source
  • Herunterladen
  • Github
  • Runbot
  • Übersetzungen
Dienstleistungen
  • Odoo.sh-Hosting
  • Support
  • Upgrade
  • Individuelle Entwicklungen
  • Bildung
  • Buchhalter finden
  • Partner finden
  • Partner werden
Über uns
  • Unsere Firma
  • Markenwerte
  • Kontakt
  • Karriere
  • Veranstaltungen
  • Podcast
  • Blog
  • Kunden
  • Rechtliches • Datenschutz
  • Sicherheit
الْعَرَبيّة 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 ist eine Suite von Open-Source-Betriebsanwendungen, die alle Bedürfnisse Ihres Unternehmens abdecken: CRM, E-Commerce, Buchhaltung, Lager, Kassensystem, Projektmanagement etc.

Das einzigartige Wertversprechen von Odoo ist, dass es gleichzeitig sehr einfach zu bedienen und voll integriert ist.

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