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

        <record model="ir.ui.icon" id="laboratory_reports_icon">
            <field name="name">lims-laboratory_reports</field>
            <field name="path">icons/laboratory_reports.svg</field>
        </record>
        <record model="ir.ui.icon" id="generate_results_report_icon">
            <field name="name">lims-generate_results_report</field>
            <field name="path">icons/generate_results_report.svg</field>
        </record>
        <record model="ir.ui.icon" id="results_report_version_detail_icon">
            <field name="name">lims-results_report_version_detail</field>
            <field name="path">icons/results_report_version_detail.svg</field>
        </record>

<!-- Sequences for Results Report -->

        <record model="ir.sequence.type" id="seq_type_results_report">
            <field name="name">Results Report</field>
            <field name="code">lims.results_report</field>
        </record>
        <record model="ir.sequence.type-res.group"
            id="seq_type_results_report_group_admin">
            <field name="sequence_type" ref="seq_type_results_report"/>
            <field name="group" ref="res.group_admin"/>
        </record>

<!-- Results Report -->

        <record model="ir.ui.view" id="lims_results_report_view_list">
            <field name="model">lims.results_report</field>
            <field name="type">tree</field>
            <field name="name">results_report_list</field>
        </record>
        <record model="ir.ui.view" id="lims_results_report_view_form">
            <field name="model">lims.results_report</field>
            <field name="type">form</field>
            <field name="name">results_report_form</field>
        </record>

        <record model="ir.action.act_window" id="act_lims_results_report">
            <field name="name">Results Reports</field>
            <field name="res_model">lims.results_report</field>
        </record>
        <record model="ir.action.act_window.view" id="act_lims_results_report_view_list">
            <field name="sequence" eval="10"/>
            <field name="view" ref="lims_results_report_view_list"/>
            <field name="act_window" ref="act_lims_results_report"/>
        </record>
        <record model="ir.action.act_window.view" id="act_lims_results_report_view_form">
            <field name="sequence" eval="20"/>
            <field name="view" ref="lims_results_report_view_form"/>
            <field name="act_window" ref="act_lims_results_report"/>
        </record>

<!-- Results Report Version -->

        <record model="ir.ui.view" id="lims_results_report_version_view_list">
            <field name="model">lims.results_report.version</field>
            <field name="type">tree</field>
            <field name="name">results_report_version_list</field>
        </record>
        <record model="ir.ui.view" id="lims_results_report_version_view_form">
            <field name="model">lims.results_report.version</field>
            <field name="type">form</field>
            <field name="name">results_report_version_form</field>
        </record>

        <record model="ir.rule.group" id="rule_group_results_report_version">
            <field name="name">User in laboratory</field>
            <field name="model" search="[('model', '=', 'lims.results_report.version')]"/>
            <field name="global_p" eval="True"/>
        </record>
        <record model="ir.rule" id="rule_results_report_version">
            <field name="domain"
                eval="[If(Bool(Eval('user', {}).get('laboratory', False)), ('laboratory', '=', Eval('user', {}).get('laboratory', None)), If(Bool(Eval('user', {}).get('laboratories', False)), ('laboratory', 'in', Eval('user', {}).get('laboratories', [])), ('id', '!=', 0)))]"
                pyson="1"/>
            <field name="rule_group" ref="rule_group_results_report_version"/>
        </record>

