flectra/addons/website/data/website_demo.xml

135 lines
5.5 KiB
XML

<?xml version="1.0" encoding="utf-8"?>
<flectra>
<data>
<record id="base.main_company" model="res.company">
<field name="social_twitter">https://twitter.com/Flectra</field>
<field name="social_facebook">https://www.facebook.com/Flectra</field>
<field name="social_googleplus">https://plus.google.com/+Flectraapps</field>
<field name="social_linkedin">https://www.linkedin.com/company/flectra</field>
</record>
</data>
<data noupdate="1">
<!--
Some demo data for front-end server action generating templates
-->
<template id="template_partner_post" name="Partner Post and Thanks (Website Server Action Demo)">
<t t-call="website.layout">
<t t-set="additional_title">Partner Detail</t>
<div id="wrap">
<div class="oe_structure">
<section>
<div class="container">
<div class="row">
<div class="col-md-12">
<h2>Thank you for posting a message !</h2>
</div>
</div>
</div>
</section>
</div>
</div>
</t>
</template>
<record id="action_partner_post" model="ir.actions.server">
<field name="name">Website: Partner Post and Thanks Demo</field>
<field name="website_published" eval="True"/>
<field name="website_path">partner_thanks</field>
<field name="model_id" ref="base.model_res_partner"/>
<field name="code">
partner = model
post_partner_id = request.params.get('partner_id')
post_body = request.params.get('body')
if post_partner_id:
try:
post_partner_id = int(post_partner_id)
except:
post_partner_id = False
if post_partner_id:
partner = model.browse(post_partner_id).exists()
if partner and post_body:
message = partner.message_post(body=post_body, subtype='mail.mt_comment')
values = {
'partner': partner,
}
response = request.website.render("website.template_partner_post", {'partner': partner})
</field>
<field name="state">code</field>
<field name="type">ir.actions.server</field>
</record>
<template id="template_partner_comment" name="Partner Comment (Website Server Action Demo)">
<t t-call="website.layout">
<t t-set="additional_title">Partners</t>
<div id="wrap">
<div class="oe_structure">
<section>
<div class="container">
<div class="row">
<div class="col-md-12">
<h1 class="text-center">Send a Message to our Partners</h1>
<h3 class="text-muted text-center">Discuss and Comments</h3>
</div>
</div>
</div>
</section>
</div>
<div class="container">
<div class="row">
<form class="form-horizontal" action="/website/action/website.action_partner_post" method="post">
<input type="hidden" name="csrf_token" t-att-value="request.csrf_token()"/>
<div class="form-group">
<label class="col-sm-2 control-label">Recipient</label>
<div class="col-sm-10">
<select t-if="partners" name="partner_id" class="form-control">
<t t-foreach="partners" t-as="partner"><option t-att-value="partner.id" t-esc="partner.name"/></t>
</select>
</div>
</div>
<div class="form-group">
<label class="col-sm-2 control-label">Message</label>
<div class="col-sm-10">
<textarea name="body" rows="10" class="form-control"/>
</div>
</div>
<div class="form-group">
<div class="col-sm-offset-2 col-sm-10">
<button type="submit" class="btn btn-primary">
Send <span class="fa fa-long-arrow-right"/>
</button>
</div>
</div>
</form>
</div>
</div>
</div>
</t>
</template>
<record id="action_partner_comment" model="ir.actions.server">
<field name="name">Website: Partners Comment Form</field>
<field name="website_published" eval="True"/>
<field name="website_path">partner_comment</field>
<field name="model_id" ref="base.model_res_partner"/>
<field name="code">
response = request.render("website.template_partner_comment", {
'partners': model.search([('customer', '=', True)]),
})
</field>
<field name="state">code</field>
<field name="type">ir.actions.server</field>
</record>
<record id="default_website" model="website">
<field name="name">Website localhost</field>
</record>
<record id="website2" model="website">
<field name="name">Website 0.0.0.0</field>
<field name="domain">0.0.0.0</field>
</record>
</data>
</flectra>