Skip to content

Commit

Permalink
T0485 website_compassion: FIX issues at module installation
Browse files Browse the repository at this point in the history
  • Loading branch information
ecino committed Sep 12, 2023
1 parent d2c1ffc commit a061895
Show file tree
Hide file tree
Showing 15 changed files with 46 additions and 132 deletions.
4 changes: 2 additions & 2 deletions my_compassion/__manifest__.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,6 @@
"templates/my_account_donations.xml",
"templates/my_account_my_children.xml",
"templates/my_account_write_a_letter.xml",
"templates/my_account_contact_us.xml",
"templates/login_template.xml",
"templates/signup.xml",
"views/correspondence_template_view.xml",
Expand All @@ -51,7 +50,8 @@
"depends": [
"child_protection",
"partner_communication_compassion",
"website_form",
"wordpress_configuration",
"website_sponsorship",
"auth_signup",
],
"demo": [],
Expand Down
2 changes: 1 addition & 1 deletion my_compassion/controllers/auth_signup.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ def do_signup(self, qcontext):
("local_id", "=", sponsor_ref),
], limit=1
)
sponsor = child.sponsor_id
sponsor = child.sponsor_id
if sponsor:
if sponsor.email.lower() != qcontext["login"].lower():
raise UserError(_(
Expand Down
10 changes: 4 additions & 6 deletions my_compassion/controllers/my_account.py
Original file line number Diff line number Diff line change
Expand Up @@ -389,7 +389,8 @@ def my_child(self, state="active", child_id=None, **kwargs):
("sent_date", "!=", False),
]
)
gift_categ = request.env.ref("sponsorship_compassion.product_category_gift")
gift_categ = request.env.ref(
"sponsorship_compassion.product_category_gift")
lines = (
request.env["account.move.line"]
.sudo()
Expand All @@ -405,11 +406,8 @@ def my_child(self, state="active", child_id=None, **kwargs):
)
request.session["child_id"] = child.id

gift_base_url = _("https://compassion.ch/de/geschenkformular")
child_gift_params = partner.with_context(
{"mailchimp_child": child}
).wordpress_form_data
url_child_gift = f"{gift_base_url}?{child_gift_params}"
wordpress = request.env["wordpress.configuration"].sudo().get_config(raise_error=False)
url_child_gift = wordpress.child_gift_url or "#"

