Skip to Content
Odoo मेन्यू
  • Sign in
  • मुफ़्त में आज़माएं
  • ऐप्लिकेशन
    फ़ाइनेंस
    • अकाउंटिंग
    • इनवॉइसिंग
    • एक्सपेंस
    • स्प्रेडशीट (बीआई)
    • डॉक्यूमेंट्स
    • साइन
    सेल्स
    • सीआरएम
    • सेल्स
    • पीओएस शॉप
    • पीओएस रेस्टोरेंट
    • सब्सक्रिप्शन
    • रेंटल
    वेबसाइट
    • वेबसाइट बिल्डर
    • ई-कॉमर्स
    • ब्लॉग
    • फ़ोरम
    • लाइव चैट
    • ई-लर्निंग
    सप्लाई चेन
    • इन्वेंट्री
    • मैन्युफ़ैक्चरिंग
    • पीएलएम
    • परचेज़
    • मेंटेनेंस
    • क्वालिटी
    मानव संसाधन
    • कर्मचारी
    • रिक्रूटमेंट
    • टाइम ऑफ़
    • अप्रेज़ल
    • रेफ़रल
    • फ़्लीट
    मार्केटिंग
    • सोशल मार्केटिंग
    • ईमेल मार्केटिंग
    • एसएमएस मार्केटिंग
    • इवेंट
    • मार्केटिंग ऑटोमेशन
    • सर्वे
    सेवाएं
    • प्रोजेक्ट
    • टाइमशीट
    • फ़ील्ड सर्विस
    • हेल्पडेस्क
    • प्लानिंग
    • अपॉइंटमेंट
    प्रॉडक्टिविटी
    • डिस्कस
    • अप्रूवल
    • आईओटी
    • वीओआईपी
    • नॉलेज
    • WhatsApp
    तीसरे पक्ष के ऐप्लिकेशन Odoo स्टूडियो Odoo क्लाउड प्लेटफ़ॉर्म
  • इंडस्ट्री
    रीटेल
    • बुक स्टोर
    • क्लोदिंग स्टोर
    • फ़र्नीचर स्टोर
    • ग्रॉसरी स्टोर
    • हार्डवेयर स्टोर
    • टॉय स्टोर
    Food & Hospitality
    • बार और पब
    • रेस्टोरेंट
    • फ़ास्ट फ़ूड
    • Guest House
    • बेवरिज डिस्ट्रीब्यूटर
    • Hotel
    Real Estate
    • Real Estate Agency
    • आर्किटेक्चर फ़र्म
    • कंसट्रक्शन
    • एस्टेट मैनेजमेंट
    • गार्ड्निंग
    • प्रॉपर्टी ओनर असोसिएशन
    Consulting
    • Accounting Firm
    • Odoo पार्टनर
    • Marketing Agency
    • लॉ फ़र्म
    • टैलेंट ऐक्विज़िशन
    • ऑडिट & सर्टिफ़िकेशन
    मैन्युफ़ैक्चरिंग
    • Textile
    • Metal
    • Furnitures
    • Food
    • Brewery
    • कॉर्पोरेट गिफ़्ट
    हेल्थ & फिटनेस
    • स्पोर्ट्स क्लब
    • आईवियर स्टोर
    • फिटनेस सेंटर
    • वेलनेस प्रैक्टिशनर
    • फॉर्मेसी
    • हेयर सैलून
    Trades
    • Handyman
    • आईटी हॉर्डवेयर और सपोर्ट
    • Solar Energy Systems
    • Shoe Maker
    • Cleaning Services
    • HVAC Services
    Others
    • Nonprofit Organization
    • एन्वायरमेंटल एजेंसी
    • बिलबोर्ड रेंटल
    • फ़ोटोग्राफी
    • बाइक लीजिंग
    • सॉफ़्टवेयर रीसेलर
    Browse all Industries
  • कम्यूनिटी
    सीखें
    • ट्यूटोरियल्स
    • दस्तावेज़
    • सर्टिफ़िकेशन
    • ट्रेनिंग
    • ब्लॉग
    • पॉडकास्ट
    शिक्षा को बढ़ावा दें
    • एजुकेशन प्रोग्राम
    • स्केल अप! बिजनेस गेम
    • Odoo के ऑफ़िस में आएं
    सॉफ़्टवेयर पाएं
    • डाउनलोड
    • वर्शन की तुलना करें
    • रिलीज़
    साथ मिलकर काम करें
    • Github
    • फ़ोरम
    • इवेंट
    • अनुवाद
    • पार्टनर बनें
    • Services for Partners
    • अपना अकाउंटिंग फ़र्म रजिस्टर करें
    सेवाएं पाएं
    • पार्टनर ढूंढें
    • अकाउंटेंट खोजें
    • सलाहकार की मदद लें
    • इम्प्लिमेंटेशन सेवाएं
    • कस्टमर रेफ़रेंस
    • सहायता
    • अपग्रेड
    Github Youtube Twitter Linkedin Instagram Facebook Spotify
    +1 (650) 691-3277
    डेमो देखें
  • कीमत
  • सहायता

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

  • सीआरएम
  • e-Commerce
  • लेखांकन
  • इन्वेंटरी
  • PoS
  • प्रोजेक्ट
  • MRP
