Overslaan naar inhoud
Odoo Menu
  • Aanmelden
  • Probeer het gratis
  • Apps
    Financiën
    • Boekhouding
    • Facturatie
    • Onkosten
    • Spreadsheet (BI)
    • Documenten
    • Ondertekenen
    Verkoop
    • CRM
    • Verkoop
    • Kassasysteem winkel
    • Kassasysteem Restaurant
    • Abonnementen
    • Verhuur
    Websites
    • Websitebouwer
    • E-commerce
    • Blog
    • Forum
    • Live Chat
    • eLearning
    Bevoorradingsketen
    • Voorraad
    • Productie
    • PLM
    • Inkoop
    • Onderhoud
    • Kwaliteit
    Personeelsbeheer
    • Werknemers
    • Werving & Selectie
    • Verlof
    • Evaluaties
    • Aanbevelingen
    • Wagenpark
    Marketing
    • Social media Marketing
    • E-mailmarketing
    • SMS Marketing
    • Evenementen
    • Marketingautomatisering
    • Enquêtes
    Diensten
    • Project
    • Urenstaten
    • Buitendienst
    • Helpdesk
    • Planning
    • Afspraken
    Productiviteit
    • Chat
    • Goedkeuringen
    • IoT
    • VoIP
    • Kennis
    • WhatsApp
    Apps van derden Odoo Studio Odoo Cloud Platform
  • Bedrijfstakken
    Detailhandel
    • Boekhandel
    • kledingwinkel
    • Meubelzaak
    • Supermarkt
    • Bouwmarkt
    • Speelgoedwinkel
    Food & Hospitality
    • Bar en Pub
    • Restaurant
    • Fastfood
    • Gastenverblijf
    • Drankenhandelaar
    • Hotel
    Vastgoed
    • Makelaarskantoor
    • Architectenbureau
    • Bouw
    • Vastgoedbeheer
    • Tuinieren
    • Vereniging van eigenaren
    Consulting
    • Accountantskantoor
    • Odoo Partner
    • Marketingbureau
    • Advocatenkantoor
    • Talentenwerving
    • Audit & Certificering
    Productie
    • Textiel
    • Metaal
    • Meubels
    • Eten
    • Brewery
    • Relatiegeschenken
    Gezondheid & Fitness
    • Sportclub
    • Opticien
    • Fitnesscentrum
    • Wellness-medewerkers
    • Apotheek
    • Kapper
    Trades
    • Klusjesman
    • IT-hardware & support
    • Zonne-energiesystemen
    • Schoenmaker
    • Schoonmaakdiensten
    • HVAC-diensten
    Andere
    • Non-profitorganisatie
    • Milieuagentschap
    • Verhuur van Billboards
    • Fotograaf
    • Fietsleasing
    • Softwareverkoper
    Browse all Industries
  • Community
    Leren
    • Tutorials
    • Documentatie
    • Certificeringen
    • Training
    • Blog
    • Podcast
    Versterk het onderwijs
    • Onderwijs- programma
    • Scale Up! Business Game
    • Bezoek Odoo
    Download de Software
    • Downloaden
    • Vergelijk edities
    • Releases
    Werk samen
    • Github
    • Forum
    • Evenementen
    • Vertalingen
    • Word een Partner
    • Services for Partners
    • Registreer je accountantskantoor
    Diensten
    • Vind een partner
    • Vind een boekhouder
    • Een adviseur ontmoeten
    • Implementatiediensten
    • Klantreferenties
    • Ondersteuning
    • Upgrades
    Github Youtube Twitter Linkedin Instagram Facebook Spotify
    +1 (650) 691-3277
    Vraag een demo aan
  • Prijzen
  • Help

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

  • CRM
  • e-Commerce
  • Boekhouding
  • Voorraad
  • PoS
  • Project
  • MRP
All apps
Je moet geregistreerd zijn om te kunnen communiceren met de community.
Alle posts Personen Badges
Labels (Bekijk alle)
odoo accounting v14 pos v15
Over dit forum
Je moet geregistreerd zijn om te kunnen communiceren met de community.
Alle posts Personen Badges
Labels (Bekijk alle)
odoo accounting v14 pos v15
Over dit forum
Help

How to add new fileds/values to line widgets in Barcode mobile view in Odoo14 EE?

Inschrijven

Ontvang een bericht wanneer er activiteit is op deze post

Deze vraag is gerapporteerd
barcodescannerbarcodev14
1 Beantwoorden
4951 Weergaven
Avatar
Kabeer KB

Hi i am trying to add two new fields to the Barcode mobile view. I went through the default js code of odoo, but didn't find a way to add my custome fields to it.

Here is the default code stock_barcode/static/src/js/client_action/lines_widget.js

init: function (parent, page, pageIndex, nbPages) {
    this._super.apply(this, arguments);
    this.page = page; #don't know where this argument page coming from in argument list.
    this.pageIndex = pageIndex;
    this.nbPages = nbPages;
    this.mode = parent.mode;
    this.groups = parent.groups;
    this.model = parent.actionParams.model;
    this.show_entire_packs = parent.show_entire_packs;
    this.displayControlButtons = this.nbPages > 0 && parent._isControlButtonsEnabled();
    this.displayOptionalButtons = parent._isOptionalButtonsEnabled();
    this.isPickingRelated = parent._isPickingRelated();
    this.isImmediatePicking = parent.isImmediatePicking ? true : false;
    this.sourceLocations = parent.sourceLocations;
    this.destinationLocations = parent.destinationLocations;
    // detect if touchscreen (more complicated than one would expect due to browser differences...)
    this.istouchSupported = 'ontouchend' in document ||
                           'ontouchstart' in document ||
                           'ontouchstart' in window ||
                           navigator.maxTouchPoints > 0 ||
                           navigator.msMaxTouchPoints > 0;
},


