Skip to content

Instantly share code, notes, and snippets.

@allanaguilar
Created August 24, 2018 16:29
Show Gist options
  • Save allanaguilar/a893090a3fe96152aac7b7a4ab00e94a to your computer and use it in GitHub Desktop.
Save allanaguilar/a893090a3fe96152aac7b7a4ab00e94a to your computer and use it in GitHub Desktop.
Esta es una plantilla completa de vistas en odoo, incluye: menu, tree view, form view, y sus respectivos actions
<?xml version="1.0"?>
<odoo>
<data>
<!-- TREE VIEW -->
<record id="maintenance_order_tree" model="ir.ui.view">
<field name="name">maintenance.order.tree</field>
<field name="model">maintenance.order</field>
<field name="arch" type="xml">
<tree string="maintenance_order"> <!-- decoration-info="state == 'draft'" decoration-muted="state == 'cancel'" -->
<field name="name"/>
<field name="observations"/>
<field name="trans_date"/>
</tree>
</field>
</record>
<!-- FROM VIEW -->
<record id="maintenance_order_form" model="ir.ui.view">
<field name="name">maintenance.order.form</field>
<field name="model">maintenance.order</field>
<field name="arch" type="xml">
<form string="maintenance_order">
<header>
</header>
<sheet string="maintenance_order">
<!-- <h1 class="mt0"> -->
<!-- <label string="Asset Return" attrs="{'invisible': [('maintenance_order_type','!=','asset_return')]}"/>
<label string="Asset Delivery" attrs="{'invisible': [('maintenance_order_type','!=','asset_delivery')]}"/>
<label string="Asset Transference" attrs="{'invisible': [('maintenance_order_type','!=','asset_transference')]}"/> -->
<!-- <field name="maintenance_order_type" invisible="1"/> -->
<!-- <field name="maintenance_order_type"/> -->
<!-- </h1> -->
<!-- <field name="maintenance_order_type"/> -->
<h1>
<field name="name"/>
</h1>
<group col="2">
<group>
<field name="trans_date"/>
</group>
<group>
<field name='analytic_tag_ids' widget="many2many_tags"/>
</group>
</group>
<!-- <notebook colspan="4">
<page string="maintenance_order">
<group>
<group string='Assignment and location that sends'>
<field name="send_by_id"/>
<field name="send_objective" domain="[('customer', '=', True)]"/>
<field name="send_tag_ids" widget="many2many_tags"/>
</group>
<group string='Assignment and location that receives'>
<field name="rec_by_id"/>
<field name="rec_objective" domain="[('customer', '=', True)]"/>
<field name="rec_tag_ids" widget="many2many_tags"/>
</group>
</group>
</page>
<page string="maintenance_order Info" name="other_info">
<group col="2">
<group>
<field name="status"/>
<field name="doc_serialnr"/>
</group>
<group>
<field name="trans_date"/>
<field name="cancellation_date"/>
</group>
</group>
</page>
</notebook> -->
<field name="observations" placeholder="Observations"/>
</sheet>
</form>
</field>
</record>
<!-- VIEW ACTION -->
<record id="vitt_action_maintenance_order" model="ir.actions.act_window">
<field name="name">Maintenance Order</field>
<field name="res_model">maintenance.order</field>
<field name="view_type">form</field>
<field name="view_mode">tree,form</field>
<field eval="False" name="view_id"/>
<!-- <field name="domain">[('maintenance_order_type','=','asset_delivery')]</field>
<field name="context">{'maintenance_order_type': 'asset_delivery'}</field> -->
<!-- <field name="search_view_id" ref="view_account_maintenance_order_filter"/> -->
<field name="help" type="html">
<p class="oe_view_nocontent_create">
Click to record a new maintenance order.
</p><p>
<!-- You can control the maintenance_order from your vendor according to
what you purchased or received. -->
</p>
</field>
</record>
<!-- TREE VIEW ACTION-->
<record id="vitt_maintenance_order_tree_view" model="ir.actions.act_window.view">
<field eval="1" name="sequence"/>
<field name="view_mode">tree</field>
<field name="view_id" ref="maintenance_order_tree"/>
<field name="act_window_id" ref="vitt_action_maintenance_order"/>
</record>
<!-- FORM VIEW ACTION-->
<record id="vitt_maintenance_order_form_view" model="ir.actions.act_window.view">
<field eval="2" name="sequence"/>
<field name="view_mode">form</field>
<field name="view_id" ref="maintenance_order_form"/>
<field name="act_window_id" ref="vitt_action_maintenance_order"/>
</record>
<!-- MENU -->
<menuitem
id="vitt_menu_vitt_maintenance_order_form"
name="Maintenance Order"
parent="maintenance.menu_m_request"
action="vitt_action_maintenance_order"
sequence="3"/>
</data>
</odoo>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment