Skip to content

Commit

Permalink
[IMP] add demo
Browse files Browse the repository at this point in the history
  • Loading branch information
etobella committed Mar 17, 2024
1 parent de432b4 commit 936af73
Show file tree
Hide file tree
Showing 3 changed files with 67 additions and 5 deletions.
4 changes: 3 additions & 1 deletion automation_oca/__manifest__.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,5 +31,7 @@
"automation_oca/static/src/**/*.scss",
],
},
"demo": [],
"demo": [
"demo/demo.xml",
],
}
64 changes: 64 additions & 0 deletions automation_oca/demo/demo.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
<?xml version="1.0" encoding="UTF-8" ?>
<odoo>
<record id="demo_tag_process" model="automation.tag">
<field name="name">Automatic Process</field>
</record>
<record id="demo_tag_demo" model="automation.tag">
<field name="name">Demo</field>
</record>

<record id="demo_bounce_action" model="ir.actions.server">
<field name="name">Blacklist Partner</field>
<field name="type">ir.actions.server</field>
<field name="state">code</field>
<field name="model_id" ref="base.model_res_partner" />
<field name="code">
for record in records.filtered(lambda r: not r.is_blacklisted):
env["mail.blacklist"].create({"email": record.email})
</field>
</record>
<record id="demo_welcome_template" model="mail.template">
<field name="name">Welcome</field>
<field name="model_id" ref="base.model_res_partner" />
<field name="subject">Welcome! Thanks for being part of our database</field>
<field name="body_html" type="html">
<p>Welcome!</p>
<p>Thanks <t t-out="object.name" /> for becoming a contact.</p>
<p>Kind regards,</p>
</field>
</record>
<record id="demo_configuration_welcome" model="automation.configuration">
<field name="name">Welcome email</field>
<field name="model_id" ref="base.model_res_partner" />
<field
name="tag_ids"
eval="[(4, ref('demo_tag_process')), (4, ref('demo_tag_demo'))]"
/>
<field name="field_id" ref="base.field_res_partner__email" />
<field name="editable_domain">[('email', '!=', False)]</field>
</record>
<record
id="demo_configuration_welcome_send"
model="automation.configuration.activity"
>
<field name="name">Send email</field>
<field name="configuration_id" ref="demo_configuration_welcome" />
<field name="activity_type">mail</field>
<field name="trigger_interval">2</field>
<field name="mail_template_id" ref="demo_welcome_template" />
</record>
<record
id="demo_configuration_welcome_bounced"
model="automation.configuration.activity"
>
<field name="name">Blacklist bounced</field>
<field name="configuration_id" ref="demo_configuration_welcome" />
<field name="activity_type">action</field>
<field name="trigger_type">mail_bounce</field>
<field name="expiry" eval="True" />
<field name="expiry_interval">24</field>
<field name="parent_id" ref="demo_configuration_welcome_send" />
<field name="trigger_interval">1</field>
<field name="server_action_id" ref="demo_bounce_action" />
</record>
</odoo>
4 changes: 0 additions & 4 deletions automation_oca/models/automation_configuration_activity.py
Original file line number Diff line number Diff line change
Expand Up @@ -65,10 +65,6 @@ class AutomationConfigurationActivity(models.Model):
required=True,
default="start",
)
trigger_activity_id = fields.Many2one(
"automation.configuration.activity",
domain="[('configuration_id', '=', configuration_id)]",
)
mail_author_id = fields.Many2one(
"res.partner", required=True, default=lambda r: r.env.user.id
)
Expand Down

0 comments on commit 936af73

Please sign in to comment.