In _renderLines function,



_renderLines: function () {
//Skipped some codes here
// Render and append the lines, if any.
    var $body = this.$el.filter('.o_barcode_lines');
    console.log('this model',this.model);
    if (this.page.lines.length) {
        var $lines = $(QWeb.render('stock_barcode_lines_template', {
            lines: this.getProductLines(this.page.lines),
            packageLines: this.getPackageLines(this.page.lines),
            model: this.model,
            groups: this.groups,
            isPickingRelated: this.isPickingRelated,
            istouchSupported: this.istouchSupported,
        }));
        $body.prepend($lines);
        for (const line of $lines) {
            if (line.dataset) {
                this._updateIncrementButtons($(line));
            }
        }
        $lines.on('click', '.o_edit', this._onClickEditLine.bind(this));
        $lines.on('click', '.o_package_content', this._onClickTruckLine.bind(this));
    }
In the above code, you can see this.page.lines field, i need to add my custom two more fields. Actually it's dead-end for me. Any solution?
0
Avatar
Annuleer
Avatar
Ksolves India Limited (Odoo Gold Partner)
Beste antwoord

Hi Kabeer,

To add new fields/values to the line widgets in the Barcode mobile view in Odoo14 Enterprise Edition, you need to modify the stock_barcode/static/src/js/client_action/lines_widget.js file. Here's how you can do it:

  1. Add your custom fields to the lines object in the _renderLines function.
javascriptCopy code_renderLines: function () {
    // Skipped some codes here
    // Render and append the lines, if any.
    var $body = this.$el.filter('.o_barcode_lines');
    console.log('this model',this.model);
    if (this.page.lines.length) {
        var $lines = $(QWeb.render('stock_barcode_lines_template', {
            lines: this.getProductLines(this.page.lines),
            packageLines: this.getPackageLines(this.page.lines),
            model: this.model,
            groups: this.groups,
            isPickingRelated: this.isPickingRelated,
            istouchSupported: this.istouchSupported,
            custom_field_1: 'custom value 1',
            custom_field_2: 'custom value 2',
        }));
        $body.prepend($lines);
        for (const line of $lines) {
            if (line.dataset) {
                this._updateIncrementButtons($(line));
            }
        }
        $lines.on('click', '.o_edit', this._onClickEditLine.bind(this));
        $lines.on('click', '.o_package_content', this._onClickTruckLine.bind(this));
    }
}
  1. Modify the stock_barcode_lines_template to include your custom fields. You can access these fields using .custom_field_1 and .custom_field_2.
phpCopy code
id="stock_barcode_lines_template">
    
    t-if="lines">
        
        t-foreach="lines" t-as="line">
            
            class="o_data_cell">
                t-esc="line.product_name"/>
                t-esc="line.custom_field_1"/>
                t-esc="line.custom_field_2"/>
            
            
        
    

These changes should allow you to add two new fields to the line widgets in the Barcode mobile view in Odoo14 Enterprise Edition.

Regards,

Team Ksolves!

0
Avatar
Annuleer
Geniet je van het gesprek? Blijf niet alleen lezen, doe ook mee!

Maak vandaag nog een account aan om te profiteren van exclusieve functies en deel uit te maken van onze geweldige community!

Aanmelden
Gerelateerde posts Antwoorden Weergaven Activiteit
Delaying barcode reader (?)
barcodescanner barcode
Avatar
0
mrt. 24
2336
Barcode Module
barcodescanner barcode
Avatar
0
nov. 23
2631
Barcode Scanning in Odoo 15 Community Version - Possible? Opgelost
barcodescanner barcode
Avatar
Avatar
2
sep. 23
5195
Barcode scanner integration
barcodescanner barcode
Avatar
0
apr. 18
4340
is custom field correctly gets the barcode from scanner..? Opgelost
barcodescanner barcode
Avatar
Avatar
Avatar
2
mrt. 15
6868
Community
  • Tutorials
  • Documentatie
  • Forum
Open Source
  • Downloaden
  • Github
  • Runbot
  • Vertalingen
Diensten
  • Odoo.sh Hosting
  • Ondersteuning
  • Upgrade
  • Gepersonaliseerde ontwikkelingen
  • Onderwijs
  • Vind een boekhouder
  • Vind een partner
  • Word een Partner
Over ons
  • Ons bedrijf
  • Merkelementen
  • Neem contact met ons op
  • Vacatures
  • Evenementen
  • Podcast
  • Blog
  • Klanten
  • Juridisch • Privacy
  • Beveiliging
الْعَرَبيّة 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 is een suite van open source zakelijke apps die aan al je bedrijfsbehoeften voldoet: CRM, E-commerce, boekhouding, inventaris, kassasysteem, projectbeheer, enz.

Odoo's unieke waardepropositie is om tegelijkertijd zeer gebruiksvriendelijk en volledig geïntegreerd te zijn.

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