Skip to Content
Odoo Menu
  • Prisijungti
  • Išbandykite nemokamai
  • Programėlės
    Finansai
    • Apskaita
    • Pateikimas apmokėjimui
    • Sąnaudos
    • Skaičiuoklė (BI)
    • Dokumentai
    • Pasirašymas
    Pardavimai
    • CRM
    • Pardavimai
    • Kasų sistema - Parduotuvė
    • Kasų sistema - Restoranas
    • Prenumeratos
    • Nuoma
    Svetainės
    • Svetainių kūrėjimo įrankis
    • El. Prekyba
    • Internetinis Tinklaraštis
    • Forumas
    • Tiesioginis pokalbis
    • eMokymasis
    Tiekimo grandinė
    • Atsarga
    • Gamyba
    • PLM
    • Įsigijimai
    • Priežiūra
    • Kokybė
    Žmogaus ištekliai
    • Darbuotojai
    • Įdarbinimas
    • Atostogos
    • Įvertinimai
    • Rekomendacijos
    • Transporto priemonės
    Rinkodara
    • Socialinė rinkodara
    • Rinkodara el. paštu
    • SMS rinkodara
    • Renginiai
    • Rinkodaros automatizavimas
    • Apklausos
    Paslaugos
    • Projektas
    • Darbo laiko žiniaraščiai
    • Priežiūros tarnyba
    • Pagalbos tarnyba
    • Planavimas
    • Rezervacijos
    Produktyvumas
    • Diskucija
    • Patvirtinimai
    • IoT
    • VoIP
    • Žinių biblioteka
    • WhatsApp
    Trečiųjų šalių programos Odoo Studija Odoo debesijos platforma
  • Pramonės šakos
    Mažmeninė prekyba
    • Knygynas
    • Drabužių parduotuvė
    • Baldų parduotuvė
    • Maisto prekių parduotuvė
    • Techninės įrangos parduotuvė
    • Žaislų parduotuvė
    Food & Hospitality
    • Barai ir pub'ai
    • Restoranas
    • Greitasis maistas
    • Guest House
    • Gėrimų platintojas
    • Hotel
    Real Estate
    • Real Estate Agency
    • Architektūros įmonė
    • Konstrukcija
    • Estate Managament
    • Sodininkauti
    • Turto savininkų asociacija
    Consulting
    • Accounting Firm
    • Odoo Partneris
    • Marketing Agency
    • Teisinė firma
    • Talentų paieška
    • Auditai & sertifikavimas
    Gamyba
    • Textile
    • Metal
    • Furnitures
    • Food
    • Brewery
    • Įmonių dovanos
    Sveikata & Fitnesas
    • Sporto klubas
    • Akinių parduotuvė
    • Fitneso Centras
    • Sveikatos praktikai
    • Vaistinė
    • Kirpėjas
    Trades
    • Handyman
    • IT įranga ir palaikymas
    • Solar Energy Systems
    • Shoe Maker
    • Cleaning Services
    • HVAC Services
    Others
    • Nonprofit Organization
    • Aplinkos agentūra
    • Reklaminių stendų nuoma
    • Fotografavimas
    • Dviračių nuoma
    • Programinės įrangos perpardavėjas
    Browse all Industries
  • Bendrija
    Mokykitės
    • Mokomosios medžiagos
    • Dokumentacija
    • Sertifikatai
    • Mokymai
    • Internetinis Tinklaraštis
    • Tinklalaidės
    Skatinkite švietinimą
    • Švietimo programa
    • Scale Up! Verslo žaidimas
    • Aplankykite Odoo
    Gaukite programinę įrangą
    • Atsisiųsti
    • Palyginkite versijas
    • Leidimai
    Bendradarbiauti
    • Github
    • Forumas
    • Renginiai
    • Vertimai
    • Tapkite partneriu
    • Services for Partners
    • Registruokite jūsų apskaitos įmonę
    Gaukite paslaugas
    • Susiraskite partnerį
    • Susirask buhalterį
    • Susitikti su konsultantu
    • Diegimo paslaugos
    • Klientų rekomendavimas
    • Palaikymas
    • Atnaujinimai
    Github Youtube Twitter Linkedin Instagram Facebook Spotify
    +1 (650) 691-3277
    Gaukite demo
  • Kainodara
  • Pagalba

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

  • CRM
  • e-Commerce
  • Apskaita
  • Atsarga
  • PoS
  • Projektas
  • MRP
All apps
You need to be registered to interact with the community.
All Posts People Badges
Žymos (View all)
odoo accounting v14 pos v15
About this forum
You need to be registered to interact with the community.
All Posts People Badges
Žymos (View all)
odoo accounting v14 pos v15
About this forum
Pagalba

Extend an existing js function in odoo. Now can I achieve this?

Prenumeruoti

Get notified when there's activity on this post