<!-- Results Report Version Detail -->

        <record model="ir.ui.view" id="lims_results_report_version_detail_view_list">
            <field name="model">lims.results_report.version.detail</field>
            <field name="type">tree</field>
            <field name="name">results_report_version_detail_list</field>
        </record>
        <record model="ir.ui.view" id="lims_results_report_version_detail_view_form">
            <field name="model">lims.results_report.version.detail</field>
            <field name="type">form</field>
            <field name="name">results_report_version_detail_form</field>
        </record>

        <record model="ir.action.act_window" id="act_lims_results_report_version_detail">
            <field name="name">Approval of Reports</field>
            <field name="res_model">lims.results_report.version.detail</field>
        </record>
        <record model="ir.action.act_window.view" id="act_lims_results_report_version_detail_view_list">
            <field name="sequence" eval="10"/>
            <field name="view" ref="lims_results_report_version_detail_view_list"/>
            <field name="act_window" ref="act_lims_results_report_version_detail"/>
        </record>
        <record model="ir.action.act_window.view" id="act_lims_results_report_version_detail_view_form">
            <field name="sequence" eval="20"/>
            <field name="view" ref="lims_results_report_version_detail_view_form"/>
            <field name="act_window" ref="act_lims_results_report_version_detail"/>
        </record>

        <record model="ir.rule.group" id="rule_group_results_report_version_detail">
            <field name="name">User in laboratory</field>
            <field name="model" search="[('model', '=', 'lims.results_report.version.detail')]"/>
            <field name="global_p" eval="True"/>
        </record>
        <record model="ir.rule" id="rule_results_report_version_detail">
            <field name="domain"
                eval="[If(Bool(Eval('user', {}).get('laboratory', False)), ('laboratory', '=', Eval('user', {}).get('laboratory', None)), If(Bool(Eval('user', {}).get('laboratories', False)), ('laboratory', 'in', Eval('user', {}).get('laboratories', [])), ('id', '!=', 0)))]"
                pyson="1"/>
            <field name="rule_group" ref="rule_group_results_report_version_detail"/>
        </record>

<!-- Results Report Version Detail Line -->

        <record model="ir.ui.view" id="lims_results_report_version_detail_line_view_list">
            <field name="model">lims.results_report.version.detail.line</field>
            <field name="type">tree</field>
            <field name="name">results_report_version_detail_line_list</field>
        </record>
        <record model="ir.ui.view" id="lims_results_report_version_detail_line_view_form">
            <field name="model">lims.results_report.version.detail.line</field>
            <field name="type">form</field>
            <field name="name">results_report_version_detail_line_form</field>
        </record>

<!-- Wizard Divide Reports -->

        <record model="ir.ui.view" id="lims_divide_reports_result_view_form">
            <field name="model">lims.divide_reports.result</field>
            <field name="type">form</field>
            <field name="name">service_divide_reports_result_form</field>
        </record>
        <record model="ir.ui.view" id="lims_divide_reports_process_view_form">
            <field name="model">lims.divide_reports.process</field>
            <field name="type">form</field>
            <field name="name">service_divide_reports_process_form</field>
        </record>
        <record model="ir.ui.view" id="lims_divide_reports_detail_view_form">
            <field name="model">lims.divide_reports.detail</field>
            <field name="type">form</field>
            <field name="name">service_divide_reports_detail_form</field>
        </record>
        <record model="ir.ui.view" id="lims_divide_reports_detail_view_list">
            <field name="model">lims.divide_reports.detail</field>
            <field name="type">tree</field>
            <field name="name">service_divide_reports_detail_list</field>
        </record>

        <record model="ir.action.wizard" id="wiz_lims_divide_reports">
            <field name="name">Divide Reports</field>
            <field name="wiz_name">lims.divide_reports</field>
        </record>
        <record model="ir.action.keyword" id="lims_divide_reports_keyword">
            <field name="keyword">form_action</field>
            <field name="model">lims.entry,-1</field>
            <field name="action" ref="wiz_lims_divide_reports"/>
        </record>

        <record model="ir.model.field.access" id="access_divide_reports_process_analysis_detail">
            <field name="field"
                search="[('name', '=', 'analysis_detail'), ('model.model', '=', 'lims.divide_reports.process')]"/>
            <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>