All apps
You need to be registered to interact with the community.
All Posts People Badges
टैग (View all)
odoo accounting v14 pos v15
About this forum
You need to be registered to interact with the community.
All Posts People Badges
टैग (View all)
odoo accounting v14 pos v15
About this forum
Help

Odoo 12: Trying to add information to stock_barcode_lines_template

Subscribe

Get notified when there's activity on this post

This question has been flagged
javascriptxmlqwebodoo12
1 Reply
3811 Views
Avatar
Mod Fuel LLC

I'm attempting to add information to the template stock_barcode_lines_template. I have the xml for the template written and showing in the view.

<?xml version="1.0" encoding="utf-8"?>
    <templates id="template" xml:space="preserve">
        <t t-extend="stock_barcode_lines_template">
            <t t-jquery='.o_barcode_line_details' t-operation='append'>
                <div>
                    <span class="o_line_rack_name" t-esc="'Rack: '"/>
                    <span class="o_line_rack_value" t-esc="line.rack"/>
                    <span class="o_line_shelf_name" t-esc="'Shelf: '"/>
                    <span class="o_line_shelf_value" t-esc="line.shelf"/>
                    <span class="o_line_bin_name" t-esc="'Bin: '"/>
                    <span class="o_line_bin_value" t-esc="line.bin"/>
                </div>
            </t>
        </t>
</templates>

and the following Javascript will add the information into the line dict

LinesWidget.include({

    getProductLines: function(lines){
    var self = this
    lines.forEach(function(line){
        self._rpc({
            model: 'stock.move.line',
            method: 'get_rack_bin',
            args: [line,line.id],
        }).then(function(result){
            line.rack = result.rack;
            line.shelf = result.shelf;
            line.bin = result.bin;
        });
    });
    return self._super(lines)
    }
});

however when I put `<t t-log="line.bin"/>` (or rack or shelf) in the template it is logging as undefined however when I put `<t t-log="line"/>` in the template, the new data is in the dict.

bin: "11"
display_name: "[HJ-PCKRD-100-03] Hi Juku - Puckered (3 mg)"
dummy_id: false
id: 149541
location_dest_id: {id: 9, display_name: "Partner Locations/Customers"}
location_id: {id: 49, display_name: "ModFu/Stock"}
lot_id: false
lot_name: false
owner_id: false
package_id: false
product_barcode: "853668007979"
product_id: {id: 5429, barcode: "853668007979", tracking: "none"}
product_uom_id: (2) [1, "Unit(s)"]
length: 2
__proto__: Array(0)
product_uom_qty: 30
qty_done: 0
rack: "38.11"
result_package_id: false
shelf: "B"

