[NEW] funding_campaign: create add-on

This commit is contained in:
Stéphan Sainléger
2024-01-24 09:29:45 +01:00
parent 5b37b57f10
commit 21fbb44105
19 changed files with 1262 additions and 0 deletions

View File

@@ -0,0 +1,55 @@
<?xml version="1.0"?>
<odoo>
<data>
<!-- LEAD VIEWS -->
<!-- <record model="ir.ui.view" id="view_campaign_registration_tree">
<field name="name">crm.lead.tree.funding.campaign</field>
<field name="model">crm.lead</field>
<field name="inherit_id" ref="crm.crm_case_tree_view_oppor" />
<field name="arch" type="xml">
<xpath expr="//field[@name='name']" position="after">
<field name="is_funding_campaign_lead" invisible="1" />
<field name="funding_campaign_id"
attrs="{'invisible': [('is_funding_campaign_lead', '=', False)]}" />
</xpath>
</field>
</record>
<record model="ir.ui.view" id="crm_lead_view_form_funding_campaign">
<field name="name">crm.lead.form.funding.campaign</field>
<field name="model">crm.lead</field>
<field name="inherit_id" ref="crm.crm_lead_view_form" />
<field name="arch" type="xml">
<xpath expr="//sheet/group" position="inside">
<group string="Registration Information" name="registration">
<field name="is_funding_campaign_lead" invisible="1" />
<field class="text-break" name="funding_campaign_id"
options="{'no_create': True}"
attrs="{'invisible': [('is_funding_campaign_lead', '=', False)]}" />
</group>
</xpath>
</field>
</record> -->
<!-- EVENT.REGISTRATION ACTIONS -->
<record id="act_account_move_from_campaign" model="ir.actions.act_window">
<field name="res_model">account.move</field>
<field name="name">Invoices</field>
<field name="view_mode">tree,form</field>
<field name="domain">[('funding_campaign_id', '=', active_id)]</field>
<field name="context">{'default_funding_campaign_id': active_id}</field>
<!-- <field name="search_view_id" ref="crm_lead_view_search_campaign_specific" /> -->
<field name="help" type="html">
<p class="o_view_nocontent_smiling_face">
No Invoice yet!
</p>
<p>
Wait until Participants register to your Campaign or create their registrations
manually.
</p>
</field>
</record>
</data>
</odoo>

View File

@@ -0,0 +1,54 @@
<?xml version="1.0"?>
<odoo>
<data>
<!-- LEAD VIEWS -->
<!-- <record model="ir.ui.view" id="view_campaign_registration_tree">
<field name="name">crm.lead.tree.funding.campaign</field>
<field name="model">crm.lead</field>
<field name="inherit_id" ref="crm.crm_case_tree_view_oppor" />
<field name="arch" type="xml">
<xpath expr="//field[@name='name']" position="after">
<field name="is_funding_campaign_lead" invisible="1" />
<field name="funding_campaign_id"
attrs="{'invisible': [('is_funding_campaign_lead', '=', False)]}" />
</xpath>
</field>
</record> -->
<record model="ir.ui.view" id="crm_lead_view_form_funding_campaign">
<field name="name">crm.lead.form.funding.campaign</field>
<field name="model">crm.lead</field>
<field name="inherit_id" ref="crm.crm_lead_view_form" />
<field name="arch" type="xml">
<xpath expr="//sheet/group" position="inside">
<group string="Registration Information" name="registration">
<!-- attrs="{'invisible': [('is_funding_campaign_lead', '=', False)]}" /> -->
<field name="is_funding_campaign_lead" invisible="1" />
<field class="text-break" name="funding_campaign_id"
options="{'no_create': True}" />
</group>
</xpath>
</field>
</record>
<!-- EVENT.REGISTRATION ACTIONS -->
<record id="act_crm_from_campaign" model="ir.actions.act_window">
<field name="res_model">crm.lead</field>
<field name="name">Participants</field>
<field name="view_mode">tree,form</field>
<field name="domain">[('funding_campaign_id', '=', active_id)]</field>
<field name="context">{'default_funding_campaign_id': active_id}</field>
<!-- <field name="search_view_id" ref="crm_lead_view_search_campaign_specific" /> -->
<field name="help" type="html">
<p class="o_view_nocontent_smiling_face">
No Participant yet!
</p>
<p>
Wait until Participants register to your Campaign or create their registrations
manually.
</p>
</field>
</record>
</data>
</odoo>