<!-- Wizard Generate Results Reports -->

        <record model="ir.ui.view" id="lims_generate_results_report_start_view_form">
            <field name="model">lims.generate_results_report.start</field>
            <field name="type">form</field>
            <field name="name">generate_results_report_start_form</field>
        </record>
        <record model="ir.ui.view" id="lims_generate_results_report_empty_view_form">
            <field name="model">lims.generate_results_report.empty</field>
            <field name="type">form</field>
            <field name="name">generate_results_report_empty_form</field>
        </record>
        <record model="ir.ui.view" id="lims_generate_results_report_result_aut_view_form">
            <field name="model">lims.generate_results_report.result_aut</field>
            <field name="type">form</field>
            <field name="name">generate_results_report_result_aut_form</field>
        </record>
        <record model="ir.ui.view" id="lims_generate_results_report_result_man_view_form">
            <field name="model">lims.generate_results_report.result_man</field>
            <field name="type">form</field>
            <field name="name">generate_results_report_result_man_form</field>
        </record>

        <record model="ir.ui.view" id="lims_generate_results_report_result_aut_notebook_view_list">
            <field name="model">lims.generate_results_report.aut.notebook</field>
            <field name="type">tree</field>
            <field name="name">generate_results_report_result_aut_notebook_list</field>
        </record>
        <record model="ir.ui.view" id="lims_generate_results_report_result_aut_notebook_view_form">
            <field name="model">lims.generate_results_report.aut.notebook</field>
            <field name="type">form</field>
            <field name="name">generate_results_report_result_aut_notebook_form</field>
        </record>

        <record model="ir.ui.view" id="lims_generate_results_report_result_aut_excluded_notebook_view_list">
            <field name="model">lims.generate_results_report.aut.excluded_notebook</field>
            <field name="type">tree</field>
            <field name="name">generate_results_report_result_aut_excluded_notebook_list</field>
        </record>
        <record model="ir.ui.view" id="lims_generate_results_report_result_aut_excluded_notebook_view_form">
            <field name="model">lims.generate_results_report.aut.excluded_notebook</field>
            <field name="type">form</field>
            <field name="name">generate_results_report_result_aut_excluded_notebook_form</field>
        </record>

        <record model="ir.action.wizard" id="wiz_lims_generate_results_report">
            <field name="name">Generate Reports</field>
            <field name="wiz_name">lims.generate_results_report</field>
        </record>

        <record model="ir.ui.view" id="lims_notebook_line_generate_results_view_list">
            <field name="model">lims.notebook.line</field>
            <field name="type">tree</field>
            <field name="name">notebook_line_generate_results_list</field>
        </record>

<!-- Wizard Print Global Results Report -->

        <record model="ir.action.wizard" id="wiz_lims_print_results_report">
            <field name="name">Print Global Report</field>
            <field name="wiz_name">lims.print_results_report</field>
        </record>
        <record model="ir.action.keyword" id="lims_print_results_report_keyword">
            <field name="keyword">form_print</field>
            <field name="model">lims.results_report,-1</field>
            <field name="action" ref="wiz_lims_print_results_report"/>
        </record>

<!-- Wizard Service Results Report -->

        <record model="ir.action.wizard" id="wiz_lims_service_results_report">
            <field name="name">Service Results Reports</field>
            <field name="wiz_name">lims.service.results_report</field>
        </record>
        <record model="ir.action.keyword" id="lims_service_results_report_keyword">
            <field name="keyword">form_relate</field>
            <field name="model">lims.service,-1</field>
            <field name="action" ref="wiz_lims_service_results_report"/>
        </record>

<!-- Wizard Fraction Results Report -->

        <record model="ir.action.wizard" id="wiz_lims_fraction_results_report">
            <field name="name">Fraction Results Reports</field>
            <field name="wiz_name">lims.fraction.results_report</field>
        </record>
        <record model="ir.action.keyword" id="lims_fraction_results_report_keyword">
            <field name="keyword">form_relate</field>
            <field name="model">lims.fraction,-1</field>
            <field name="action" ref="wiz_lims_fraction_results_report"/>
        </record>

<!-- Wizard Sample Results Report -->

        <record model="ir.action.wizard" id="wiz_lims_sample_results_report">
            <field name="name">Sample Results Reports</field>
            <field name="wiz_name">lims.sample.results_report</field>
        </record>
        <record model="ir.action.keyword" id="lims_sample_results_report_keyword">
            <field name="keyword">form_relate</field>
            <field name="model">lims.sample,-1</field>
            <field name="action" ref="wiz_lims_sample_results_report"/>
        </record>

<!-- Wizard Results Report Sample -->

        <record model="ir.action.wizard" id="wiz_lims_results_report_sample">
            <field name="name">Results Report Samples</field>
            <field name="wiz_name">lims.results_report.sample</field>
        </record>
        <record model="ir.action.keyword" id="lims_results_report_sample_keyword">
            <field name="keyword">form_relate</field>
            <field name="model">lims.results_report,-1</field>
            <field name="action" ref="wiz_lims_results_report_sample"/>
        </record>

<!-- Wizard Report Annulation -->

        <record model="ir.ui.view" id="lims_results_report_annulation_start_view_form">
            <field name="model">lims.results_report_annulation.start</field>
            <field name="type">form</field>
            <field name="name">results_report_annulation_form</field>
        </record>

        <record model="ir.action.wizard" id="wiz_lims_results_report_annulation">
            <field name="name">Report Annulation</field>
            <field name="wiz_name">lims.results_report_annulation</field>
        </record>

