Browse Source

[ADD] website_eater: Information about eaters

Add the eater information in the website portal.
pull/40/head
Rémy Taymans 7 years ago
parent
commit
7255713421
  1. 2
      beesdoo_website_eater/__init__.py
  2. 31
      beesdoo_website_eater/__openerp__.py
  3. 2
      beesdoo_website_eater/controllers/__init__.py
  4. 21
      beesdoo_website_eater/controllers/main.py
  5. 31
      beesdoo_website_eater/views/beesdoo_website_eater_templates.xml

2
beesdoo_website_eater/__init__.py

@ -0,0 +1,2 @@
# -*- coding: utf8 -*-
import controllers

31
beesdoo_website_eater/__openerp__.py

@ -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': 'BEES coop Website Eater',
'summary': """
Show the eaters of a cooperator in the website portal.
""",
'description': """
""",
'author': 'Rémy Taymans',
'license': 'AGPL-3',
'version': '9.0.1.0',
'website': "https://github.com/beescoop/Obeesdoo",
'category': 'Website',
'depends': [
'website',
'website_portal_v10',
'beesdoo_base',
],
'data': [
'views/beesdoo_website_eater_templates.xml',
]
}

2
beesdoo_website_eater/controllers/__init__.py

@ -0,0 +1,2 @@
# -*- coding: utf-8 -*-
from . import main

21
beesdoo_website_eater/controllers/main.py

@ -0,0 +1,21 @@
# -*- coding: utf-8 -*-
# Copyright 2018 Rémy Taymans <remytaymans@gmail.com>
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
from openerp.http import request
from openerp.addons.website_portal_v10.controllers.main import WebsiteAccount
class EaterWebsiteAccount(WebsiteAccount):
def _prepare_portal_layout_values(self):
values = super(EaterWebsiteAccount,
self)._prepare_portal_layout_values()
partner = request.env.user.partner_id.commercial_partner_id
values.update({
'eaters': partner.child_eater_ids,
})
return values

31
beesdoo_website_eater/views/beesdoo_website_eater_templates.xml

@ -0,0 +1,31 @@
<?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 eater information -->
<template
id="website_eater_details_side"
name="Website Eater Details Side"
priority="50"
inherit_id="website_portal_v10.portal_layout">
<xpath expr="//div[@class='o_my_details']" position="after">
<div class="o_my_details_eater">
<h3 class="page-header">Your Eaters</h3>
<p class="text-center">
<ul t-if="eaters">
<li t-foreach="eaters" t-as="eater">
<t t-esc="eater.name"/>
</li>
</ul>
<span t-if="not eaters">
You have no eaters
</span>
</p>
</div>
</xpath>
</template>
</openerp>
Loading…
Cancel
Save