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

    <!-- Portal sales rep: own assessments only -->
    <record id="rule_wc_assessment_portal" model="ir.rule">
        <field name="name">Portal: Own WC Assessments</field>
        <field name="model_id" ref="model_fusion_wc_assessment"/>
        <field name="domain_force">[('sales_rep_id', '=', user.id)]</field>
        <field name="groups" eval="[(4, ref('base.group_portal'))]"/>
        <field name="perm_read" eval="True"/>
        <field name="perm_write" eval="True"/>
        <field name="perm_create" eval="True"/>
        <field name="perm_unlink" eval="False"/>
    </record>

    <!-- Portal: assessment lines follow assessment access -->
    <record id="rule_wc_assessment_line_portal" model="ir.rule">
        <field name="name">Portal: Own WC Assessment Lines</field>
        <field name="model_id" ref="model_fusion_wc_assessment_line"/>
        <field name="domain_force">[('assessment_id.sales_rep_id', '=', user.id)]</field>
        <field name="groups" eval="[(4, ref('base.group_portal'))]"/>
        <field name="perm_read" eval="True"/>
        <field name="perm_write" eval="True"/>
        <field name="perm_create" eval="True"/>
        <field name="perm_unlink" eval="False"/>
    </record>

    <!-- IR Sequence for assessment references -->
    <record id="seq_wc_assessment" model="ir.sequence">
        <field name="name">Wheelchair Assessment</field>
        <field name="code">fusion.wc.assessment</field>
        <field name="prefix">WCA-</field>
        <field name="padding">4</field>
        <field name="company_id" eval="False"/>
    </record>

</odoo>