<!-- Results Report -->

        <record model="ir.action.report" id="report_results_report">
            <field name="name">Results Report</field>
            <field name="model">lims.results_report.version.detail</field>
            <field name="report_name">lims.result_report</field>
            <field name="report">lims/report/results_report.fodt</field>
            <field name="extension">pdf</field>
        </record>
        <record model="ir.action.keyword" id="report_results_report_keyword">
            <field name="keyword">form_print</field>
            <field name="model">lims.results_report.version.detail,-1</field>
            <field name="action" ref="report_results_report"/>
        </record>

<!-- Transcription Results Report -->

        <record model="ir.action.report" id="report_results_report_transcription">
            <field name="name">Transcription Results Report</field>
            <field name="model">lims.results_report.version.detail</field>
            <field name="report_name">lims.result_report.transcription</field>
            <field name="report">lims/report/results_report.fodt</field>
            <field name="extension">pdf</field>
        </record>
        <record model="ir.action.keyword" id="report_results_report_transcription_keyword">
            <field name="keyword">form_print</field>
            <field name="model">lims.results_report.version.detail,-1</field>
            <field name="action" ref="report_results_report_transcription"/>
        </record>

<!-- Global Results Report -->

        <record model="ir.action.report" id="report_global_results_report">
            <field name="name">Global Results Report</field>
            <field name="report_name">lims.global_result_report</field>
            <field name="report">lims/report/global_results_report.fodt</field>
            <field name="extension">pdf</field>
        </record>

        <menuitem name="Results reports" parent="lims_laboratory"
            id="lims_laboratory_reports" sequence="50"
            icon="lims-laboratory_reports"/>
        <menuitem parent="lims_laboratory_reports" action="act_lims_results_report"
            id="lims_results_report_menu" sequence="10"
            icon="lims-laboratory_reports"/>
        <menuitem parent="lims_laboratory_reports" action="wiz_lims_generate_results_report"
            id="lims_generate_results_report_menu" sequence="20"
            icon="lims-generate_results_report"/>
        <menuitem parent="lims_laboratory_reports" action="act_lims_results_report_version_detail"
            id="lims_results_report_version_detail_menu" sequence="30"
            icon="lims-results_report_version_detail"/>

        <record model="ir.model.access" id="access_results_report">
            <field name="model" search="[('model', '=', 'lims.results_report')]"/>
            <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_results_report_group_laboratory_reports">
            <field name="model" search="[('model', '=', 'lims.results_report')]"/>
            <field name="group" ref="group_lims_laboratory_reports"/>
            <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.access" id="access_results_report_version_detail">
            <field name="model" search="[('model', '=', 'lims.results_report.version.detail')]"/>
            <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_results_report_version_detail_group_laboratory_reports">
            <field name="model" search="[('model', '=', 'lims.results_report.version.detail')]"/>
            <field name="group" ref="group_lims_laboratory_reports"/>
            <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="results_report_version_detail_revise_button">
            <field name="name">revise</field>
            <field name="model" search="[('model', '=', 'lims.results_report.version.detail')]"/>
        </record>
        <record model="ir.model.button-res.group" id="results_report_version_detail_revise_button_group_lims_laboratory_reports">
            <field name="button" ref="results_report_version_detail_revise_button"/>
            <field name="group" ref="group_lims_laboratory_reports"/>
        </record>

        <record model="ir.model.button" id="results_report_version_detail_annul_button">
            <field name="name">annul</field>
            <field name="model" search="[('model', '=', 'lims.results_report.version.detail')]"/>
        </record>
        <record model="ir.model.button-res.group" id="results_report_version_detail_annul_button_group_lims_laboratory_reports">
            <field name="button" ref="results_report_version_detail_annul_button"/>
            <field name="group" ref="group_lims_laboratory_reports"/>
        </record>

        <record model="ir.model.button" id="results_report_version_detail_revise_all_lang_button">
            <field name="name">revise_all_lang</field>
            <field name="model" search="[('model', '=', 'lims.results_report.version.detail')]"/>
        </record>
        <record model="ir.model.button-res.group" id="results_report_version_detail_revise_all_lang_button_group_lims_laboratory_reports">
            <field name="button" ref="results_report_version_detail_revise_all_lang_button"/>
            <field name="group" ref="group_lims_laboratory_reports"/>
        </record>

        <record model="ir.ui.menu-res.group" id="menu_laboratory_group_laboratory_reports_readonly">
            <field name="menu" ref="lims_laboratory"/>
            <field name="group" ref="group_lims_laboratory_reports_readonly"/>
        </record>
        <record model="ir.ui.menu-res.group" id="menu_laboratory_group_laboratory_reports">
            <field name="menu" ref="lims_laboratory"/>
            <field name="group" ref="group_lims_laboratory_reports"/>
        </record>

        <record model="ir.ui.menu-res.group" id="menu_laboratory_reports_group_laboratory_reports_readonly">
            <field name="menu" ref="lims_laboratory_reports"/>
            <field name="group" ref="group_lims_laboratory_reports_readonly"/>
        </record>
        <record model="ir.ui.menu-res.group" id="menu_laboratory_reports_group_laboratory_reports">
            <field name="menu" ref="lims_laboratory_reports"/>
            <field name="group" ref="group_lims_laboratory_reports"/>
        </record>

        <record model="ir.ui.menu-res.group" id="menu_results_report_group_laboratory_reports_readonly">
            <field name="menu" ref="lims_results_report_menu"/>
            <field name="group" ref="group_lims_laboratory_reports_readonly"/>
        </record>
        <record model="ir.ui.menu-res.group" id="menu_results_report_group_laboratory_reports">
            <field name="menu" ref="lims_results_report_menu"/>
            <field name="group" ref="group_lims_laboratory_reports"/>
        </record>

        <record model="ir.ui.menu-res.group" id="menu_generate_results_report_group_laboratory_reports">
            <field name="menu" ref="lims_generate_results_report_menu"/>
            <field name="group" ref="group_lims_laboratory_reports"/>
        </record>

        <record model="ir.ui.menu-res.group" id="menu_results_report_version_detail_group_laboratory_reports_readonly">
            <field name="menu" ref="lims_results_report_version_detail_menu"/>
            <field name="group" ref="group_lims_laboratory_reports_readonly"/>
        </record>
        <record model="ir.ui.menu-res.group" id="menu_results_report_version_detail_group_laboratory_reports">
            <field name="menu" ref="lims_results_report_version_detail_menu"/>
            <field name="group" ref="group_lims_laboratory_reports"/>
        </record>

        <record model="ir.action-res.group"
            id="wiz_notebook_accept_lines-group_laboratory_results_acceptance">
            <field name="action" ref="wiz_lims_notebook_accept_lines"/>
            <field name="group" ref="group_lims_laboratory_results_acceptance"/>
        </record>

        <record model="ir.action-res.group"
            id="wiz_notebook_line_accept_lines-group_laboratory_results_acceptance">
            <field name="action" ref="wiz_lims_notebook_line_accept_lines"/>
            <field name="group" ref="group_lims_laboratory_results_acceptance"/>
        </record>

        <record model="ir.action-res.group"
            id="wiz_notebook_line_unaccept_lines-group_laboratory_results_acceptance">
            <field name="action" ref="wiz_lims_notebook_line_unaccept_lines"/>
            <field name="group" ref="group_lims_laboratory_results_acceptance"/>
        </record>

        <record model="ir.model.field.access"
            id="access_results_report_version_detail_annulment_reason">
            <field name="field"
                search="[('name', '=', 'annulment_reason'), ('model.model', '=', 'lims.results_report.version.detail')]"/>
            <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.field.access"
            id="access_results_report_version_detail_annulment_reason_group_lims_laboratory_reports_qa">
            <field name="field"
                search="[('name', '=', 'annulment_reason'), ('model.model', '=', 'lims.results_report.version.detail')]"/>
            <field name="group" ref="group_lims_laboratory_reports_qa"/>
            <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.field.access"
            id="access_results_report_version_detail_annulment_reason_print">
            <field name="field"
                search="[('name', '=', 'annulment_reason_print'), ('model.model', '=', 'lims.results_report.version.detail')]"/>
            <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.field.access"
            id="access_results_report_version_detail_annulment_reason_print_group_lims_laboratory_reports_qa">
            <field name="field"
                search="[('name', '=', 'annulment_reason_print'), ('model.model', '=', 'lims.results_report.version.detail')]"/>
            <field name="group" ref="group_lims_laboratory_reports_qa"/>
            <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>

    </data>
</tryton>
