<openerp>
<data>
    <menuitem name="Document Management" icon="terp-stock" id="menu_document"/>
    <menuitem name="Document Configuration" id="menu_document_configuration" parent="menu_document"/>

    <record model="ir.ui.view" id="view_document_directory_form">
        <field name="name">document.directory</field>
        <field name="model">document.directory</field>
        <field name="type">form</field>
        <field name="arch" type="xml">
            <form string="Directories">
                <field name="name" select="1" colspan="4"/>
                <field name="user_id"/>
                <field name="parent_id"/>
                <notebook colspan="4">
                <page string="Definition">
                    <separator string="Directory Type" colspan="4"/>
                    <field name="type"/>
                    <field name="ressource_type_id"  on_change="onchange_content_id(ressource_type_id)" attrs="{'required': [('type','=','ressource')], 'readonly': [('type','=','static')]}"/>
                    <newline/>
                    <field name="domain" attrs="{'required': [('type','=','ressource')], 'readonly': [('type','=','static')]}"/>
                    <field name="ressource_tree"/>
                    <field name="ressource_id" select="2" readonly="1"/>
                    <field name="ressource_parent_type_id"/>

                    <separator string="Auto-Generated Files" colspan="4"/>
                    <field name="content_ids" nolabel="1" colspan="4">
                        <form string="Contents">
                            <field name="name"/>
                            <field name="sequence"/>
                            <field name="suffix"/>
                            <field name="extension"/>
                            <field name="include_name"/>
                            <separator string="PDF Report" colspan="4"/>
                            <field name="report_id" domain="[('model_id','=',parent.ressource_type_id)]"/>
                        </form>
                        <tree string="Contents">
                            <field name="sequence" string="Seq."/>
                            <field name="name"/>
                            <field name="suffix"/>
                            <field name="extension"/>
                        </tree>
                    </field>
                </page><page string="Security">
                    <field name="group_ids" colspan="4" nolabel="1"/>
                </page>
                </notebook>
            </form>
        </field>
    </record>
    <record model="ir.ui.view" id="view_document_directory_tree">
        <field name="name">document.directory</field>
        <field name="model">document.directory</field>
        <field name="type">tree</field>
        <field name="field_parent">child_ids</field>
        <field name="arch" type="xml">
            <tree string="Directories" toolbar="1">
                <field name="name"/>
                <field name="type"/>
                <field name="user_id"/>
                <field name="create_date"/>
                <field name="write_date"/>
            </tree>
        </field>
    </record>

    <record model="ir.actions.act_window" id="action_document_directory_form">
        <field name="type">ir.actions.act_window</field>
        <field name="res_model">document.directory</field>
        <field name="view_type">form</field>
        <field name="view_mode">tree,form</field>
    </record>
    <menuitem
        name="Directories"
        action="action_document_directory_form"
        id="menu_document_directories"
        parent="menu_document_configuration"/>


    <record model="ir.actions.act_window" id="action_document_directory_tree">
        <field name="type">ir.actions.act_window</field>
        <field name="name">Directorie's Structure</field>
        <field name="res_model">document.directory</field>
        <field name="view_type">tree</field>
        <field name="domain">[('ressource_parent_type_id','=',False),('parent_id','=',False)]</field>
    </record>
    <menuitem
        action="action_document_directory_tree"
        id="menu_document_directories_tree"
        parent="menu_document_configuration"/>
        
	<wizard id="wizard_document_browse" name="browse.file.ftp" string="Browse Files Using FTP"/>
    <menuitem
        name="Browse Files Using FTP"
        action="wizard_document_browse"
        id="menu_document_browse"
        type="wizard"
        icon="STOCK_EXECUTE"
        parent="menu_document"/>

    <record model="ir.ui.view" id="view_document_file_form">
        <field name="name">ir.attachment</field>
        <field name="model">ir.attachment</field>
        <field name="priority" eval="1"/>
        <field name="type">form</field>
        <field name="arch" type="xml">
            <form string="Files">
                <group colspan="4" col="6">
                    <field name="name" select="1" />
                    <field name="title" select="1"/>
                    <field name="partner_id"/>
                    <field name="user_id"/>
                    <field name="create_uid" select="2"/>
                    <field name="create_date" select="2"/>
                </group>
                <notebook colspan="4">
                <page string="Attachment">
                    <group col="2" colspan="2">
                        <separator string="Data" colspan="2"/>
                        <field name="datas" filename="datas_fname"/>
                        <field name="datas_fname" select="1"/>
                    </group>
                    <group col="2" colspan="2">
                        <separator string="Attached To" colspan="2"/>
                        <field name="res_model" select="2" readonly="1"/>
                        <field name="res_id" readonly="1"/>
                    </group>
                    <separator string="Preview" colspan="4"/>
                    <field
                        name="preview"
                        widget="image"
                        readonly="1"
                        nolabel="1"
                        colspan="4"
                        img_height="400"
                        img_width="800"/>

                </page><page string="Indexed Content">
                    <field name="index_content" nolabel="1" colspan="4" select="1"/>
                </page><page string="Security">
                    <field name="group_ids" colspan="4" nolabel="1"/>
                </page><page string="Others Info">
                    <group colspan="2" col="2">
                        <separator string="History" colspan="2"/>
                        <field name="write_date"/>
                        <field name="write_uid"/>
                    </group>
                    <group colspan="2" col="2">
                        <separator string="File Information" colspan="2"/>
                        <field name="file_size" readonly="1"/>
                        <field name="parent_id" readonly="1" select="2"/>
                    </group>
                </page><page string="Notes">
                    <field colspan="4" name="description" nolabel="1"/>
                </page>
                </notebook>
            </form>
        </field>
    </record>
    <record model="ir.ui.view" id="view_document_file_tree">
        <field name="name">ir.attachment</field>
        <field name="model">ir.attachment</field>
        <field name="type">tree</field>
        <field name="priority" eval="1"/>
        <field name="arch" type="xml">
            <tree string="Files">
                <field name="name"/>
                <field name="title" />
                <field name="partner_id"/>
                <field name="datas_fname"/>
                <field name="user_id"/>
                <field name="create_date"/>
                <field name="write_date"/>
            </tree>
        </field>
    </record>

    <record model="ir.actions.act_window" id="action_document_file_form">
        <field name="type">ir.actions.act_window</field>
        <field name="res_model">ir.attachment</field>
        <field name="view_type">form</field>
    </record>
    <menuitem
        name="Search a File"
        action="action_document_file_form"
        id="menu_document_files"
        parent="menu_document"/>

    <record model="ir.actions.act_window" id="action_document_file_directory_form">
        <field name="type">ir.actions.act_window</field>
        <field name="res_model">ir.attachment</field>
        <field name="view_type">form</field>
        <field name="domain">[('parent_id','=',active_id)]</field>
        <field name="context">{'parent_id':'active_id'}</field>
    </record>

    <record model="ir.values" id="ir_action_document_file_directory_form">
        <field name="key2" eval="'tree_but_open'"/>
        <field name="model" eval="'document.directory'"/>
        <field name="name">Browse Files</field>
        <field name="value" eval="'ir.actions.act_window,%d'%action_document_file_directory_form"/>
        <field name="object" eval="True"/>
    </record>

    <record model="ir.ui.view" id="view_attachment_form_inherit">
        <field name="name">ir.attachment.view.inherit</field>
        <field name="model">ir.attachment</field>
        <field name="inherit_id" ref="base.view_attachment_form"/>
        <field name="arch" type="xml">
            <field name="datas_fname" position = "replace" >
            </field>
        </field>
    </record>

    <record model="ir.ui.view" id="view_process_node_form_inherit1">
        <field name="name">process.node.form</field>
        <field name="model">process.node</field>
            <field name="type">form</field>
            <field name="inherit_id" ref="process.view_process_node_form"/>
        <field name="priority" eval="1"/>
        <field name="arch" type="xml">
            <field name="subflow_id" position="after">
                <field name="directory_id" domain="[('ressource_type_id','=',model_id),('ressource_parent_type_id','=',False)]"/>
                <newline/>
            </field>
        </field>
    </record>

    <record model="ir.ui.view" id="view_process_form_inherit1">
        <field name="name">process.process.form</field>
        <field name="model">process.process</field>
            <field name="type">form</field>
            <field name="inherit_id" ref="process.view_process_form"/>
        <field name="priority" eval="1"/>
        <field name="arch" type="xml">
            <field name="subflow_id" position="after">
                <field name="directory_id" domain="[('ressource_type_id','=',model_id),('ressource_parent_type_id','=',False)]"/>
                <newline/>
            </field>
        </field>
    </record>


        <record id="view_auto_config_form" model="ir.ui.view">
            <field name="name">Auto Configure Directory</field>
            <field name="model">document.configuration.wizard</field>
            <field name="type">form</field>
            <field name="arch" type="xml">
                <form string="Auto Configure">
                    <separator string="Document Management System." colspan="4"/>
                    <label string="This wizard will automatically configure the document management system according to modules installed on your system." align="0.0" colspan="4"/>
                    <field name="host" colspan="4"/>
                    <separator string="" colspan="4"/>
                    <label string="" colspan="2"/>
                    <group col="4" colspan="2">
                        <button special="cancel" string="Cancel" name="action_cancel" type="object" icon='gtk-cancel'/>
                        <button name="action_config" string="Configure" icon='gtk-ok' type="object"/>
                    </group>
                </form>
            </field>
        </record>

        <record id="action_config_auto_directory" model="ir.actions.act_window">
            <field name="name">Auto Configure Directory</field>
            <field name="type">ir.actions.act_window</field>
            <field name="res_model">document.configuration.wizard</field>
            <field name="view_type">form</field>
            <field name="view_mode">form</field>
            <field name="target">new</field>
        </record>

        <record model="ir.actions.todo" id="config_auto_directory">
            <field name="name">Auto Configure Directory</field>
            <field name="note">This wizard will configure the URL of the server of the document management system.</field>
            <field name="action_id" ref="action_config_auto_directory"/>
        </record>

</data>
</openerp>

