2

I have one Print button in my Wizard.I can focus on other fields by using tab.But for the Print button it is not possible.I want to focus to Print button and when I click Enter , I need to press the button. I tried like this :

First Try

XML

        <group>
          <field name = "xn_barcode" />
          <field name = "price"/>
          <button name="generate" tabindex="1" type="object" string="Print"/>
        </group>
        <footer>
          <button name="generate" tabindex="1" type="object" string="Print"/>
        </footer>

My button name is generate I tried by using tabindex attribute. And I tried placing this button inside group and footer.

Second Try(Also mentioned for EasyOdoo's reply)

I refered a wizard in Account Invoice.(account.account_invoice_confirm_view) (Invoice Tree>Action>Confirm Draft Invoice) There it is working.What I find out while comparing is that, that wizard does not have any field in it.(Only <p> tag with some data found in that wizard) And I tried my wizard with no fields in it and it is working.But I want fields in my wizzard.What to do?I think its an odoo issue.

Odoo's Confirm Draft Invoices Wizard's Code

<form string="Confirm Draft Invoices">
     <p class="oe_grey">
      Once draft invoices are confirmed, you will not be able
      to modify them. The invoices will receive a unique
      number and journal items will be created in your chart
      of accounts.
      </p>
      <footer>
         <button string="Confirm Invoices" name="invoice_confirm" type="object" default_focus="1" class="btn-primary"/>
         <button string="Cancel" class="btn-default" special="cancel"/>
      </footer>
 </form>

Please Help me. Thanks in Advance.

vbt
  • 795
  • 7
  • 31

1 Answers1

1

Try this:

<field name="arch" type="xml">
    <form>
        <sheet>
            <group>
              <field name = "xn_barcode" />
              <field name = "price"/>
            </group>
        </sheet>
        <footer>
           <button name="generate" type="object" string="Print"/>
           <button string="Cancel" class="btn-secondary" special="cancel"/>
        </footer>
    </form>
</field>

Result should look like this:

You should see a result looks like this

Charif DZ
  • 14,415
  • 3
  • 21
  • 40
  • I tried like this: `` and `` But its not working.What I want is that when we press `Tab` ,I should be able to select that `generate` button. Now its not focusing to `generate` button no matter how many times I press the `tab` . – vbt Jun 08 '19 at 04:46
  • Are you sure the class is applied is the button color blue?!! see my updates and did you have result like mine – Charif DZ Jun 08 '19 at 06:57
  • I tried like this,and its color changes to blue as you mentioned.But I am not able to navigate to that button using Tab key.I tried like this: `` `` – vbt Jun 22 '19 at 05:23
  • New Update: I refered a wizard in Account Invoice.(account.account_invoice_confirm_view) (Invoice Tree>Action>Confirm Draft Invoice) There it is working.What I find out while comparing is that that wizard does not have any field in it.(Only `

    ` tag with some data found in that wizard) And I tried my wizard with no fields in it and it is working.But I want fields in my wizzard.What to do?I think its an odoo issue.

    – vbt Jun 22 '19 at 06:05