<commit_before><?xml version="1.0" encoding="utf-8"?>
<!--
    Copyright (C) 2016 Compassion (http://www.compassion.ch)
    @author <NAME> <<EMAIL>>
    The licence is in the file __manifest__.py
-->
<odoo>
    <record id="view_gift_tree" model="ir.ui.view">
        <field name="name">sponsorship.gift.tree</field>
        <field name="model">sponsorship.gift</field>
        <field name="arch" type="xml">
            <tree string="Gifts" colors="blue:state == 'draft';
                                         black:state in ['open','fund_due'];
                                         green:state == 'verify';
                                         red:state == 'error';
                                         grey:state == 'fund_delivered'">
                <field name="gmc_gift_id"/>
                <field name="create_date"/>
                <field name="gift_date"/>
                <field name="partner_id"/>
                <field name="child_id"/>
                <field name="gift_type"/>
                <field name="sponsorship_gift_type"/>
                <field name="amount" sum="Amount"/>
                <field name="amount_us_dollars"/>
                <field name="instructions"/>
                <field name="date_sent"/>
                <field name="state"/>
                <field name="project_suspended"/>
            </tree>
        </field>
    </record>

    <record id="view_gift_form" model="ir.ui.view">
        <field name="name">sponsorship.gift.form</field>
        <field name="model">sponsorship.gift</field>
        <field name="arch" type="xml">
            <form string="Gift">
                <header>
                    <field name="state" widget="statusbar" statusbar_visible="draft,In Progress,Delivered"/>
                    <button name="action_send"
                            type="object"
                            string="Send Now"
                            class="oe_highlight"
                            states="draft,open"
                            context="{'async_mode': False}"/>
                    <button name="action_verify" type="object" string="To Verify" states="draft,error"/>
                    <button name="action_ok" type="object" string="Gift OK" class="oe_highlight" states="verify"/>
                    <button name="action_cancel"
                            type="object"
                            string="Cancel Gift"
                            help="Will unreconcile the payment"
                            states="draft,verify"/>
                    <button name="mark_sent"
                            type="object"
                            string="Mark as delivered"
                            states="draft,verify,open"
                            confirm="This will cancel the message for GMC and put the gift in Delivered state. Are you sure?"/>
                </header>
                <sheet>
                    <div class="oe_right oe_button_box" name="buttons">
                        <button name="%(action_collect_invoices)d"
                                string="Collect invoices"
                                type="action"
                                icon="fa-pencil-square-o"
                                class="oe_stat_button"
                                states="draft"/>
                        <button name="view_invoices"
                                string="Invoiced"
                                type="object"
                                icon="fa-pencil-square-o"
                                class="oe_stat_button"/>
                    </div>
                    <div class="oe_title">
                        <label for="name"/>
                        <h1>
                            <field name="name"/>
                        </h1>
                    </div>
                    <group>
                        <group>
                            <field name="sponsorship_id"
                                   options="{'colors':{'draft':'blue', 'waiting':'green', 'cancelled':'grey', 'terminated':'grey', 'mandate':'red'}, 'field_color':'state'}"/>
                            <field name="partner_id"/>
                            <field name="child_id"/>
                        </group>
                        <group>
                            <field name="gift_type"/>
                            <field name="attribution"/>
                            <field name="sponsorship_gift_type" attrs="{'invisible': [('gift_type', '!=', 'Beneficiary Gift')],
                                                                        'required': [('gift_type', '=', 'Beneficiary Gift')]}"/>
                            <field name="instructions"/>
                        </group>
                        <group>
                            <field name="gift_date"/>
                            <field name="date_partner_paid"/>
                            <field name="date_sent"/>
                            <field name="message_id" groups="message_center_compassion.group_gmc_user"/>
                            <field name="payment_id"/>
                            <field name="inverse_payment_id"
                                   attrs="{'invisible': [('inverse_payment_id', '=', False)]}"/>
                        </group>
                        <group>
                            <field name="gmc_gift_id"/>
                            <field name="undeliverable_reason"
                                   attrs="{'invisible': [('state', '!=', 'Undeliverable')]}"/>
                            <field name="exchange_rate"/>
                            <field name="threshold_alert"/>
                            <field name="threshold_alert_type"
                                   attrs="{'invisible': [('threshold_alert', '=', False)]}"/>
                            <field name="field_office_notes"/>
                            <field name="status_change_date"/>
                        </group>
                    </group>
                    <notebook>
                        <page string="Sponsor payments">
                            <field name="currency_id" invisible="1"/>
                            <field name="currency_usd" invisible="1"/>
                            <field name="invoice_line_ids"/>
                            <group class="oe_subtotal_footer oe_right">
                                <field name="amount_us_dollars"
                                       widget="monetary"
                                       options="{'currency_field': 'currency_usd'}"/>
                                <field name="amount"
                                       widget="monetary"
                                       class="oe_subtotal_footer_separator"
                                       options="{'currency_field': 'currency_id'}"/>
                            </group>
                            <separator/>
                        </page>
                    </notebook>
                </sheet>
                <div class="oe_chatter">
                    <field name="message_follower_ids"
                           widget="mail_followers"/>
                    <field name="message_ids" widget="mail_thread"/>
                </div>
            </form>
        </field>
    </record>

    <record id="view_gift_filter" model="ir.ui.view">
        <field name="name">sponsorship.gift.filter</field>
        <field name="model">sponsorship.gift</field>
        <field name="arch" type="xml">
            <search>
                <field name="partner_id"/>
                <field name="child_id"/>
                <field name="state"/>
                <field name="gmc_gift_id"/>

                <filter name="not_sent" string="Not sent" domain="[('gmc_gift_id', '=', False)]"/>
                <filter string="Sent" name="sent" domain="[('gmc_gift_id', '!=', False)]"/>
                <filter string="Delivered" name="delivered" domain="[('state', '=', 'Delivered')]"/>
                <group expand="0" string="Group By...">
                    <filter string="Status" name="status" domain="[]" context="{'group_by': 'state'}"/>
                    <filter string="Gift Type" name="gift_type"
                            domain="[]"
                            context="{'group_by': ['gift_type','sponsorship_gift_type']}"/>
                    <filter name='group_by_date' string="Gift Date" domain="[]" context="{'group_by': 'gift_date'}"/>
                </group>
            </search>
        </field>
    </record>

    <record id="action_sponsorship_gift" model="ir.actions.act_window">
        <field name="name">Sponsorship Gifts</field>
        <field name="type">ir.actions.act_window</field>
        <field name="res_model">sponsorship.gift</field>
        <field name="view_type">form</field>
        <field name="view_mode">tree,form</field>
        <field name="help" type="html">
            <p class="oe_view_nocontent_create">
                No gifts.
            </p>
        </field>
        <field name="context">{'search_default_not_sent': 1, 'search_default_group_by_date': 1}</field>
    </record>

    <!-- Send Gift actions -->
    <record id="send_gift" model="ir.actions.server"><commit_msg>Fix "group by" who prevented to open gift list<commit_after><?xml version="1.0" encoding="utf-8"?>
