<?xml version="1.0" encoding="utf-8"?>
<odoo>
    <!-- Vista de formulario de paciente (res.partner) -->
    <record id="view_partner_form_skeen" model="ir.ui.view">
        <field name="name">res.partner.form.skeen</field>
        <field name="model">res.partner</field>
        <field name="inherit_id" ref="base.view_partner_form"/>
        <field name="arch" type="xml">
            <xpath expr="//field[@name='vat']" position="after">
                <field name="is_patient" />
                <field name="patient_id" invisible="not is_patient" />
                <field name="age" invisible="not is_patient" />
                <field name="birth_date" invisible="not is_patient" />
                <field name="birthplace" invisible="not is_patient" />
                <field name="gender" invisible="not is_patient" />
                <field name="blood_type" invisible="not is_patient" />
                <field name="marital_status" invisible="not is_patient" />
                <field name="occupation" invisible="not is_patient" />
                <field name="home_phone" invisible="not is_patient" />
                <field name="mobile" invisible="not is_patient" />
                <field name="emergency_contact" invisible="not is_patient" />
                <field name="emergency_phone" invisible="not is_patient" />
                <field name="address_notes" invisible="not is_patient" />
                <field name="referred_by" invisible="not is_patient" />
                <field name="preferred_contact" invisible="not is_patient" />
                <field name="source" invisible="not is_patient" />
                <field name="primary_doctor_id" invisible="not is_patient" />
                <field name="tag_ids" invisible="not is_patient" widget="many2many_tags" />
                <field name="is_vip" invisible="not is_patient" />
                <field name="patient_comments" invisible="not is_patient" />
            </xpath>
            <xpath expr="//page[@name='internal_notes']" position="after">
                <page string="Historia Clínica" invisible="not is_patient">
                    <group>
                        <group string="Antecedentes Gineco-Obstétricos">
                            <field name="is_pregnant" />
                            <field name="is_breastfeeding" />
                            <field name="uses_contraceptives" />
                            <field name="children_count" />
                        </group>
                        <group string="Antecedentes Patológicos">
                            <field name="kidney_problems" />
                            <field name="back_pain" />
                            <field name="heart_disease" />
                            <field name="respiratory_problems" />
                            <field name="blood_pressure" />
                            <field name="diabetes" />
                            <field name="thyroid" />
                            <field name="colitis" />
                            <field name="constipation" />
                            <field name="liver_problems" />
                            <field name="surgeries" />
                            <field name="varicose_veins" />
                            <field name="migraine" />
                            <field name="faints_with_needles" />
                        </group>
                        <group string="Medicación y Alergias" colspan="2">
                            <field name="allergies" />
                            <field name="medical_history" />
                            <field name="current_medication" />
                            <field name="surgeries_notes" />
                            <field name="medical_notes" />
                        </group>
                    </group>
                </page>
                <page string="Estadísticas SKEEN" invisible="not is_patient">
                    <group>
                        <field name="last_visit" />
                        <field name="total_visits" />
                        <field name="total_spent" />
                    </group>
                </page>
            </xpath>
        </field>
    </record>

    <!-- Vista de lista de pacientes -->
    <record id="view_partner_tree_skeen" model="ir.ui.view">
        <field name="name">res.partner.tree.skeen</field>
        <field name="model">res.partner</field>
        <field name="inherit_id" ref="base.view_partner_tree"/>
        <field name="arch" type="xml">
            <xpath expr="//field[@name='email']" position="after">
                <field name="is_patient"/>
                <field name="patient_id"/>
                <field name="age"/>
                <field name="last_visit"/>
                <field name="total_visits"/>
            </xpath>
        </field>
    </record>
</odoo>
