<?xml version="1.0"?>
<tryton>
    <data>

        <record model="res.group" id="group_quality_control_admin">
            <field name="name">LIMS Quality Control Administration</field>
        </record>
        <record model="res.user-res.group" id="user_admin_group_quality_control_admin">
            <field name="user" ref="res.user_admin"/>
            <field name="group" ref="group_quality_control_admin"/>
        </record>
        <record model="res.group" id="group_quality_control">
            <field name="name">LIMS Quality Control</field>
        </record>
        <record model="res.user-res.group" id="user_admin_group_quality_control">
            <field name="user" ref="res.user_admin"/>
            <field name="group" ref="group_quality_control"/>
        </record>

        <record model="ir.rule.group" id="rule_group_quality_template">
            <field name="name">User in company</field>
            <field name="model" search="[('model', '=', 'lims.quality.template')]"/>
            <field name="global_p" eval="True"/>
        </record>
        <record model="ir.rule" id="rule_quality_template">
            <field name="domain"
                eval="[('company', '=', Eval('user', {}).get('company', -1))]"
                pyson="1"/>
            <field name="rule_group" ref="rule_group_quality_template"/>
        </record>

        <record model="ir.rule.group" id="rule_group_quality_test">
            <field name="name">User in company</field>
            <field name="model" search="[('model', '=', 'lims.quality.test')]"/>
            <field name="global_p" eval="True"/>
        </record>
        <record model="ir.rule" id="rule_quality_test">
            <field name="domain"
                eval="[('company', '=', Eval('user', {}).get('company', -1))]"
                pyson="1"/>
            <field name="rule_group" ref="rule_group_quality_test"/>
        </record>

        <record model="ir.ui.view" id="quality_qualitative_value_form_view">
            <field name="model">lims.quality.qualitative.value</field>
            <field name="type">form</field>
            <field name="name">quality_qualitative_value_form</field>
        </record>

        <record model="ir.ui.view" id="quality_qualitative_value_tree_view">
            <field name="model">lims.quality.qualitative.value</field>
            <field name="type">tree</field>
            <field name="name">quality_qualitative_value_tree</field>
        </record>

        <record model="ir.action.act_window" id="act_quality_qualitative_value">
            <field name="name">Quality Value</field>
            <field name="res_model">lims.quality.qualitative.value</field>
            <field name="search_value"></field>
        </record>

        <record model="ir.action.act_window.view" id="act_quality_qualitative_value_view1">
            <field name="sequence" eval="10"/>
            <field name="view" ref="quality_qualitative_value_tree_view"/>
            <field name="act_window" ref="act_quality_qualitative_value"/>
        </record>
        <record model="ir.action.act_window.view" id="act_quality_qualitative_value_view2">
            <field name="sequence" eval="20"/>
            <field name="view" ref="quality_qualitative_value_form_view"/>
            <field name="act_window" ref="act_quality_qualitative_value"/>
        </record>

        <record model="ir.model.access" id="access_quality_qualitative_value">
            <field name="model" search="[('model', '=', 'lims.quality.qualitative.value')]"/>
            <field name="perm_read" eval="True"/>
            <field name="perm_write" eval="False"/>
            <field name="perm_create" eval="False"/>
            <field name="perm_delete" eval="False"/>
        </record>
        <record model="ir.model.access" id="access_quality_qualitative_value_admin">
            <field name="model" search="[('model', '=', 'lims.quality.qualitative.value')]"/>
            <field name="group" ref="group_quality_control_admin"/>
            <field name="perm_read" eval="True"/>
            <field name="perm_write" eval="True"/>
            <field name="perm_create" eval="True"/>
            <field name="perm_delete" eval="True"/>
        </record>

        <record model="ir.model.button" id="quality_template_draft_button">
            <field name="name">draft</field>
            <field name="string">Reset to Draft</field>
            <field name="model" search="[('model', '=', 'lims.quality.template')]"/>
        </record>
        <record model="ir.model.button-res.group"
            id="quality_template_draft_button_group_quality_admin">
            <field name="button" ref="quality_template_draft_button"/>
            <field name="group" ref="group_quality_control_admin"/>
        </record>

        <record model="ir.model.button" id="quality_template_active_button">
            <field name="name">active</field>
            <field name="string">Activate</field>
            <field name="model" search="[('model', '=', 'lims.quality.template')]"/>
        </record>
        <record model="ir.model.button-res.group"
            id="quality_template_active_button_group_quality_admin">
            <field name="button" ref="quality_template_active_button"/>
            <field name="group" ref="group_quality_control_admin"/>
        </record>


        <record model="ir.model.button" id="quality_template_not_active_button">
            <field name="name">not_active</field>
            <field name="string">Deactivate</field>
            <field name="model" search="[('model', '=', 'lims.quality.template')]"/>
        </record>
        <record model="ir.model.button-res.group"
            id="quality_template_not_active_button_group_quality_admin">
            <field name="button" ref="quality_template_not_active_button"/>
            <field name="group" ref="group_quality_control_admin"/>
        </record>

        <record model="ir.ui.view" id="quality_template_form_view">
            <field name="model">lims.quality.template</field>
            <field name="type">form</field>
            <field name="name">quality_template_form</field>
        </record>

        <record model="ir.ui.view" id="quality_template_tree_view">
            <field name="model">lims.quality.template</field>
            <field name="type">tree</field>
            <field name="name">quality_template_tree</field>
        </record>

        <record model="ir.action.act_window" id="act_quality_template">
            <field name="name">Quality Template</field>
            <field name="res_model">lims.quality.template</field>
            <field name="search_value"></field>
        </record>
        <record model="ir.action.act_window.view" id="act_quality_template_view1">
            <field name="sequence" eval="10"/>
            <field name="view" ref="quality_template_tree_view"/>
            <field name="act_window" ref="act_quality_template"/>
        </record>
        <record model="ir.action.act_window.view" id="act_quality_template_view2">
            <field name="sequence" eval="20"/>
            <field name="view" ref="quality_template_form_view"/>
            <field name="act_window" ref="act_quality_template"/>
        </record>
        <record model="ir.action.act_window.domain" id="act_quality_template_domain_draft">
            <field name="name">Draft</field>
            <field name="sequence" eval="10"/>
            <field name="domain"
                eval="[('state', '=', 'draft')]"
                pyson="1"/>
            <field name="act_window" ref="act_quality_template"/>
        </record>
        <record model="ir.action.act_window.domain" id="act_quality_template_domain_active">
            <field name="name">Active</field>
            <field name="sequence" eval="20"/>
            <field name="domain"
                eval="[('state', '=', 'active')]"
                pyson="1"/>
            <field name="act_window" ref="act_quality_template"/>
        </record>
        <record model="ir.action.act_window.domain" id="act_quality_template_domain_not_active">
            <field name="name">Not Active</field>
            <field name="sequence" eval="30"/>
            <field name="domain"
                eval="[('state', '=', 'not_active')]"
                pyson="1"/>
            <field name="act_window" ref="act_quality_template"/>
        </record>
        <record model="ir.action.act_window.domain" id="act_quality_template_domain_all">
            <field name="name">All</field>
            <field name="sequence" eval="9999"/>
            <field name="domain"></field>
            <field name="act_window" ref="act_quality_template"/>
        </record>

        <record model="ir.model.access" id="access_quality_template">
            <field name="model" search="[('model', '=', 'lims.quality.template')]"/>
            <field name="perm_read" eval="True"/>
            <field name="perm_write" eval="False"/>
            <field name="perm_create" eval="False"/>
            <field name="perm_delete" eval="False"/>
        </record>
        <record model="ir.model.access" id="access_quality_template_admin">
            <field name="model" search="[('model', '=', 'lims.quality.template')]"/>
            <field name="group" ref="group_quality_control_admin"/>
            <field name="perm_read" eval="True"/>
            <field name="perm_write" eval="True"/>
            <field name="perm_create" eval="True"/>
            <field name="perm_delete" eval="True"/>
        </record>

        <record model="ir.ui.view" id="quality_test_form_view">
            <field name="model">lims.quality.test</field>
            <field name="type">form</field>
            <field name="name">quality_test_form</field>
        </record>

        <record model="ir.ui.view" id="quality_test_tree_view">
            <field name="model">lims.quality.test</field>
            <field name="type">tree</field>
            <field name="name">quality_test_tree</field>
        </record>

        <record model="ir.action.act_window" id="act_quality_test">
            <field name="name">Quality Test</field>
            <field name="res_model">lims.quality.test</field>
            <field name="search_value"></field>
        </record>
        <record model="ir.action.act_window.view" id="act_quality_test_view1">
            <field name="sequence" eval="10"/>
            <field name="view" ref="quality_test_tree_view"/>
            <field name="act_window" ref="act_quality_test"/>
        </record>
        <record model="ir.action.act_window.view" id="act_quality_test_view2">
            <field name="sequence" eval="20"/>
            <field name="view" ref="quality_test_form_view"/>
            <field name="act_window" ref="act_quality_test"/>
        </record>
        <record model="ir.action.act_window.domain" id="act_quality_test_domain_draft">
            <field name="name">Draft</field>
            <field name="sequence" eval="10"/>
            <field name="domain"
                eval="[('state', '=', 'draft')]"
                pyson="1"/>
            <field name="act_window" ref="act_quality_test"/>
        </record>
        <record model="ir.action.act_window.domain" id="act_quality_test_domain_confirmed">
            <field name="name">Confirmed</field>
            <field name="sequence" eval="20"/>
            <field name="domain"
                eval="[('state', '=', 'confirmed')]"
                pyson="1"/>
            <field name="act_window" ref="act_quality_test"/>
        </record>
        <record model="ir.action.act_window.domain" id="act_quality_test_domain_successful">
            <field name="name">Successful</field>
            <field name="sequence" eval="30"/>
            <field name="domain"
                eval="[('state', '=', 'successful')]"
                pyson="1"/>
            <field name="act_window" ref="act_quality_test"/>
        </record>
        <record model="ir.action.act_window.domain" id="act_quality_test_domain_failed">
            <field name="name">Failed</field>
            <field name="sequence" eval="40"/>
            <field name="domain"
                eval="[('state', '=', 'failed')]"
                pyson="1"/>
            <field name="act_window" ref="act_quality_test"/>
        </record>
        <record model="ir.action.act_window.domain" id="act_quality_test_domain_all">
            <field name="name">All</field>
            <field name="sequence" eval="9999"/>
            <field name="domain"></field>
            <field name="act_window" ref="act_quality_test"/>
        </record>

        <record model="ir.model.access" id="access_quality_test">
            <field name="model" search="[('model', '=', 'lims.quality.test')]"/>
            <field name="perm_read" eval="True"/>
            <field name="perm_write" eval="False"/>
            <field name="perm_create" eval="False"/>
            <field name="perm_delete" eval="False"/>
        </record>
        <record model="ir.model.access" id="access_quality_test_quality">
            <field name="model" search="[('model', '=', 'lims.quality.test')]"/>
            <field name="group" ref="group_quality_control"/>
            <field name="perm_read" eval="True"/>
            <field name="perm_write" eval="True"/>
            <field name="perm_create" eval="False"/>
            <field name="perm_delete" eval="False"/>
        </record>
        <record model="ir.model.access" id="access_quality_test_admin">
            <field name="model" search="[('model', '=', 'lims.quality.test')]"/>
            <field name="group" ref="group_quality_control_admin"/>
            <field name="perm_read" eval="True"/>
            <field name="perm_write" eval="True"/>
            <field name="perm_create" eval="True"/>
            <field name="perm_delete" eval="True"/>
        </record>

        <record model="ir.sequence.type" id="sequence_type_quality">
            <field name="name">Quality Control</field>
            <field name="code">lims.quality.test</field>
        </record>

        <record model="ir.sequence.type-res.group"
            id="sequence_type_quality_group_admin">
            <field name="sequence_type" ref="sequence_type_quality"/>
            <field name="group" ref="res.group_admin"/>
        </record>
        <record model="ir.sequence.type-res.group"
            id="sequence_type_quality_group_quality_admin">
            <field name="sequence_type" ref="sequence_type_quality"/>
            <field name="group" ref="group_quality_control"/>
        </record>

        <record model="ir.sequence" id="sequence_quality">
            <field name="name">Quality Control</field>
            <field name="code">lims.quality.test</field>
        </record>

        <record model="ir.model.button" id="quality_draft_button">
            <field name="name">draft</field>
            <field name="string">Reset to Draft</field>
            <field name="model" search="[('model', '=', 'lims.quality.test')]"/>
        </record>
        <record model="ir.model.button-res.group"
            id="quality_draft_button_group_quality_admin">
            <field name="button" ref="quality_draft_button"/>
            <field name="group" ref="group_quality_control_admin"/>
        </record>

        <record model="ir.model.button" id="quality_confirm_button">
            <field name="name">confirm</field>
            <field name="string">Confirm</field>
            <field name="model" search="[('model', '=', 'lims.quality.test')]"/>
        </record>
        <record model="ir.model.button-res.group"
            id="quality_confirm_button_group_quality">
            <field name="button" ref="quality_confirm_button"/>
            <field name="group" ref="group_quality_control"/>
        </record>

        <record model="ir.model.button" id="quality_manager_validate_button">
            <field name="name">manager_validate</field>
            <field name="string">Validate</field>
            <field name="model" search="[('model', '=', 'lims.quality.test')]"/>
        </record>
        <record model="ir.model.button-res.group"
            id="quality_manager_validate_button_group_quality_admin">
            <field name="button" ref="quality_manager_validate_button"/>
            <field name="group" ref="group_quality_control_admin"/>
        </record>

        <record model="ir.model.button" id="quality_cancel_button">
            <field name="name">cancel</field>
            <field name="model" search="[('model', '=', 'lims.quality.test')]"/>
        </record>
        <record model="ir.model.button-res.group"
            id="quality_cancel_button_group_quality">
            <field name="button" ref="quality_cancel_button"/>
            <field name="group" ref="group_quality_control"/>
        </record>

        <record model="ir.model.button" id="quality_apply_templates_button">
            <field name="name">apply_templates</field>
            <field name="string">Apply Templates</field>
            <field name="confirm">Applying templates will remove any data already introduced in the test. Are you sure you want to apply templates?</field>
            <field name="model" search="[('model', '=', 'lims.quality.test')]"/>
        </record>
        <record model="ir.model.button-res.group"
            id="quality_apply_templates_button_group_quality_admin">
            <field name="button" ref="quality_apply_templates_button"/>
            <field name="group" ref="group_quality_control_admin"/>
        </record>

        <menuitem id="menu_quality_control" name="Quality Control"
            sequence="1" />
        <record model="ir.ui.menu-res.group" id="menu_quality_group_quality">
            <field name="menu" ref="menu_quality_control"/>
            <field name="group" ref="group_quality_control"/>
        </record>

        <menuitem name="Configuration" parent="menu_quality_control"
            id="menu_configuration"
            sequence="0" icon="tryton-settings"/>
        <record model="ir.ui.menu-res.group" id="menu_quality_configuration_group_quality_admin">
            <field name="menu" ref="menu_configuration"/>
            <field name="group" ref="group_quality_control_admin"/>
        </record>

        <menuitem action="act_quality_template" id="menu_quality_template"
            parent="menu_quality_control" sequence="10" name="Templates"/>

        <menuitem action="act_quality_test" id="menu_quality_test"
            parent="menu_quality_control" sequence="20" name="Tests"/>

        <record model="ir.ui.view" id="lims_create_quality_test_start_view_form">
            <field name="model">lims.create.quality.test.start</field>
            <field name="type">form</field>
            <field name="name">create_quality_test_start_form</field>
        </record>

        <record model="ir.action.wizard" id="wiz_lims_create_quality_test">
            <field name="name">Create Quality Test</field>
            <field name="wiz_name">lims.create.quality.test</field>
            <field name="model">lims.sample</field>
        </record>
        <record model="ir.action.keyword" id="lims_create_quality_test_keyword">
            <field name="keyword">form_action</field>
            <field name="model">lims.sample,-1</field>
            <field name="action" ref="wiz_lims_create_quality_test"/>
        </record>

        <record model="ir.ui.view" id="lims_template_add_service_start_view_form">
            <field name="model">lims.template.add.service.start</field>
            <field name="type">form</field>
            <field name="name">add_service_start_form</field>
        </record>

        <record model="ir.action.wizard" id="wiz_lims_template_add_service">
            <field name="name">Add Service</field>
            <field name="wiz_name">lims.template.add.service</field>
            <field name="model">lims.quality.template</field>
        </record>
        <record model="ir.action.keyword" id="lims_template_add_service_keyword">
            <field name="keyword">form_action</field>
            <field name="model">lims.quality.template,-1</field>
            <field name="action" ref="wiz_lims_template_add_service"/>
        </record>

        <record model="ir.action.wizard" id="wiz_lims_test_results_report">
            <field name="name">Test Results Reports</field>
            <field name="wiz_name">lims.test.results_report</field>
        </record>
        <record model="ir.action.keyword" id="lims_test_results_report_keyword">
            <field name="keyword">form_relate</field>
            <field name="model">lims.quality.test,-1</field>
            <field name="action" ref="wiz_lims_test_results_report"/>
        </record>

        <record model="ir.action.wizard" id="wiz_print_test">
            <field name="name">Test Report</field>
            <field name="wiz_name">lims.print_test</field>
        </record>
        <record model="ir.action.keyword" id="print_test_keyword">
            <field name="keyword">form_print</field>
            <field name="model">lims.quality.test,-1</field>
            <field name="action" ref="wiz_print_test"/>
        </record>

        <record model="ir.action.report" id="report_test">
            <field name="name">Test Report</field>
            <field name="model">lims.quality.test</field>
            <field name="report_name">lims.quality.control.report</field>
            <field name="report">lims_quality_control/report/test_report.fodt</field>
            <field name="extension">pdf</field>
        </record>

    </data>
</tryton>
