Skip to content

Commit

Permalink
[ADD] portal_partner_isr
Browse files Browse the repository at this point in the history
  • Loading branch information
mclaeysb committed Apr 15, 2020
1 parent a23ca76 commit e2a733d
Show file tree
Hide file tree
Showing 5 changed files with 63 additions and 0 deletions.
1 change: 1 addition & 0 deletions portal_partner_isr/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
from . import controllers
24 changes: 24 additions & 0 deletions portal_partner_isr/__manifest__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
# Copyright 2020- Coop IT Easy SCRLfs (<http://www.coopiteasy.be>)
# - Manuel Claeys Bouuaert - <[email protected]>
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl.html).

{
'name': 'Portal Partner ISR',
'version': '11.0.1.0.0',
'author': 'Coop IT Easy SCRLfs',
'category': 'Website',
'website': 'https://www.coopiteasy.be',
'license': 'AGPL-3',
'description': """
This module adds a button on the client portal to an externally generated ISR slip.
""",
'depends': [
'portal',
'partner_isr',
'distribution_circuits_website_sale',
],
'data': [
'views/partner_isr.xml'
],
'installable': True,
}
1 change: 1 addition & 0 deletions portal_partner_isr/controllers/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
from . import main
17 changes: 17 additions & 0 deletions portal_partner_isr/controllers/main.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
# Copyright 2018 Rémy Taymans <[email protected]>
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).

from odoo import http
from odoo.http import request


class PortalISR(http.Controller):

@http.route("/isr", type="http", auth="user", website=True)
def isr(self):
partner = request.env.user.partner_id
if partner.isr_number:
url = "https://tools.hsolutions.ch/outils/bvrlignon/?bvr=" + partner.isr_number
return request.redirect(url)
else:
return request.redirect("my/credit_account")
20 changes: 20 additions & 0 deletions portal_partner_isr/views/partner_isr.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
Copyright 2018 Rémy Taymans <[email protected]>
License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
-->
<odoo>

<template id="partner_isr" name="Partner ISR" inherit_id="distribution_circuits_website_sale.credit_account">
<xpath expr="//h3" position="after">
<p t-if="user_id.partner_id.isr_number">
<span>Your ISR number is:</span> <span t-field="user_id.partner_id.isr_number"/>
<a href="/isr" class="btn btn-default btn-xs">Print ISR slip</a>
</p>
<p t-else="">
You have not been assigned an ISR number yet.
</p>
</xpath>
</template>

</odoo>

0 comments on commit e2a733d

Please sign in to comment.