Browse Source
[ADD] emc_w_taxshelter: Tax Shelter Certificate
[ADD] emc_w_taxshelter: Tax Shelter Certificate
Add the list of tax shelter certificate in the website portal. There is some issue with the access right. This must be fixed later.pull/1/head
Rémy Taymans
7 years ago
7 changed files with 252 additions and 0 deletions
-
2easy_my_coop_website_taxshelter/__init__.py
-
31easy_my_coop_website_taxshelter/__openerp__.py
-
2easy_my_coop_website_taxshelter/controllers/__init__.py
-
80easy_my_coop_website_taxshelter/controllers/main.py
-
4easy_my_coop_website_taxshelter/security/ir.model.access.csv
-
43easy_my_coop_website_taxshelter/security/tax_shelter_portal_security.xml
-
90easy_my_coop_website_taxshelter/views/easy_my_coop_website_taxshelter_templates.xml
@ -0,0 +1,2 @@ |
|||
# -*- coding: utf8 -*- |
|||
import controllers |
@ -0,0 +1,31 @@ |
|||
# -*- 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 Tax Shelter Website', |
|||
|
|||
'summary': """ |
|||
Give access to Tax Shelter Report 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', |
|||
'easy_my_coop_taxshelter_report', |
|||
], |
|||
|
|||
'data': [ |
|||
'views/easy_my_coop_website_taxshelter_templates.xml', |
|||
] |
|||
} |
@ -0,0 +1,2 @@ |
|||
# -*- coding: utf-8 -*- |
|||
from . import main |
@ -0,0 +1,80 @@ |
|||
# -*- coding: utf-8 -*- |
|||
|
|||
# Copyright 2015-2016 Odoo S.A. |
|||
# Copyright 2016 Jairo Llopis <jairo.llopis@tecnativa.com> |
|||
# Copyright 2017-2018 Rémy Taymans <remytaymans@gmail.com> |
|||
# 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): |
|||
|
|||
@http.route() |
|||
def account(self): |
|||
""" Add Tax Shelter Certificate to main account page """ |
|||
response = super(CooperatorWebsiteAccount, self).account() |
|||
partner = request.env.user.partner_id |
|||
|
|||
tax_shelter_mgr = request.env['tax.shelter.certificate'].sudo() |
|||
tax_shelter_count = tax_shelter_mgr.search_count([ |
|||
('partner_id', 'in', [partner.commercial_partner_id.id]), |
|||
]) |
|||
|
|||
response.qcontext.update({ |
|||
'tax_shelter_count': tax_shelter_count, |
|||
}) |
|||
return response |
|||
|
|||
@http.route( |
|||
['/my/tax_shelter_certificate', |
|||
'/my/tax_shelter_certificate/page/<int:page>'], |
|||
type='http', auth="user", website=True) |
|||
def portal_my_tax_shelter_certificate(self, page=1, date_begin=None, |
|||
date_end=None, **kw): |
|||
"""Render a page that lits the tax shelter report: |
|||
* Subscriptions Certificates |
|||
* Shares Certifcates |
|||
""" |
|||
values = self._prepare_portal_layout_values() |
|||
partner = request.env.user.partner_id |
|||
tax_shelter_mgr = request.env['tax.shelter.certificate'].sudo() |
|||
|
|||
domain = [ |
|||
('partner_id', 'in', [partner.commercial_partner_id.id]), |
|||
] |
|||
|
|||
if date_begin and date_end: |
|||
domain += [('create_date', '>=', date_begin), |
|||
('create_date', '<', date_end)] |
|||
|
|||
# count for pager |
|||
tax_shelter_count = tax_shelter_mgr.search_count(domain) |
|||
# pager |
|||
pager = request.website.pager( |
|||
url="/my/tax_shelter_certificate", |
|||
url_args={'date_begin': date_begin, 'date_end': date_end}, |
|||
total=tax_shelter_count, |
|||
page=page, |
|||
step=self._items_per_page |
|||
) |
|||
# content according to pager and archive selected |
|||
tax_shelters = tax_shelter_mgr.search( |
|||
domain, limit=self._items_per_page, offset=pager['offset']) |
|||
values.update({ |
|||
'date': date_begin, |
|||
'tax_shelters': tax_shelters, |
|||
'page_name': 'invoice', |
|||
'pager': pager, |
|||
'default_url': '/my/tax_shelter_certificate', |
|||
}) |
|||
return request.website.render( |
|||
"easy_my_coop_website_taxshelter.portal_my_tax_shelter", |
|||
values |
|||
) |
@ -0,0 +1,4 @@ |
|||
id,name,model_id:id,group_id:id,perm_read,perm_write,perm_create,perm_unlink |
|||
access_tax_shelter_declaration,tax.shelter.declaration.portal,easy_my_coop_taxshelter_report.model_tax_shelter_declaration,base.group_portal,1,0,0,0 |
|||
access_tax_shelter_certificate,tax.shelter.certificate.portal,easy_my_coop_taxshelter_report.model_tax_shelter_certificate,base.group_portal,1,0,0,0 |
|||
access_tax_shelter_certificate_lines,certificate.line.portal,easy_my_coop_taxshelter_report.model_certificate_line,base.group_portal,1,0,0,0 |
@ -0,0 +1,43 @@ |
|||
<?xml version="1.0" encoding="utf-8"?> |
|||
<!-- |
|||
Copyright 2015-2016 Odoo S.A. |
|||
Copyright 2018 Rémy Taymans <remytaymans@gmail.com> |
|||
License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). |
|||
--> |
|||
<openerp> |
|||
<data noupdate="0"> |
|||
<!-- Tax Shelter Access Rules --> |
|||
<record id="emc_portal_tax_shelter_certificate_rule" model="ir.rule"> |
|||
<field name="name"> |
|||
Easy My Coop Portal Tax Shelter Certificate |
|||
</field> |
|||
<field name="model_id" |
|||
ref="easy_my_coop_taxshelter_report.model_tax_shelter_certificate"/> |
|||
<field name="domain_force"> |
|||
[('partner_id', 'in', [user.commercial_partner_id.id])] |
|||
</field> |
|||
<field name="groups" eval="[(6, 0, [ref('base.group_portal')])]"/> |
|||
</record> |
|||
|
|||
<record id="emc_portal_tax_shelter_certificate_line_rule" model="ir.rule"> |
|||
<field name="name"> |
|||
Easy My Coop Portal Tax Shelter Certificate line |
|||
</field> |
|||
<field name="model_id" |
|||
ref="easy_my_coop_taxshelter_report.model_certificate_line"/> |
|||
<field name="domain_force"> |
|||
[('tax_shelter_certificate.partner_id','in', [user.commercial_partner_id.id])] |
|||
</field> |
|||
<field name="groups" eval="[(6, 0, [ref('base.group_portal')])]"/> |
|||
</record> |
|||
|
|||
<record id="emc_portal_personal_contact" model="ir.rule"> |
|||
<field name="name">Easy My Coop Portal Personal Contacts</field> |
|||
<field name="model_id" ref="base.model_res_partner"/> |
|||
<field name="domain_force"> |
|||
[('id', 'in', [user.commercial_partner_id.id])] |
|||
</field> |
|||
<field name="groups" eval="[(6, 0, [ref('base.group_portal')])]"/> |
|||
</record> |
|||
</data> |
|||
</openerp> |
@ -0,0 +1,90 @@ |
|||
<?xml version="1.0" encoding="utf-8"?> |
|||
<!-- |
|||
Copyright 2015-2016 Odoo S.A. |
|||
Copyright 2016 Jairo Llopis <jairo.llopis@tecnativa.com> |
|||
Copyright 2018 Rémy Taymans <remytaymans@gmail.com> |
|||
License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). |
|||
--> |
|||
<openerp> |
|||
|
|||
<!-- Tax Shelter Certificate in the menu --> |
|||
<template |
|||
id="portal_my_home_menu_tax_shelter" |
|||
name="Portal Menu: Easy My Coop Tax Shelter Certificate" |
|||
inherit_id="website_portal_v10.portal_layout" |
|||
priority="25"> |
|||
<xpath expr="//ul[contains(@class,'o_portal_submenu')]" |
|||
position="inside"> |
|||
<li> |
|||
<a href="/my/tax_shelter_certificate"> |
|||
Tax Shelter Certificate |
|||
</a> |
|||
</li> |
|||
</xpath> |
|||
</template> |
|||
|
|||
<!-- Tax Shelter Certificate on the main page --> |
|||
<template |
|||
id="portal_my_home_tax_shelter" |
|||
name="Portal My Home : Easy My Coop Tax Shelter Certificate" |
|||
inherit_id="website_portal_v10.portal_my_home" |
|||
priority="25"> |
|||
<xpath expr="//div[contains(@class,'o_my_home_content')]" |
|||
position="inside"> |
|||
<h3 class="page-header"> |
|||
<a href="/my/tax_shelter_certificate"> |
|||
Your Tax Shelter Certificate |
|||
<small class="ml8"> |
|||
<t t-if="tax_shelter_count"> |
|||
<span class='badge'> |
|||
<t t-esc="tax_shelter_count"/> |
|||
</span> |
|||
</t> |
|||
<t t-if="not tax_shelter_count"> |
|||
There are currently no tax shelter certificate for your |
|||
account. |
|||
</t> |
|||
</small> |
|||
</a> |
|||
</h3> |
|||
</xpath> |
|||
</template> |
|||
|
|||
<!-- Tax Shelter Certificate page --> |
|||
<template id="portal_my_tax_shelter" name="My Tax Shelter"> |
|||
<t t-call="website_portal_v10.portal_layout"> |
|||
<h3 class="page-header">Your Tax Shelter Certificate</h3> |
|||
<t t-if="not tax_shelters"> |
|||
<p> |
|||
There are currently no tax shelter certificate for your |
|||
account. |
|||
</p> |
|||
</t> |
|||
<t t-if="tax_shelters"> |
|||
<table class="table table-hover o_my_status_table"> |
|||
<thead> |
|||
<tr class="active"> |
|||
<th>Declaration Year</th> |
|||
<th>Total Amount</th> |
|||
</tr> |
|||
</thead> |
|||
<tbody> |
|||
<tr t-foreach="tax_shelters" t-as="tax_shelter"> |
|||
<td> |
|||
<a t-att-href="'/report/pdf/easy_my_coop_taxshelter_report.tax_shelter_subscription_report/%s' % |
|||
tax_shelter.id"> |
|||
<t t-esc="tax_shelter.declaration_id.name"/> |
|||
</a> |
|||
</td> |
|||
<td><span t-field="tax_shelter.total_amount"/></td> |
|||
</tr> |
|||
</tbody> |
|||
</table> |
|||
<div t-if="pager" class="o_portal_pager text-center"> |
|||
<t t-call="website.pager"/> |
|||
</div> |
|||
</t> |
|||
</t> |
|||
</template> |
|||
|
|||
</openerp> |
Write
Preview
Loading…
Cancel
Save
Reference in new issue