Browse Source

Merge pull request #132 from beescoop/12.0-mig-beesdoo_website_eater

[MIG] 12.0 mig beesdoo website eater
pull/148/head
Rémy Taymans 5 years ago
committed by GitHub
parent
commit
139e86b145
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
  1. 1
      beesdoo_website_eater/__init__.py
  2. 29
      beesdoo_website_eater/__manifest__.py
  3. 1
      beesdoo_website_eater/controllers/__init__.py
  4. 19
      beesdoo_website_eater/controllers/main.py
  5. 32
      beesdoo_website_eater/views/beesdoo_website_eater_templates.xml

1
beesdoo_website_eater/__init__.py

@ -0,0 +1 @@
from . import controllers

29
beesdoo_website_eater/__manifest__.py

@ -0,0 +1,29 @@
# 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': '12.0.1.0.0',
'website': "https://github.com/beescoop/Obeesdoo",
'category': 'Website',
'depends': [
'website',
'portal',
'beesdoo_base',
],
'data': [
'views/beesdoo_website_eater_templates.xml',
]
}

1
beesdoo_website_eater/controllers/__init__.py

@ -0,0 +1 @@
from . import main

19
beesdoo_website_eater/controllers/main.py

@ -0,0 +1,19 @@
# Copyright 2018 Rémy Taymans <remytaymans@gmail.com>
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
from odoo.http import request
from odoo.addons.portal.controllers.portal import CustomerPortal
class EaterWebsiteAccount(CustomerPortal):
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

32
beesdoo_website_eater/views/beesdoo_website_eater_templates.xml

@ -0,0 +1,32 @@
<?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).
-->
<odoo>
<!-- Add eater information -->
<template
id="website_eater_details_side"
name="Website Eater Details Side"
priority="50"
inherit_id="portal.portal_layout">
<xpath expr="//div[@class='o_portal_my_details']" position="after">
<div class="o_my_details_eater mt-2">
<h4 class="page-header">Your Eaters</h4>
<hr class="mt-1 mb-0" />
<p>
<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>
</odoo>
Loading…
Cancel
Save