The “new” and “switch” buttons only work after refreshing the page in the browser

Hi,
I have defined a simple model and list, form, and menu via XML (similar to the tutorial) – when I click on the menu in the web (sao), the “switch” and “new” buttons do not work at first, only after I have refreshed the page in the browser.

‘trytond-admin -d test --all’
No errors are returned, even when logging ‘trytond’.

I haven’t found anything that has helped me (e.g., pool.register() or ‘_name_’ look correct to me); it’s probably a beginner’s mistake - does anyone know what the problem is?

The “swicth” button is only available when a record is selected and if there is a second view.
And the “new” button is only available when there is an editable view defined for the action.

So I’m wondering if you have well define the form view in the list of views of the action.

Thank you very much for your reply—that’s right. I also created an entry, but it only works when I press “refresh” in the browser. So, after pressing “refresh,” I created an entry using the “new” button, which can then be selected—but I can only call up “switch” and ‘new’ when I press “refresh” in the browser. When I start the function from the menu, the buttons unfortunately don’t work—any ideas?

====
property.xml

<tryton>
   <data>

      <record model="ir.ui.view" id="property_view_form">
         <field name="model">real_estate.property</field>
         <field name="type">form</field>
         <field name="name">property_form</field>
      </record>

      <record model="ir.ui.view" id="property_view_list">
         <field name="model">real_estate.property</field>
         <field name="type">tree</field>
         <field name="name">property_list</field>
      </record>

      <record model="ir.action.act_window" id="act_property_form">
         <field name="name">Property</field>
         <field name="res_model">real_estate.property</field>
      </record>

      <record model="ir.action.act_window.view" id="act_property_form_view">
         <field name="sequence" eval="10"/>
         <field name="view" ref="property_view_list"/>
         <field name="act_window" ref="act_property_form"/>
      </record>

      <record model="ir.action.report" id="report_proprty">
         <field name="name">Property</field>
         <field name="report_name">real_estate.property_report</field>
         <field name="model">real_estate.property</field>
         <field name="report">real_estate/property.html</field>
         <field name="template_extension">html</field>
      </record>

      <record model="ir.action.keyword" id="report_proprty_keyword">
         <field name="keyword">form_print</field>
         <field name="model">real_estate.property,-1</field>
         <field name="action" ref="report_proprty"/>
      </record>

      <menuitem
         parent="menu_real_estate_masta_data"
         action="act_property_form"
         sequence="10"
         id="menu_property_form"/>

   </data>
</tryton> 

===
property_form.xml

<?xml version="1.0"?>
<form col="6">
    <!--label name="company"/><field name="company"/>
    <newline/!-->   
    <label name="id"/><field name="id"/>
    <!--label name="compute_name"/><field name="compute_name"/!-->
    <newline/>   
    <label name="ext_id"/><field name="ext_id" readonly="1"/>
    <label name="property_id"/><field name="property_id"/>
    <newline/>   
    <label name="description"/><field name="description"/>
    <newline/>   
    <label name="start_date"/><field name="start_date"/>
    <label name="end_date"/><field name="end_date"/>
    <newline/>   
    <separator name="comment" colspan="4"/><field name="comment" colspan="4"/>
</form>

===
property_list.xml

<?xml version="1.0"?>
<tree>
    <field name="company"/>
    <field name="id"/>
    <!--field name="compute_name"/-->
    <field name="start_date"/>
    <field name="end_date"/>
</tree>

This is what I suspected. You defined only a list view for the action so there is no editable view to create new record. You must register also a form view for that.

Thanks a lot! That’s it!

This topic was automatically closed 24 hours after the last reply. New replies are no longer allowed.