<commit_before><?xml version="1.0"?>
<openerp>
    <data>

    <menuitem name="Configuration" id="menu_marketing_configuration" parent="base.marketing_menu" sequence="1"/>

    <!--
    ======================
    Marketing Campaign
    ======================
    -->

    <record model="ir.ui.view" id="view_marketing_campaign_form">
        <field name="name">marketing.campaign.form</field>
        <field name="model">marketing.campaign</field>
        <field name="type">form</field>
        <field name="arch" type="xml">
            <form version="7.0">
            <header>
                <button name="state_running_set" string="Run" states="draft"/>
                <button name="state_done_set" string="Done" states="running"/>
                <button name="state_draft_set" string="Set to Draft" states="done,cancelled"/>
                <button name="state_cancel_set" string="Cancel" states="running"/>
                <field name="state" readonly="1" widget="statusbar" statusbar_visible="draft,running,done"/>
            </header>
            <sheet string="Campaign">
                <group>
                    <group>
                        <field name="name"/>
                        <field name="mode"/>
                        <field name="fixed_cost"/>
                    </group>
                    <group>
                        <field name="object_id"/>
                        <field name="partner_field_id"/>
                        <field name="unique_field_id"/>
                    </group>
                </group>
                <separator string="Activities"/>
                <field name="activity_ids" context="{'default_object_id': object_id, 'default_campaign_id': active_id}" />
            </sheet>
            </form>
        </field>
    </record>

    <record model="ir.ui.view" id="view_marketing_campaign_tree">
        <field name="name">marketing.campaign.tree</field>
        <field name="model">marketing.campaign</field>
        <field name="type">tree</field>
        <field name="arch" type="xml">
            <tree colors="blue:state == 'draft';black:state == 'running';gray:state in ('done','cancelled')" string="Campaigns">
                <field name="name"/>
                <field name="object_id"/>
                <field name="mode"/>
                <field name="fixed_cost"/>
                <field name="state"/>
            </tree>
        </field>
    </record>

    <record id="view_marketing_campaign_diagram" model="ir.ui.view">
        <field name="name">marketing.campaign.diagram</field>
        <field name="model">marketing.campaign</field>
        <field name="type">diagram</field>
        <field name="arch" type="xml">
            <diagram string="Campaign Editor">
                <node object="marketing.campaign.activity" shape="rectangle:type=='subcampaign'" bgcolor="gray:start==True">
                    <field name="name"/>
                    <field name="type"/>
                    <field name="start" invisible="1"/>
                    <field name="condition" widget="char"/>
                </node>
                <arrow object="marketing.campaign.transition" source="activity_from_id" destination="activity_to_id" label="['name']">
                    <field name="activity_from_id"/>
                    <field name="activity_to_id"/>
                    <field name="interval_nbr"/>
                    <field name="interval_type"/>
                </arrow>
            </diagram>
        </field>
    </record>

    <record id="view_marketing_campaign_search" model="ir.ui.view">
        <field name="name">marketing.campaign.search</field>
        <field name="model">marketing.campaign</field>
        <field name="type">search</field>
        <field name="arch" type="xml">
            <search string="Campaigns">
                <field name="name" string="Campaign"/>
                <separator orientation="vertical"/>
                <filter icon="terp-document-new" string="Draft" name="draft" domain="[('state','=','draft')]"/>
                <filter icon="terp-check" string="Running" domain="[('state','=','running')]"/>
                <filter icon="terp-gtk-jump-to-rtl" string="Test Mode" name="test" domain="[('mode','=','test')]"/>
                <filter icon="terp-gtk-jump-to-rtl" string="Manual Mode" domain="[('mode','=','manual')]"/>
                <separator orientation="vertical"/>
                <field name="object_id" string="Resource"/>
                <newline/>
                <group expand="0" string="Group By...">
                    <filter string="Resource" name="Object" icon="terp-accessories-archiver" context="{'group_by':'object_id'}"/>
                    <separator orientation="vertical"/>
                    <filter string="Mode" name="Mode" icon="terp-gtk-jump-to-rtl" context="{'group_by':'mode'}"/>
                    <separator orientation="vertical"/>
                    <filter string="Status" name="Status" icon="terp-stock_effects-object-colorize" context="{'group_by':'state'}"/>
                </group>
            </search>
        </field>
    </record>

    <record model="ir.actions.act_window" id="action_marketing_campaign_form">
        <field name="name">Campaigns</field>
        <field name="type">ir.actions.act_window</field>
        <field name="res_model">marketing.campaign</field>
        <field name="view_type">form</field>
        <field name="view_mode">tree,form,diagram</field>
        <field name="view_id" ref="view_marketing_campaign_tree"/>
        <field name="context">{'group_by': []}</field>
        <field name="search_view_id" ref="view_marketing_campaign_search"/>
        <field name="help">A marketing campaign is an event or activity that will help you manage and reach your partners with specific messages. A campaign can have many activities that will be triggered from a specific situation. One action could be sending an email template that has previously been created in the system.</field>
    </record>

    <menuitem name="Campaigns" id="menu_marketing_campaign" parent="base.marketing_menu"/>
    <menuitem id="menu_marketing_campaign_form" parent="menu_marketing_campaign" action="action_marketing_campaign_form" sequence="30" />

    <!--
    ======================
    Marketing Segments
    ======================
    -->

    <record model="ir.ui.view" id="view_marketing_campaign_segment_form">
        <field name="name">marketing.campaign.segment.form</field>
        <field name="model">marketing.campaign.segment</field>
        <field name="type">form</field>
        <field name="arch" type="xml">
            <form version="7.0">
            <header>
                <button name="state_running_set" string="Run" states="draft"/>
                <button name="state_done_set" string="Close" states="running"/>
                <button name="state_draft_set" string="Set to Draft" states="done,cancelled"/>
                <button name="state_cancel_set" string="Cancel" states="running"/>
                <field name="state" readonly="1" widget="statusbar" statusbar_visible="draft,running,done"/>
            </header>
            <sheet string="Segments" layout="auto">
                <group>
                    <group>
                        <field name="name"/>
                        <field name="campaign_id" on_change="onchange_campaign_id(campaign_id)"/>
                        <field name="object_id" invisible="1"/>
                    </group>
                    <group>
                        <field name="ir_filter_id"/>
                    </group>
                    <group>
                       <field name="sync_mode" required="True"/>
                       <label for="sync_last_date"/>
                       <div>
                           <field name="sync_last_date" class="oe_inline"/>
                           <button string="Synchronize Manually" states="running" name="synchroniz" type="object"/>
                       </div>
                       <field name="date_next_sync"/>
                    </group>
                    <group>
                        <field name="date_run" readonly="1"/>
                        <field name="date_done" readonly="1"/><commit_msg>[IMP] add followup and segement button<commit_after><?xml version="1.0"?>