View File

@@ -0,0 +1,149 @@
<?xml version="1.0" encoding="UTF-8"?>
<odoo>
<data>
<record id="funding_campaign_view_form" model="ir.ui.view">
<field name="name">funding.campaign.view.form</field>
<field name="model">funding.campaign</field>
<field name="arch" type="xml">
<form string="">
<header>
<button name="action_open_campaign" string="Open campaign" type="object"
attrs="{'invisible':[('state','!=','draft')]}" class="oe_highlight" />
<button name="action_close_campaign" string="Close campaign" type="object"
attrs="{'invisible':[('state','!=','opened')]}" class="oe_highlight" />
<button name="action_draft_campaign" string="Back to Draft" type="object"
attrs="{'invisible':[('state','=','draft')]}" class="oe_stat_button" />
<!-- <button string="New Participant" name="action_crm_lead_new"
type="object" class="oe_highlight" data-hotkey="n" title="Create new
participation" attrs="{'invisible': ['|', ('state', '!=', 'opened'),
('active', '=', False)]}"/> -->
<field name="state" widget="statusbar" nolabel="1"
statusbar_visible="draft,opened,closed" />
</header>
<sheet>
<div class="oe_button_box" name="button_box" groups="base.group_user">
<button
name="%(funding_campaign.act_crm_from_campaign)d"
type="action"
context="{'search_default_expected': True}" class="oe_stat_button"
icon="fa-users" help="Participants for this Campaign">
<field name="nb_participants" widget="statinfo"
string="Participants" />
</button>
<button class="oe_stat_button" type="action"
name="%(funding_campaign.act_sale_order_from_campaign)d"
icon="fa-usd">
<div class="o_field_widget o_stat_info">
<span class="o_stat_value">
<field name="promised_amount" widget="monetary"
options="{'currency_field': 'company_currency'}" />
</span>
<span class="o_stat_text">Promised</span>
</div>
</button>
<button class="oe_stat_button" type="action"
name="%(funding_campaign.act_account_move_from_campaign)d"
icon="fa-usd">
<div class="o_field_widget o_stat_info">
<span class="o_stat_value">
<field name="paid_amount" widget="monetary"
options="{'currency_field': 'company_currency'}" />
</span>
<span class="o_stat_text">Paid</span>
</div>
</button>
</div>
<group>
<field name="name" />
<field name="description" />
<field name="total_wished_amount" widget="monetary" />
<field name="product_id" />
</group>
<notebook>
<page name="steps" string="Campaign Steps">
<field name="campaign_step_ids">
<tree string="Steps" editable="bottom">
<field name="sequence" widget="handle" />
<field name="name" />
<field name="step_amount" />
<field name="state" decoration-info="state == 'unlocked'"
decoration-success="state == 'reached'"
decoration-muted="state == 'locked'" widget="badge" />
</tree>
</field>
</page>
</notebook>
</sheet>
<!-- <div class="oe_chatter">
<field name="message_follower_ids" />
<field name="activity_ids" />
<field name="message_ids" options="{'post_refresh': 'recipients'}" />
</div> -->
</form>
</field>
</record>
<record id="view_funding_campaign_kanban" model="ir.ui.view">
<field name="name">funding.campaign.kanban</field>
<field name="model">funding.campaign</field>
<field name="priority" eval="100" />
<field name="arch" type="xml">
<kanban class="o_kanban_mobile" archivable="false" js_class="crm_kanban" sample="1">
<field name="name" />
<!-- <field name="tag_ids" /> -->
<field name="total_wished_amount" />
<field name="promised_amount" />
<field name="paid_amount" />
<templates>
<t t-name="kanban-box">
<div t-attf-class="oe_kanban_content oe_kanban_global_click">
<div>
<strong class="o_kanban_record_title">
<span>
<field name="name" />
</span>
</strong>
</div>
<!-- <div>
<span class="o_kanban_record_subtitle"><field name="contact_name"/></span>
</div> -->
<!-- <div>
<field name="tag_ids" widget="many2many_tags" options="{'color_field': 'color'}"/>
</div> -->
<!-- <div class="o_kanban_record_bottom">
<div class="oe_kanban_bottom_left"> -->
<div class="o_kanban_record_bottom">
<div>
<div>
<label for="total_wished_amount">
<strong>Wished: </strong>
</label>
<field name="total_wished_amount" />
</div>
<div>
<label for="total_wished_amount">
<strong>Promised: </strong>
</label>
<field name="promised_amount" />
</div>
<div>
<label for="total_wished_amount">
<strong>Paid: </strong>
</label>
<field name="paid_amount" />
</div>
</div>
<!-- <div class="o_kanban_inline_block">
<field name="activity_ids" widget="kanban_activity" />
</div> -->
</div>
</div>
</t>
</templates>
</kanban>
</field>
</record>
</data>
</odoo>