context = {
"child_id": child,
Expand Down
30 changes: 15 additions & 15 deletions my_compassion/security/access_rules.xml
Original file line number Diff line number Diff line change
@@ -1,37 +1,37 @@
<?xml version="1.0" encoding="UTF-8"?>
<odoo>
<data>
<record id="contract_access_portal" model="ir.rule">
<field name="name">MyCompassion: Contract access</field>
<field name="model_id" ref="recurring_contract.model_recurring_contract"/>
<field name="domain_force">["|", ('partner_id', '=', user.partner_id.id), ('correspondent_id', '=', user.partner_id.id)]</field>
<field name="groups" eval="[(4, ref('base.group_portal'))]"/>
</record>
<record id="contract_group_read_write_unlink_access_portal" model="ir.rule">
<field name="name">Contract group read write unlink access portal</field>
<field name="name">MyCompassion: Contract group access</field>
<field name="model_id" ref="recurring_contract.model_recurring_contract_group"/>
<field name="domain_force">[('partner_id', '=', user.partner_id.id)]</field>
<field name="groups" eval="[(4, ref('base.group_portal'))]"/>
<field name="perm_read" eval="True"/>
<field name="perm_write" eval="True"/>
<field name="perm_create" eval="False"/>
<field name="perm_unlink" eval="True"/>
</record>
<record id="letter_access_portal" model="ir.rule">
<field name="name">MyCompassion: letter access</field>
<field name="model_id" ref="sbc_compassion.model_correspondence"/>
<field name="domain_force">[('partner_id', '=', user.partner_id.id)]</field>
<field name="groups" eval="[(4, ref('base.group_portal'))]"/>
</record>

<record id="my_bank_accounts" model="ir.rule">
<field name="name">My bank accounts</field>
<field name="name">MyCompassion: bank accounts access</field>
<field name="model_id" ref="account.model_res_partner_bank"/>
<field name="domain_force">[('partner_id', 'in', [user.partner_id.id, 1])]</field>
<field name="groups" eval="[(4, ref('base.group_portal'))]"/>
<field name="perm_read" eval="True"/>
<field name="perm_write" eval="False"/>
<field name="perm_create" eval="False"/>
<field name="perm_unlink" eval="False"/>
</record>

<record id="my_churches" model="ir.rule">
<field name="name">My churches</field>
<field name="name">MyCompassion: churches</field>
<field name="model_id" ref="base.model_res_partner"/>
<field name="domain_force">[('is_church', '=', True)]</field>
<field name="groups" eval="[(4, ref('base.group_portal'))]"/>
<field name="perm_read" eval="True"/>
<field name="perm_write" eval="False"/>
<field name="perm_create" eval="False"/>
<field name="perm_unlink" eval="False"/>
</record>
</data>
</odoo>
9 changes: 8 additions & 1 deletion my_compassion/security/ir.model.access.csv
Original file line number Diff line number Diff line change
@@ -1,2 +1,9 @@
id,name,model_id:id,group_id:id,perm_read,perm_write,perm_create,perm_unlink
write_access_partner_portal,Write access partner portal,base.model_res_partner,base.group_portal,1,1,0,0
write_access_partner_portal,MyCompassion: Partner write access,base.model_res_partner,base.group_portal,1,1,0,0
create_correspondence_portal,MyCompassion: Correspondence create access,sbc_compassion.model_correspondence,base.group_portal,1,1,1,0
read_correspondence_template_portal,MyCompassion: Correspondence template read access,sbc_compassion.model_correspondence_template,base.group_portal,1,0,0,0
create_sbc_portal,MyCompassion: Create S2B Generator,sbc_compassion.model_correspondence_s2b_generator,base.group_portal,1,1,1,0
read_child_portal,MyCompassion: Child read access,child_compassion.model_compassion_child,base.group_portal,1,0,0,0
write_contract_portal,MyCompassion: Contract write access,sponsorship_compassion.model_recurring_contract,base.group_portal,1,1,0,0
write_contract_group_portal,MyCompassion: Contract group write access,sponsorship_compassion.model_recurring_contract_group,base.group_portal,1,1,0,0
contract_line_portal,MyCompassion: Contract line full access,sponsorship_compassion.model_recurring_contract_line,base.group_portal,1,1,1,1
10 changes: 5 additions & 5 deletions my_compassion/templates/login_template.xml
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,16 @@
<odoo>
<template id="register_layout" name="Register link">
<h4 class="font-weight-bold text-uppercase mb-4">Signup</h4>
<p style="color: #005eb8;">If you are not yet registered, you can create an account by clicking on the button below.</p>
<p style="color: #005eb8;"> If you already have a Compassion App account, you can use the same credentials to log in.</p>
<a href="/registration?source=myaccount" class="btn btn-primary">Signup now</a>
<p class="text-primary">If you are not yet registered, you can create an account by clicking on the button below.</p>
<p class="text-primary"> If you already have a Compassion App account, you can use the same credentials to log in.</p>
<a href="/web/signup?redirect=/my/home" class="btn btn-primary">Signup now</a>
</template>

<template id="login_layout" inherit_id="website.login_layout">
<xpath expr="t" position="replace">
<t t-call="website.layout">
<div class="container mt-5 mx-auto">
<h1 class="text-uppercase text-center mb-5" style="color: #005eb8; font-size: calc(100% + 1vw + 1vh);">Welcome to <span class="font-weight-bold" t-esc="request.httprequest.host"/></h1>
<h1 class="text-uppercase text-center mb-5 text-primary" style="font-size: calc(100% + 1vw + 1vh);">Welcome to <span class="font-weight-bold" t-esc="request.httprequest.host"/></h1>
<div class="row justify-content-center">
<div class="col-md-4 mx-4 order-md-2 order-lg-2">
<h4 class="font-weight-bold text-uppercase flex-fill mb-4">Log in</h4>
Expand All @@ -20,7 +20,7 @@
<div class="col-md-4 mx-4 order-md-1 mt-4 mt-md-0"><t t-call="my_compassion.register_layout"/></div>
</div>
</div>
<p class="text-center mt-5">Need help? <a href="mailto:[email protected]">[email protected]</a></p>
<p class="text-center mt-5">Need help? <a href="/contactus">Contact us</a></p>
</t>
</xpath>
</template>
Expand Down
8 changes: 0 additions & 8 deletions my_compassion/templates/my_account_components.xml
Original file line number Diff line number Diff line change
Expand Up @@ -40,14 +40,6 @@
</div>
</nav>
<t t-raw="0"/>
<t t-if="env.user.partner_id.write_and_pray">
<t t-if="env.lang == 'fr_CH'">
<script type="text/javascript" t-attf-src="/im_livechat/loader/#{env.ref('my_compassion.livechat_wrpr_fr').id}"></script>
</t>
<t t-if="env.lang == 'de_DE'">
<script type="text/javascript" t-attf-src="/im_livechat/loader/#{env.ref('my_compassion.livechat_wrpr_de').id}"></script>
</t>
</t>
</t>
</template>

Expand Down
66 changes: 0 additions & 66 deletions my_compassion/templates/my_account_contact_us.xml

This file was deleted.

8 changes: 4 additions & 4 deletions my_compassion/templates/my_account_donations.xml
Original file line number Diff line number Diff line change
Expand Up @@ -15,12 +15,12 @@
<!-- 10. current_year, the current year -->
<template id="my_donations_page_template" name="Donations / Invoicing">
<t t-set="selected">donation</t>
<t t-set="title">My financials | <t t-esc="partner.company_id.address_name"/></t>
<t t-set="additional_title">My financials</t>
<t t-call="my_compassion.my_account_layout">
<!-- Load modals for forms -->
<t t-call="cms_form_compassion.modal_form">
<t t-set="form" t-value="payment_options_form"/>
</t>
<!-- <t t-call="cms_form_compassion.modal_form">-->
<!-- <t t-set="form" t-value="payment_options_form"/>-->
<!-- </t>-->

<div class="container" id="my_account_invoicing">
<t t-if="len(groups) > 1">
Expand Down
17 changes: 2 additions & 15 deletions my_compassion/templates/my_account_my_children.xml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
<!-- children in both states) -->
<template id="my_children_page_template" name="My Children">
<t t-set="selected" t-value="'child'"/>
<t t-set="title">My children | <t t-esc="children.mapped('sponsor_id.company_id').address_name"/></t>
<t t-set="additional_title">My children</t>
<t t-call="my_compassion.my_account_layout">
<!-- We allow the user to choose between active or terminated sponsorships if there are some -->
<t t-if="display_state">
Expand Down Expand Up @@ -88,23 +88,10 @@
<div id="my_children_div" class="container" style="overflow-x:auto; overflow-y: hidden;">
<ul class="nav nav-tabs d-inline-flex mx-auto flex-nowrap">
<t t-foreach="children" t-as="child">
<!-- Setting headshot for each child -->
<t t-if="child.image_url">
<t t-set="child_image" t-value="request.env['child.pictures.download.wizard'
].get_picture_url(child.image_url, 'headshot', 150, 150)"/>
</t>
<t t-elif="child.gender == 'M'">
<t t-set="child_image" t-value="'/my_compassion/static/src/img/guy.png'"/>
</t>
<t t-else="">
<t t-set="child_image" t-value="'/my_compassion/static/src/img/lady.png'"/>
</t>