<openerp>
    <data>

    <menuitem name="Configuration" id="menu_marketing_configuration" parent="base.marketing_menu" sequence="1"/>

    <!--
    ======================
    Marketing Campaign
    ======================
    -->

    <record model="ir.ui.view" id="view_marketing_campaign_form">
        <field name="name">marketing.campaign.form</field>
        <field name="model">marketing.campaign</field>
        <field name="type">form</field>
        <field name="arch" type="xml">
            <form version="7.0">
            <header>
                <button name="state_running_set" string="Run" states="draft"/>
                <button name="state_done_set" string="Done" states="running"/>
                <button name="state_draft_set" string="Set to Draft" states="done,cancelled"/>
                <button name="state_cancel_set" string="Cancel" states="running"/>
                <field name="state" readonly="1" widget="statusbar" statusbar_visible="draft,running,done"/>
            </header>
            <sheet string="Campaign">
                <group col="5">
                    
                    <group colspan="2">
                        <field name="name"/>
                        <field name="mode"/>
                        <field name="fixed_cost"/>
                        
                        
                    
                    </group>
                    <group colspan="2">
                        <field name="object_id"/>
                        <field name="partner_field_id"/>
                        <field name="unique_field_id"/>
                    </group>
                    <group col="1">
                    
                    <div class="oe_right oe_button_box">
                        <button type="action"
                        name="%(act_marketing_campaing_followup)d"
                        string="Follow-Up" />
                        <button type="action"
                        name="%(act_marketing_campaing_segment_opened)d"
                        string="Segments" />
                    </div>
                    </group>
                    
                </group>
                <separator string="Activities"/>
                <field name="activity_ids" context="{'default_object_id': object_id, 'default_campaign_id': active_id}" />
            </sheet>
            </form>
        </field>
    </record>

    <record model="ir.ui.view" id="view_marketing_campaign_tree">
        <field name="name">marketing.campaign.tree</field>
        <field name="model">marketing.campaign</field>
        <field name="type">tree</field>
        <field name="arch" type="xml">
            <tree colors="blue:state == 'draft';black:state == 'running';gray:state in ('done','cancelled')" string="Campaigns">
                <field name="name"/>
                <field name="object_id"/>
                <field name="mode"/>
                <field name="fixed_cost"/>
                <field name="state"/>
            </tree>
        </field>
    </record>

    <record id="view_marketing_campaign_diagram" model="ir.ui.view">
        <field name="name">marketing.campaign.diagram</field>
        <field name="model">marketing.campaign</field>
        <field name="type">diagram</field>
        <field name="arch" type="xml">
            <diagram string="Campaign Editor">
                <node object="marketing.campaign.activity" shape="rectangle:type=='subcampaign'" bgcolor="gray:start==True">
                    <field name="name"/>
                    <field name="type"/>
                    <field name="start" invisible="1"/>
                    <field name="condition" widget="char"/>
                </node>
                <arrow object="marketing.campaign.transition" source="activity_from_id" destination="activity_to_id" label="['name']">
                    <field name="activity_from_id"/>
                    <field name="activity_to_id"/>
                    <field name="interval_nbr"/>
                    <field name="interval_type"/>
                </arrow>
            </diagram>
        </field>
    </record>

    <record id="view_marketing_campaign_search" model="ir.ui.view">
        <field name="name">marketing.campaign.search</field>
        <field name="model">marketing.campaign</field>
        <field name="type">search</field>
        <field name="arch" type="xml">
            <search string="Campaigns">
                <field name="name" string="Campaign"/>
                <separator orientation="vertical"/>
                <filter icon="terp-document-new" string="Draft" name="draft" domain="[('state','=','draft')]"/>
                <filter icon="terp-check" string="Running" domain="[('state','=','running')]"/>
                <filter icon="terp-gtk-jump-to-rtl" string="Test Mode" name="test" domain="[('mode','=','test')]"/>
                <filter icon="terp-gtk-jump-to-rtl" string="Manual Mode" domain="[('mode','=','manual')]"/>
                <separator orientation="vertical"/>
                <field name="object_id" string="Resource"/>
                <newline/>
                <group expand="0" string="Group By...">
                    <filter string="Resource" name="Object" icon="terp-accessories-archiver" context="{'group_by':'object_id'}"/>
                    <separator orientation="vertical"/>
                    <filter string="Mode" name="Mode" icon="terp-gtk-jump-to-rtl" context="{'group_by':'mode'}"/>
                    <separator orientation="vertical"/>
                    <filter string="Status" name="Status" icon="terp-stock_effects-object-colorize" context="{'group_by':'state'}"/>
                </group>
            </search>
        </field>
    </record>

    <record model="ir.actions.act_window" id="action_marketing_campaign_form">
        <field name="name">Campaigns</field>
        <field name="type">ir.actions.act_window</field>
        <field name="res_model">marketing.campaign</field>
        <field name="view_type">form</field>
        <field name="view_mode">tree,form,diagram</field>
        <field name="view_id" ref="view_marketing_campaign_tree"/>
        <field name="context">{'group_by': []}</field>
        <field name="search_view_id" ref="view_marketing_campaign_search"/>
        <field name="help">A marketing campaign is an event or activity that will help you manage and reach your partners with specific messages. A campaign can have many activities that will be triggered from a specific situation. One action could be sending an email template that has previously been created in the system.</field>
    </record>

    <menuitem name="Campaigns" id="menu_marketing_campaign" parent="base.marketing_menu"/>
    <menuitem id="menu_marketing_campaign_form" parent="menu_marketing_campaign" action="action_marketing_campaign_form" sequence="30" />

    <!--
    ======================
    Marketing Segments
    ======================
    -->

    <record model="ir.ui.view" id="view_marketing_campaign_segment_form">
        <field name="name">marketing.campaign.segment.form</field>
        <field name="model">marketing.campaign.segment</field>
        <field name="type">form</field>
        <field name="arch" type="xml">
            <form version="7.0">
            <header>
                <button name="state_running_set" string="Run" states="draft"/>
                <button name="state_done_set" string="Close" states="running"/>
                <button name="state_draft_set" string="Set to Draft" states="done,cancelled"/>
                <button name="state_cancel_set" string="Cancel" states="running"/>
                <field name="state" readonly="1" widget="statusbar" statusbar_visible="draft,running,done"/>
            </header>
            <sheet string="Segments" layout="auto">
                <group>
                    <group>
                        <field name="name"/>
                        <field name="campaign_id" on_change="onchange_campaign_id(campaign_id)"/>
                        <field name="object_id" invisible="1"/>
                        <field name="sync_mode" required="True"/>
                       <label for="sync_last_date"/>
                       <div>
                           <field name="sync_last_date" class="oe_inline"/>
                           <button string="Synchronize Manually" states="running" name="synchroniz" type="object"/>
                       </div>
                       <field name="date_next_sync"/>
                    </group>
                    <group>
                        <field name="ir_filter_id"/>
                        <field name="date_run" readonly="1"/>
                        <field name="date_done" readonly="1"/>
{'fraction_non_alphanumeric': 0.15673833862060862, 'fraction_numerical': 0.0021149101163200562, 'mean_word_length': 2.0268492176386914, 'pattern_counts': {'":': 0, '<': 341, '<?xml version=': 2, '>': 341, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 12}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1884233', 'n_tokens_mistral': 4642, 'n_tokens_neox': 4329, 'n_words': 822}