This question has been flagged
inheritjsOdoo12.0
1 Atsakyti
18487 Rodiniai
Portretas
Paulo Matos

Hello everyone,

I need your help on inheriting and extending a code on a js file for the account module.
For your reference I am using Odoo 12.

PS: I am sorry but I am unable to post images and code since some weeks ago on the forum.

The code I want to extend is from the account module and is located on the file "static/src/js/reconciliation/\reconciliation_renderer\.js\\"\ for\ the\ function\ \"_renderCreate\"\ on\ line\ \531\\.\
\
On\ this\ function\,\ starting\ from\ the\ line\ \
569 we have:

      account_id: {
         string: _t("Account"),
         domain: [['deprecated', '=', false]],
     },

Here, I just need to change the domain to something else.

What I have done:

1. Defined a template in my module to add the js asset that is located under mymodule/static/src/js/custom_asset.js:

      <template id="mymodule_asset_backend" name="custom assets" inherit_id="web.assets_backend">
         <xpath expr="." position="inside">
             <script type="text/javascript" src="/mymodule/static/src/js/custom_asset.js"></script>
         </xpath>
      </template>

2. Added the "xml" do the manifest file.

Now I need to add the required code to the js file but I do not know how to do it.

I know I have to do something like:

      odoo.define('mymodule.ReconciliationRenderer', function (require) {
      "use strict";

      var FieldManagerMixin = require('web.FieldManagerMixin');
      var LineRenderer = Widget.extend(FieldManagerMixin, {

      _renderCreate: function () {
            /* Custom code goes here */
      }, });
      return { LineRenderer: LineRenderer, };
      });

Can you please help me write this js file?

Thank you all in advance

Best regards

PM

0
Portretas
Atmesti
Portretas
Jigar Patel
Best Answer

Hello Paulo Matos,

It's not easily Overridable. The best way to do this is to replace whole method with changed domain.

Something like:

​odoo.define('mymodule.ReconciliationRenderer', function (require) {
"use strict";

var FieldManagerMixin = require('web.FieldManagerMixin');

var LineRenderer = Widget.extend(FieldManagerMixin, {
_renderCreate: function () {
// Copy whole code of _renderCreate method and Paste here. Just change your domain for account_id.
// Note: Don't call super
},
});

return { LineRenderer: LineRenderer, };

});

It will be risky to do such kind of messy code but it will works and fit to your needs.

1
Portretas
Atmesti
Paulo Matos
Autorius

Dear @Jigar Patel,

Thank you very much.

It worked as expected.

I had to "paste" the full content of "LineRenderer" because pasting just the "_renderCreate" function did not worked for me (when refreshing Odoo, just see a blank page on browser).

As you stated, perhaps it is not the best solution but for this specific case will do the job.

If I find any additional solution for solving this just by replacing the exact part the code I need, I will post it here.

Thank you once again

Best regards

PM

Pratik Devmurari

In this, what about a Widget?

Emmanuel Cruz Rangel

@Jiral Patel hi, i'm trying to extend _onSwitchCompanyClick in switch_company_menu.js but i cant get it, Could you help me please?

Enjoying the discussion? Don't just read, join in!

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

Registracija
Related Posts Replies Rodiniai Veikla
how to inherit or override a funtion in odoo javascript
function inherit js odoo17
Portretas
0
spal. 24
2117
How to inherit js file tax_group.js (account) in odoo 13
inherit js overwrite odoo13.0
Portretas
0
gruod. 23
2022
inherit/extend a js function
javascript inherit js extend
Portretas
0
rugs. 23
3179
Inherit Java Script file
javascript inherit js extend
Portretas
Portretas
2
kov. 15
7909
Custom Dashboard using js
Odoo12.0
Portretas
Portretas
1
bal. 25
4521
Bendrija
  • Mokomosios medžiagos
  • Dokumentacija
  • Forumas
Atvirasis kodas
  • Atsisiųsti
  • Github
  • Runbot
  • Vertimai
Paslaugos
  • Odoo.sh talpinimas
  • Palaikymas
  • Atnaujinti
  • Pritaikytas programavimo kūrimas
  • Švietimas
  • Susirask buhalterį
  • Susiraskite partnerį
  • Tapkite partneriu
Apie mus
  • Mūsų įmonė
  • Prekės ženklo turtas
  • Susisiekite su mumis
  • Darbo pasiūlymai
  • Renginiai
  • Tinklalaidės
  • Internetinis Tinklaraštis
  • Klientai
  • Teisinis • Privatumas
  • Saugumas
الْعَرَبيّة 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 yra atvirojo kodo verslo programų rinkinys, kuris apima visas įmonės poreikius: CRM, El. Prekybą, Apskaitą, Atsargų, Kasų sistemą, Projektų valdymą ir kt.

Unikali Odoo vertės pasiūla – būti tuo pačiu metu labai lengvai naudojama ir visiškai integruota sistema.

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