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
    Nekilnojamasis turtas
    • Real Estate Agency
    • Architektūros įmonė
    • Konstrukcija
    • Estate Managament
    • Sodininkauti
    • Turto savininkų asociacija
    Konsultavimas
    • Accounting Firm
    • Odoo Partneris
    • Marketing Agency
    • Teisinė firma
    • Talentų paieška
    • Auditai & sertifikavimas
    Gamyba
    • Textile
    • Metal
    • Furnitures
    • Maistas
    • Brewery
    • Įmonių dovanos
    Sveikata & Fitnesas
    • Sporto klubas
    • Akinių parduotuvė
    • Fitneso Centras
    • Sveikatos praktikai
    • Vaistinė
    • Kirpėjas
    Trades
    • Handyman
    • IT įranga ir palaikymas
    • Saulės energijos sistemos
    • Shoe Maker
    • Cleaning Services
    • HVAC Services
    Kiti
    • 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

Odoo 16 - How to run an XML code only when "iself_pos_activated" field is true?

Prenumeruoti

Get notified when there's activity on this post

This question has been flagged
xmlt-ifodoo16features
1 Atsakyti
4158 Rodiniai
Portretas
meriem

ODOO-16

I want that once the "iself_pos_activated" is True the Code under PaymentScreen.xml works :

In my self_pos/static/src/xml/Screens/PaymentScreen/PaymentScreen.xml I used to have this :

    <t t-name="PaymentScreen" t-inherit="point_of_sale.PaymentScreen" t-inherit-mode="primary" owl="1"  >
        <xpath expr="//div[hasclass('right-content')]" position="replace" >
        xpath>
         <xpath expr="//div[hasclass('payment-buttons-container')]" position="replace" >
        xpath>
    t>

I declared "iself_pos_activated" under /self_pos/models/pos_config.py :

class PosConfig(models.Model):
    _inherit = 'pos.config'

    iself_pos_activated = fields.Boolean('Self POS',help="The self POS is available on this shop",default=False)

In the /selfpos/views/posconfig.xml I called the iself_pos_activated, so I can change it either True or False in my pos settings :

"1.0" encoding="utf-8"?>
<odoo>   

        <record id="view_pos_config_form" model="ir.ui.view">
        <field name="model">pos.configfield>
        <field name="priority" eval="95"/>
        <field name="inherit_id" ref="point_of_sale.pos_config_view_form" />
        <field name="arch" type="xml">
           <xpath expr="//div[@id='other_devices']" position="after"> 
             <div class="col-12 col-lg-6 o_setting_box" id="iself_pos_activated">
                <div class="o_setting_left_pane">
                    <field name="iself_pos_activated"/>
                div>
                <div class="o_setting_right_pane">
                    <label for="iself_pos_activated"/>
                    <div class="text-muted">
                    Enables the self POS for this shop ...
                    div>
                    <div class="content-group mt16" attrs="{'invisible' : [('iself_pos_activated', '=', False)]}">
                    div>
                div>
            div> 
           xpath>
        field>
    record>
odoo>

Now, I tried this in my PaymentScreen.xml file :

"1.0" encoding="UTF-8"?>
<templates id="template" xml:space="preserve">

    <t t-name="PaymentScreen" t-inherit="point_of_sale.PaymentScreen" t-inherit-mode="primary" owl="1"    >
        <xpath expr="//div[hasclass('right-content')]" position="replace" >
<t t-if=" iself_pos_activated"> t>
        xpath>
         <xpath expr="//div[hasclass('payment-buttons-container')]" position="replace" >
<t t-if=" iself_pos_activated"> t>
        xpath>
    t>
templates>

But the Code under PaymentScreen.xml is being run wrongly and even I change the "iself_pos_activated" state (False or True) it's not running good.
So how should I call "iself_pos_activated" under .xml ? So that I run the PaymentScreen.xml code only when iself_pos_activated is TRUE.

----------------------------------------

Otherwise if I try with this in my PaymentScreen.xml :

    <t t-name="PaymentScreen"  t-inherit="point_of_sale.PaymentScreen" t-inherit-mode="primary" owl="1" t-if=" iself_pos_activated"    >
        <xpath expr="//div[hasclass('right-content')]" position="replace" >
        xpath>
         <xpath expr="//div[hasclass('payment-buttons-container')]" position="replace" >
        xpath>
    t>    

I get this error fot both cases, either iself_pos_activated is True or False :

point_of_sale.assets.min.js:678 TypeError: Cannot read properties of null (reading 'addEventListener') at point_of_sale.pos_as…kend.min.js:1558:24 at ProductScreen. (web.assets_common.min.js:1929:145) at RootFiber.complete (web.assets_common.min.js:1331:196) at Scheduler.processFiber (web.assets_common.min.js:1898:43) at web.assets_common.min.js:1894:109 at Set.forEach () at web.assets_common.min.js:1894:87

0
Portretas
Atmesti
meriem
Autorius

Hello Sachin,
Thank you for your response.
But the same error is remaining.

Best,

Portretas
Savya Sachin
Best Answer

Hi,

Please try this way,


<t t-name="PaymentScreen" t-inherit="point_of_sale.PaymentScreen" t-inherit-mode="primary" owl="1" t-if="widget.pos.config.iself_pos_activated">
<YOUR XML CODE>
</t>


Thanks

0
Portretas
Atmesti
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
Use t-if in website module
t-if odoo16features
Portretas
Portretas
1
birž. 23
2308
warnings.warn(f"The <act_window> tag is deprecated, use a <record> for {xml_id!r}.", DeprecationWarning)
xml odoo16features
Portretas
Portretas
Portretas
2
birž. 23
5908
(Odoo 16) widget: many2many_checkboxes need more features
xml widget odoo16features
Portretas
Portretas
1
geg. 24
2819
Problem with an invisible condition in an XML template file
xml plugin odoo16features
Portretas
1
bal. 24
2761
How to make a field ReadOnly in Inherited View Based on Groups Using Xpath
xml groups odoo16features
Portretas
Portretas
1
vas. 24
4079
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