Q:

How can I add only one record into a form in odoo

How can I add only one record into a form or treeview in odoo?
After adding the first record, create option should be disabled.

A:

Well I'll teach you :)
First you must make a record as follows:
<data noupdate="1">
    <record id="my_record_01" model="my.model">
        <field name="field_name">value</field>
    </record>
</data>

This will insert record in the database and noupdate means that this section wont change if you will update your module later. During development use 0 and after that set 1.
To disable write for tree view you can use
<tree create="false" delete="false">
</tree>

For form
<form edit="false" create="false" delete="false">
</form>

create="false" will disable(actually hide) create button, and at this time you can set edit="true" and record will be editable, delete="false" will disable delete option from 'more' dropdown
Note that tree has not attribute edit.
Also I recommend to create security rules security/ir.model.access.csv and set there write read delete and create rights