<!--
    Copyright (C) 2016 Compassion (http://www.compassion.ch)
    @author <NAME> <<EMAIL>>
    The licence is in the file __manifest__.py
-->
<odoo>
    <record id="view_gift_tree" model="ir.ui.view">
        <field name="name">sponsorship.gift.tree</field>
        <field name="model">sponsorship.gift</field>
        <field name="arch" type="xml">
            <tree string="Gifts" colors="blue:state == 'draft';
                                         black:state in ['open','fund_due'];
                                         green:state == 'verify';
                                         red:state == 'error';
                                         grey:state == 'fund_delivered'">
                <field name="gmc_gift_id"/>
                <field name="create_date"/>
                <field name="gift_date"/>
                <field name="partner_id"/>
                <field name="child_id"/>
                <field name="gift_type"/>
                <field name="sponsorship_gift_type"/>
                <field name="amount" sum="Amount"/>
                <field name="amount_us_dollars"/>
                <field name="instructions"/>
                <field name="date_sent"/>
                <field name="state"/>
                <field name="project_suspended"/>
            </tree>
        </field>
    </record>

    <record id="view_gift_form" model="ir.ui.view">
        <field name="name">sponsorship.gift.form</field>
        <field name="model">sponsorship.gift</field>
        <field name="arch" type="xml">
            <form string="Gift">
                <header>
                    <field name="state" widget="statusbar" statusbar_visible="draft,In Progress,Delivered"/>
                    <button name="action_send"
                            type="object"
                            string="Send Now"
                            class="oe_highlight"
                            states="draft,open"
                            context="{'async_mode': False}"/>
                    <button name="action_verify" type="object" string="To Verify" states="draft,error"/>
                    <button name="action_ok" type="object" string="Gift OK" class="oe_highlight" states="verify"/>
                    <button name="action_cancel"
                            type="object"
                            string="Cancel Gift"
                            help="Will unreconcile the payment"
                            states="draft,verify"/>
                    <button name="mark_sent"
                            type="object"
                            string="Mark as delivered"
                            states="draft,verify,open"
                            confirm="This will cancel the message for GMC and put the gift in Delivered state. Are you sure?"/>
                </header>
                <sheet>
                    <div class="oe_right oe_button_box" name="buttons">
                        <button name="%(action_collect_invoices)d"
                                string="Collect invoices"
                                type="action"
                                icon="fa-pencil-square-o"
                                class="oe_stat_button"
                                states="draft"/>
                        <button name="view_invoices"
                                string="Invoiced"
                                type="object"
                                icon="fa-pencil-square-o"
                                class="oe_stat_button"/>
                    </div>
                    <div class="oe_title">
                        <label for="name"/>
                        <h1>
                            <field name="name"/>
                        </h1>
                    </div>
                    <group>
                        <group>
                            <field name="sponsorship_id"
                                   options="{'colors':{'draft':'blue', 'waiting':'green', 'cancelled':'grey', 'terminated':'grey', 'mandate':'red'}, 'field_color':'state'}"/>
                            <field name="partner_id"/>
                            <field name="child_id"/>
                        </group>
                        <group>
                            <field name="gift_type"/>
                            <field name="attribution"/>
                            <field name="sponsorship_gift_type" attrs="{'invisible': [('gift_type', '!=', 'Beneficiary Gift')],
                                                                        'required': [('gift_type', '=', 'Beneficiary Gift')]}"/>
                            <field name="instructions"/>
                        </group>
                        <group>
                            <field name="gift_date"/>
                            <field name="date_partner_paid"/>
                            <field name="date_sent"/>
                            <field name="message_id" groups="message_center_compassion.group_gmc_user"/>
                            <field name="payment_id"/>
                            <field name="inverse_payment_id"
                                   attrs="{'invisible': [('inverse_payment_id', '=', False)]}"/>
                        </group>
                        <group>
                            <field name="gmc_gift_id"/>
                            <field name="undeliverable_reason"
                                   attrs="{'invisible': [('state', '!=', 'Undeliverable')]}"/>
                            <field name="exchange_rate"/>
                            <field name="threshold_alert"/>
                            <field name="threshold_alert_type"
                                   attrs="{'invisible': [('threshold_alert', '=', False)]}"/>
                            <field name="field_office_notes"/>
                            <field name="status_change_date"/>
                        </group>
                    </group>
                    <notebook>
                        <page string="Sponsor payments">
                            <field name="currency_id" invisible="1"/>
                            <field name="currency_usd" invisible="1"/>
                            <field name="invoice_line_ids"/>
                            <group class="oe_subtotal_footer oe_right">
                                <field name="amount_us_dollars"
                                       widget="monetary"
                                       options="{'currency_field': 'currency_usd'}"/>
                                <field name="amount"
                                       widget="monetary"
                                       class="oe_subtotal_footer_separator"
                                       options="{'currency_field': 'currency_id'}"/>
                            </group>
                            <separator/>
                        </page>
                    </notebook>
                </sheet>
                <div class="oe_chatter">
                    <field name="message_follower_ids"
                           widget="mail_followers"/>
                    <field name="message_ids" widget="mail_thread"/>
                </div>
            </form>
        </field>
    </record>

    <record id="view_gift_filter" model="ir.ui.view">
        <field name="name">sponsorship.gift.filter</field>
        <field name="model">sponsorship.gift</field>
        <field name="arch" type="xml">
            <search>
                <field name="partner_id"/>
                <field name="child_id"/>
                <field name="state"/>
                <field name="gmc_gift_id"/>

                <filter name="not_sent" string="Not sent" domain="[('gmc_gift_id', '=', False)]"/>
                <filter string="Sent" name="sent" domain="[('gmc_gift_id', '!=', False)]"/>
                <filter string="Delivered" name="delivered" domain="[('state', '=', 'Delivered')]"/>
                <group expand="0" string="Group By...">
                    <filter string="Status" name="status" domain="[]" context="{'group_by': 'state'}"/>
                    <filter string="Gift Type" name="gift_type"
                            domain="[]"
                            context="{'group_by': 'gift_type'}"/>
                    <filter name='group_by_date' string="Gift Date" domain="[]" context="{'group_by': 'gift_date'}"/>
                </group>
            </search>
        </field>
    </record>

    <record id="action_sponsorship_gift" model="ir.actions.act_window">
        <field name="name">Sponsorship Gifts</field>
        <field name="type">ir.actions.act_window</field>
        <field name="res_model">sponsorship.gift</field>
        <field name="view_type">form</field>
        <field name="view_mode">tree,form</field>
        <field name="help" type="html">
            <p class="oe_view_nocontent_create">
                No gifts.
            </p>
        </field>
        <field name="context">{'search_default_not_sent': 1, 'search_default_group_by_date': 1}</field>
    </record>

    <!-- Send Gift actions -->
    <record id="send_gift" model="ir.actions.server">
{'fraction_non_alphanumeric': 0.13211832783516306, 'fraction_numerical': 0.0015142501757611812, 'mean_word_length': 1.2001189767995242, 'pattern_counts': {'":': 0, '<': 297, '<?xml version=': 2, '>': 297, 'https://': 0, 'lorem ipsum': 0, 'www.': 2, 'xml': 8}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 40, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4210226', 'n_tokens_mistral': 4656, 'n_tokens_neox': 4378, 'n_words': 789}