Browse Source
[ADD] emc_wsite_portal: Cooperator information
[ADD] emc_wsite_portal: Cooperator information
Add the cooperator information on the /my/home page.pull/1/head
Rémy Taymans
7 years ago
5 changed files with 159 additions and 0 deletions
-
2easy_my_coop_website_portal/__init__.py
-
30easy_my_coop_website_portal/__openerp__.py
-
2easy_my_coop_website_portal/controllers/__init__.py
-
35easy_my_coop_website_portal/controllers/main.py
-
90easy_my_coop_website_portal/views/easy_my_coop_website_portal_templates.xml
@ -0,0 +1,2 @@ |
|||||
|
# -*- coding: utf8 -*- |
||||
|
import controllers |
@ -0,0 +1,30 @@ |
|||||
|
# -*- coding: utf-8 -*- |
||||
|
|
||||
|
# Copyright 2018 Rémy Taymans <remytaymans@gmail.com> |
||||
|
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). |
||||
|
|
||||
|
{ |
||||
|
'name': 'Easy My Coop Website Portal', |
||||
|
|
||||
|
'summary': """ |
||||
|
Show cooperator information in the website portal. |
||||
|
""", |
||||
|
'description': """ |
||||
|
""", |
||||
|
|
||||
|
'author': 'Rémy Taymans', |
||||
|
'license': 'AGPL-3', |
||||
|
'version': '9.0.1.0', |
||||
|
'website': "https://github.com/houssine78/vertical-cooperative", |
||||
|
|
||||
|
'category': 'Website, Cooperative Management', |
||||
|
|
||||
|
'depends': [ |
||||
|
'website', |
||||
|
'website_portal_v10', |
||||
|
], |
||||
|
|
||||
|
'data': [ |
||||
|
'views/easy_my_coop_website_portal_templates.xml', |
||||
|
] |
||||
|
} |
@ -0,0 +1,2 @@ |
|||||
|
# -*- coding: utf-8 -*- |
||||
|
from . import main |
@ -0,0 +1,35 @@ |
|||||
|
# -*- coding: utf-8 -*- |
||||
|
|
||||
|
# Copyright 2017-2018 Rémy Taymans <remytaymans@gmail.com> |
||||
|
# Copyright 2018 Odoo SA |
||||
|
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). |
||||
|
|
||||
|
|
||||
|
from openerp import fields, models, http |
||||
|
from openerp.http import request |
||||
|
from openerp import tools |
||||
|
from openerp.tools.translate import _ |
||||
|
|
||||
|
from openerp.addons.website_portal_v10.controllers.main import WebsiteAccount |
||||
|
|
||||
|
|
||||
|
class CooperatorWebsiteAccount(WebsiteAccount): |
||||
|
|
||||
|
def _prepare_portal_layout_values(self): |
||||
|
values = super(CooperatorWebsiteAccount, |
||||
|
self)._prepare_portal_layout_values() |
||||
|
# We assume that commercial_partner_id always point to the |
||||
|
# partner itself or to the linked partner. So there is no |
||||
|
# need to check if the partner is a "contact" or not. |
||||
|
coop = request.env.user.partner_id.commercial_partner_id |
||||
|
coop_bank = request.env['res.partner.bank'].search( |
||||
|
[('partner_id', '=', coop.id)], |
||||
|
limit=1 |
||||
|
) |
||||
|
values.update({ |
||||
|
'coop': coop, |
||||
|
'coop_bank': coop_bank, |
||||
|
}) |
||||
|
return values |
||||
|
|
||||
|
|
@ -0,0 +1,90 @@ |
|||||
|
<?xml version="1.0" encoding="utf-8"?> |
||||
|
<!-- |
||||
|
Copyright 2018 Rémy Taymans <remytaymans@gmail.com> |
||||
|
License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). |
||||
|
--> |
||||
|
<openerp> |
||||
|
|
||||
|
<!-- Add cooperator information --> |
||||
|
<template |
||||
|
id="website_portal_details_form" |
||||
|
name="Website Portal Details Form" |
||||
|
inherit_id="website_portal_v10.portal_layout"> |
||||
|
<xpath expr="//div[@class='o_my_details']" position="after"> |
||||
|
<div class="o_my_details_coop" t-if="coop.member"> |
||||
|
<h3 class="page-header">Your Cooperator Details</h3> |
||||
|
<p class="text-center"> |
||||
|
<span t-if="coop.member"> |
||||
|
You are an effective cooperator |
||||
|
</span> |
||||
|
<span t-if="not coop.member"> |
||||
|
You are not a cooperator |
||||
|
</span> |
||||
|
</p> |
||||
|
<p t-if="coop.cooperator_register_number"> |
||||
|
<label>Cooperator Number: </label> |
||||
|
<t t-esc="coop.cooperator_register_number"/> |
||||
|
</p> |
||||
|
<p t-if="coop.effective_date"> |
||||
|
<label>Cooperator Entrance Date: </label> |
||||
|
<span t-field="coop.effective_date"/> |
||||
|
</p> |
||||
|
<p t-if="coop.number_of_share"> |
||||
|
<label>Number of Share: </label> |
||||
|
<t t-esc="coop.number_of_share"/> |
||||
|
</p> |
||||
|
<p t-if="coop.share_ids"> |
||||
|
<div t-foreach="coop.share_ids" t-as="share"> |
||||
|
<span t-field="share.effective_date"/>: |
||||
|
<t t-esc="share.share_number"/> x |
||||
|
<t t-esc="share.share_short_name"/> |
||||
|
(<span t-field="share.share_unit_price" |
||||
|
t-field-options='{ |
||||
|
"widget": "monetary", |
||||
|
"display_currency": "coop.company_id.currency_id" |
||||
|
}'/>) - |
||||
|
<span t-field="share.total_amount_line" |
||||
|
t-field-options='{ |
||||
|
"widget": "monetary", |
||||
|
"display_currency": "coop.company_id.currency_id" |
||||
|
}'/> |
||||
|
</div> |
||||
|
</p> |
||||
|
<p t-if="coop.total_value"> |
||||
|
<label>Total Value of Share: </label> |
||||
|
<span t-field="coop.total_value" |
||||
|
t-field-options='{ |
||||
|
"widget": "monetary", |
||||
|
"display_currency": "coop.company_id.currency_id" |
||||
|
}'/> |
||||
|
</p> |
||||
|
|
||||
|
<p t-if="coop.gender"> |
||||
|
<label>Gender: </label> |
||||
|
<t t-esc="coop.gender"/> |
||||
|
</p> |
||||
|
<p t-if="coop.birthdate"> |
||||
|
<label>Date of Birth: </label> |
||||
|
<t t-esc="coop.birthdate"/> |
||||
|
</p> |
||||
|
<p t-if="coop_bank and coop_bank.acc_number"> |
||||
|
<label>Bank Account: </label> |
||||
|
<t t-esc="coop_bank.acc_number"/> |
||||
|
</p> |
||||
|
<p t-if="coop.national_register_number"> |
||||
|
<label>National Register Number: </label> |
||||
|
<t t-esc="coop.national_register_number"/> |
||||
|
</p> |
||||
|
<p t-if="coop.company_register_number"> |
||||
|
<label>Company Register Number: </label> |
||||
|
<t t-esc="coop.company_register_number"/> |
||||
|
</p> |
||||
|
<p t-if="coop.representative"> |
||||
|
<label>Legal Representative: </label> |
||||
|
<t t-esc="coop.representative"/> |
||||
|
</p> |
||||
|
</div> |
||||
|
</xpath> |
||||
|
</template> |
||||
|
|
||||
|
</openerp> |
Write
Preview
Loading…
Cancel
Save
Reference in new issue