<!-- Creating the actual card for each children -->
<div t-attf-id="child-card-{{child.id}}" t-attf-data-childid="{{child.id}}" t-attf-onclick="selectChild({{child.id}}, {{reload}})" class="child-card card card-clickable text-center text-primary bg-light m-1 mx-auto" style="width: 12rem; height: 13rem;">
<li class="nav-item">
<a class="nav-link border-0">
<img t-attf-id="child-image-{{child.id}}" class="child-image rounded-circle mb-2" t-att-src="child_image" alt="Child image" style="width: 90%; height: 90%;"/>
<img t-attf-id="child-image-{{child.id}}" class="child-image rounded-circle mb-2" t-att-src="child.website_image" alt="Child image" style="width: 90%; height: 90%;"/>
<span t-attf-id="child-name-{{child.id}}" class="child-name" t-esc="child.preferred_name"/>
<br/>
<span t-attf-id="child-local_id-{{child.id}}" class="child-local_id" t-esc="child.local_id"/>
Expand Down
6 changes: 1 addition & 5 deletions my_compassion/templates/my_account_personal_info.xml
Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,10 @@
<!-- 3. delivery_form, a form to modify the partner delivery preferences -->
<template id="my_information_page_template" name="Personal information">
<t t-set="selected" t-value="'info'"/>
<t t-set="title">My personal data | <t t-esc="partner.company_id.address_name"/></t>
<t t-set="additional_title">My personal data</t>
<t t-call="my_compassion.my_account_layout">
<div class="container">
<!-- Load modals for forms -->
<t t-set="form" t-value="coordinates_form"/>
<t t-call="cms_form_compassion.modal_form"/>
<t t-set="form" t-value="delivery_form"/>
<t t-call="cms_form_compassion.modal_form"/>
<div class="row">
<!-- Coordinates -->
<div class="col-md-6">
Expand Down
2 changes: 1 addition & 1 deletion my_compassion/templates/my_account_write_a_letter.xml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
<!-- 4. templates, The proposed templates of the database -->
<template id="letter_page_template" name="Write a letter">
<t t-set="selected" t-value="'letter'"/>
<t t-set="title">Write a letter | <t t-esc="partner.company_id.address_name"/></t>
<t t-set="additional_title">Write a letter</t>
<t t-call="my_compassion.my_account_layout">
<t t-call="my_compassion.letter_horizontal_pictures"/>