How can I successfully pull the information from the dict?

0
Avatar
Discard
Avatar
Niogin Italia srl
Best Answer

It's because the self._rpc request is a promise request (not provided immediately while the code is running.

As workaround I use name each span with a unique id then once the _rpc request is fullfiled you update the value.

try:

<?xml version="1.0" encoding="utf-8"?>
    <templates id="template" xml:space="preserve">
        <t t-extend="stock_barcode_lines_template">
            <t t-jquery='.o_barcode_line_details' t-operation='append'>
                <div>
                    <span class="o_line_rack_name" t-esc="'Rack: '"/>
                    <span class="o_line_rack_value" t-esc="line.rack" t-att-id="'rack' + line.id"/>
                    <span class="o_line_shelf_name" t-esc="'Shelf: '"/>
                    <span class="o_line_shelf_value" t-esc="line.shelf" t-att-id="'shelf' + line.id"/>
                    <span class="o_line_bin_name" t-esc="'Bin: '"/>
                    <span class="o_line_bin_value" t-esc="line.bin" t-att-id="'bin' + line.id"/>
                </div>
            </t>
        </t>


</templates>


Then for javascript:

LinesWidget.include({

    getProductLines: function(lines){
    var self = this
    lines.forEach(function(line){
        self._rpc({
            model: 'stock.move.line',
            method: 'get_rack_bin',
            args: [line,line.id],
        }).then(function(result){

            var span_rack = document.getElementById('rack' + line.id);

            span_rack.innerHTML = result.rack

            var span_shelf = document.getElementById('shelf' + line.id);

            span_shelf.innerHTML = result.shelf


            var span_bin = document.getElementById('bin' + line.id);

            span_bin.innerHTML = result.bin


        });
    });
    return self._super(lines)
    }
});


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

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

Sign up
Related Posts Replies Views Activity
Is there a way to translate xml custom attribute value/message?
javascript xml odoo12
Avatar
0
अग॰ 20
4025
Extend QWeb .xml with t-extend doesn't work?
javascript xml qweb t-extend
Avatar
Avatar
1
फ़र॰ 22
3537
Qweb variable operation: index +=1 Solved
xml qweb variable odoo12
Avatar
Avatar
1
अप्रैल 21
10165
t-att-href url get error Solved
xml qweb
Avatar
Avatar
2
अप्रैल 23
9627
Sort order for dropdown list of Many2one field
qweb odoo12
Avatar
Avatar
Avatar
2
अक्तू॰ 22
6269
कम्यूनिटी
  • ट्यूटोरियल्स
  • दस्तावेज़
  • फ़ोरम
ओपन सोर्स
  • डाउनलोड
  • Github
  • रनबॉट
  • अनुवाद
सेवाएं
  • Odoo.sh Hosting
  • सहायता
  • अपग्रेड
  • कस्टम डेवलपमेंट्स
  • शिक्षा
  • अकाउंटेंट खोजें
  • पार्टनर ढूंढें
  • पार्टनर बनें
हमारे बारे में
  • हमारी कंपनी
  • ब्रांड ऐसेट
  • संपर्क करें
  • नौकरियां
  • इवेंट
  • पॉडकास्ट
  • ब्लॉग
  • ग्राहक
  • लीगल • गोपनीयता
  • सुरक्षा
الْعَرَبيّة 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, बिज़नेस से जुड़े ऐप्लिकेशन का एक कलेक्शन है जो ओपन सोर्स पर आधारित है. इसमें आपकी कंपनी की हर ज़रूरत के लिए ऐप्लिकेशन हैं. जैसे, सीआरएम, ई-कॉमर्स, अकाउंटिंग, इन्वेंट्री, पॉइंट ऑफ़ सेल, प्रोजेक्ट मैनेजमेंट वगैरह.

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