View File

@@ -0,0 +1,31 @@
<?xml version="1.0" encoding="utf-8"?>
<odoo>
<data>
<record id="ir_actions_act_window_funding_r1" model="ir.actions.act_window">
<field name="help">&lt;p class="o_view_nocontent_smiling_face"&gt;Create a new funding
campaign&lt;/p&gt;</field>
<field name="res_model">funding.campaign</field>
<field name="binding_type">action</field>
<field name="type">ir.actions.act_window</field>
<field name="view_mode">kanban,tree,form</field>
<field name="name">Funding Campaigns</field>
<field name="target">current</field>
<field name="res_id">0</field>
<field name="filter" eval="False" />
<field name="limit">80</field>
</record>
<record id="ir_actions_act_window_funding_r2" model="ir.actions.act_window">
<field name="help">&lt;p class="o_view_nocontent_smiling_face"&gt;Create a new
campaign participant&lt;/p&gt;</field>
<field name="res_model">crm.lead</field>
<field name="binding_type">action</field>
<field name="type">ir.actions.act_window</field>
<field name="view_mode">tree,form</field>
<field name="name">Campaign Participants</field>
<field name="target">current</field>
<field name="res_id">0</field>
<field name="filter" eval="False" />
<field name="limit">80</field>
</record>
</data>
</odoo>

View File

@@ -0,0 +1,12 @@
<?xml version="1.0" encoding="utf-8"?>
<odoo>
<data>
<menuitem id="ir_ui_menu_funding_r0" name="Funding Campaigns" sequence="10"
groups="group_funding_campaign_manager" />
<menuitem id="ir_ui_menu_funding_r1" name="Funding Campaigns" parent="ir_ui_menu_funding_r0"
sequence="10" action="ir_actions_act_window_funding_r1" />
<menuitem id="ir_ui_menu_funding_r2" name="Campaigns Participants"
parent="ir_ui_menu_funding_r0"
sequence="10" action="ir_actions_act_window_funding_r2" />
</data>
</odoo>

View File

@@ -0,0 +1,45 @@
<?xml version="1.0"?>
<odoo>
<data>
<!-- LEAD VIEWS -->
<record model="ir.ui.view" id="view_order_form_funding_campaign">
<field name="name">sale.order.form.funding.campaign</field>
<field name="model">sale.order</field>
<field name="inherit_id" ref="sale.view_order_form" />
<field name="arch" type="xml">
<xpath expr="//page[@name='other_information']" position="inside">
<group>
<group name="funding_campaign" string="Funding campaign">
<!-- attrs="{'invisible': [('is_funding_campaign_order', '=', False)]}"> -->
<field name="is_funding_campaign_order" invisible="1" />
<field class="text-break" name="funding_campaign_id"
options="{'no_create': True}"
/>
</group>
</group>
</xpath>
</field>
</record>
<!-- EVENT.REGISTRATION ACTIONS -->
<record id="act_sale_order_from_campaign" model="ir.actions.act_window">
<field name="res_model">sale.order</field>
<field name="name">Orders</field>
<field name="view_mode">tree,form</field>
<field name="domain">[('funding_campaign_id', '=', active_id)]</field>
<field name="context">{'default_funding_campaign_id': active_id}</field>
<!-- <field name="search_view_id" ref="crm_lead_view_search_campaign_specific" /> -->
<field name="help" type="html">
<p class="o_view_nocontent_smiling_face">
No Order yet!
</p>
<p>
Wait until Participants register to your Campaign or create their registrations
manually.
</p>
</field>
</record>
</data>
</odoo>