<?xml version="1.0" encoding="utf-8"?>
<openerp>
    <data>

        <record id="publisher_warranty_contract_tree_view" model="ir.ui.view">
            <field name="name">publisher_warranty.contract.tree</field>
            <field name="model">publisher_warranty.contract</field>
            <field name="type">tree</field>
            <field name="arch" type="xml">
                <tree string="Publisher Warranty Contracts">
                    <field name="name"/>
                    <field name="date_start"/>
                    <field name="date_stop"/>
                    <field name="state" />
                </tree>
            </field>
        </record>

        <record id="publisher_warranty_contract_form_view" model="ir.ui.view">
            <field name="name">publisher_warranty.contract.form</field>
            <field name="model">publisher_warranty.contract</field>
            <field name="type">form</field>
            <field name="arch" type="xml">
                <form string="Publisher Warranty Contract">
                    <group col="3" colspan="4">
                        <group col="2">
                            <field name="name"/>
                        </group>
                        <group col="2">
                            <field name="date_start"/>
                            <field name="date_stop"/>
                            <field name="check_support"/>
                        </group>
                        <group col="2">
                            <field name="state"/>
                            <field name="kind"/>
                            <field name="check_opw"/>
                        </group>
                        <group col="2" colspan="3">
                            <button name="check_validity" icon="camera_test.png
" string="Validate" type="object"
                            attrs="{'invisible':[('state','in',['valid', 'terminated', 'canceled'])]}"/>
                            <button name="check_validity" icon="camera_test.png" string="Refresh Validation Dates" type="object"
                            attrs="{'invisible':[('state','in',['unvalidated'])]}"/>
                        </group>
                    </group>
                </form>
            </field>
        </record>

        <record id="publisher_warranty_contract_search_view" model="ir.ui.view">
            <field name="name">publisher_warranty.contract.search</field>
            <field name="model">publisher_warranty.contract</field>
            <field name="type">search</field>
            <field name="arch" type="xml">
                <search string="Publisher Warranty Contract">
                    <field name="name"/>
                    <field name="date_start"/>
                    <field name="date_stop"/>
                </search>
            </field>
        </record>

        <record id="publisher_warranty_contract_view_calendar" model="ir.ui.view">
            <field name="name">publisher_warranty.contract.calendar</field>
            <field name="model">publisher_warranty.contract</field>
            <field name="type">calendar</field>
            <field name="arch" type="xml">
                <calendar string="Maintenance Contract" date_start="date_start" color="state">
                    <field name="name"/>
                    <field name="state"/>
                </calendar>
            </field>
        </record>

        <record id="action_publisher_warranty_contract_form" model="ir.actions.act_window">
            <field name="name">Contracts</field>
            <field name="type">ir.actions.act_window</field>
            <field name="res_model">publisher_warranty.contract</field>
            <field name="view_type">form</field>
            <field name="view_mode">tree,form,calendar</field>
            <field name="search_view_id" ref="publisher_warranty_contract_search_view"/>
        </record>

        <menuitem name="Publisher Warranty" id="publisher_warranty"
            parent="base.menu_administration"/>

        <menuitem action="action_publisher_warranty_contract_form" id="menu_publisher_warranty_contract"
            parent="publisher_warranty" sequence="2"/>


        <record id="publisher_warranty_contract_add_wizard" model="ir.ui.view">
            <field name="name">publisher_warranty.contract.add.wizard</field>
            <field name="model">publisher_warranty.contract.wizard</field>
            <field name="type">form</field>
            <field name="arch" type="xml">
                <form string="Register a Contract">
                    <group colspan="4" col="8">
                        <group colspan="1">
                            <field name="config_logo" widget="image" width="220" height="130" nolabel="1" colspan="1"/>
                            <newline/>
                            <label colspan="4" width="220" string="This wizard helps you register a publisher warranty contract in your OpenERP system. After the contract has been registered, you will be able to send issues directly to OpenERP."/>
                            <label colspan="4" width="220"/>
                            <label colspan="4" width="220" string=""/>
                            <field name="state" invisible="1"/>
                        </group>
                        <separator orientation="vertical" rowspan="12" colspan="1"/>
                        <group colspan="6">
                            <separator string="Register a Contract" colspan="4"/>
                            <group states="draft" colspan="4">
                                <label string="Please enter the serial key provided in your contract document:" colspan="4"/>
                                <field name="name" colspan="4"/>
                            </group>
                            <group states="finished" colspan="4">
                                <label string="Publisher warranty contract successfully registered!" colspan="4"/>
                            </group>
                        </group>
                    </group>
                        <group colspan="8" col="8" states="draft">
                            <separator string="" colspan="8"/>
                            <label colspan="6" width="220"/>
                            <button special="cancel" string="Cancel" icon="gtk-cancel" colspan="1"/>
                            <button name="action_validate" string="Register" type="object" icon="gtk-apply" colspan="1"/>
                        </group>
                        <group colspan="8" col="8" states="finished">
                            <separator string="" colspan="8"/>
                            <label colspan="7" width="220"/>
                            <button special="cancel" string="Close" icon="gtk-ok"/>
                        </group>
                </form>
            </field>
        </record>

        <record id="action_publisher_warranty_contract_add_wizard" model="ir.actions.act_window">
            <field name="name">Register a Contract</field>
            <field name="type">ir.actions.act_window</field>
            <field name="res_model">publisher_warranty.contract.wizard</field>
            <field name="view_type">form</field>
            <field name="view_mode">form</field>
            <field name="target">new</field>
        </record>

        <menuitem
            action="action_publisher_warranty_contract_add_wizard"
            id="menu_publisher_warranty_contract_add"
            parent="publisher_warranty" sequence="1"/>

    </data>
</openerp>