Expand Down
2 changes: 1 addition & 1 deletion my_compassion_segmentation/templates/survey_templates.xml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<template id="custom_survey_layout" inherit_id="survey.survey_fill_form_start">
<xpath expr="//div[@class='wrap o_survey_start']/div">
<t t-if="survey == survey.env.ref('partner_segmentation.partner_segmentation_survey')">
<a role="button" class="btn btn-muted btn-lg" href="/my/children">Ask me again later</a>
<a role="button" class="btn btn-light btn-lg" href="/my/children">Ask me again later</a>
</t>
</xpath>
</template>
Expand Down
2 changes: 1 addition & 1 deletion website_sponsorship/__manifest__.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
"license": "AGPL-3",
"website": "https://www.compassion.ch",
"depends": [
"crm_compassion",
"sponsorship_compassion",
"partner_auto_match",
"partner_search_fuzzy",
"website_form",
Expand Down
2 changes: 1 addition & 1 deletion website_sponsorship/views/data_protection_view.xml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<record id="privacy_statement_publish_form" model="ir.ui.view">
<field name="name">privacy.statement.publish</field>
<field name="model">compassion.privacy.statement</field>
<field name="inherit_id" ref="sponsorship_compassion.res_personal_data_agreement_form"/>
<field name="inherit_id" ref="partner_personal_info.res_personal_data_agreement_form"/>
<field name="arch" type="xml">
<xpath expr="//sheet/group[1]" position="before">
<field name="website_published" invisible="1"/>
Expand Down

0 comments on commit a061895

Please sign in to comment.