You can create form view in odoo by using below code in .xml file
There are two ways to create a Form View in Odoo.
1. Existing Form
2. Simple Form View.
1- Existing form Here you have to inherit form view and change this form view in odoo.
<?xml version="1.0" encoding="UTF-8"?>
<openerp>
<data>
<record id="invoice_form" model="ir.ui.view">
<field name="name">account.invoice.form.inherit</field>
<field name="model">account.invoice</field>
<field name="inherit_id" ref="account.invoice_form" />
<field name="arch" type="xml">
<data>
<field name="labour" position="after">
<field name="cartage"/>
</field>
</data>
</field>
</record>
</data>
2- Simple form view- This is simple form view which have no dependencies to other form in odoo. You need to use this code in your .xml file in Odoo to create form view.
<?xml version="1.0" ?>
<openerp>
<data>
<record id="view_invoice_penalty_form" model="ir.ui.view">
<field name="name">penalty.form</field>
<field name="model">add.penalty</field>
<field name="type">form</field>
<field name="arch" type="xml">
<form string="Penalty" >
<field name="date"/>
</form>
</field>
</record>
<record model="ir.actions.act_window" id="action_penalty_form">
<field name="name">Add penalty</field>
<field name="res_model">add.penalty</field>
</record>
<menuitem name="Add Penalty" id="menu_penalty" parent="account.menu_finance" action="action_penalty_form" sequence="2"/>
</data>
</openerp>
0 Comment(s)