@ -0,0 +1,47 @@ |
|||||
|
.. image:: https://img.shields.io/badge/license-AGPL--3-blue.svg |
||||
|
:target: https://www.gnu.org/licenses/agpl-3.0-standalone.html |
||||
|
:alt: License: AGPL-3 |
||||
|
|
||||
|
Shopping Through Agent |
||||
|
====================== |
||||
|
This module enables agent to create sale orders on a website shop |
||||
|
on behalf of the customer. |
||||
|
|
||||
|
Configuration |
||||
|
============= |
||||
|
No additional configuration needed. |
||||
|
|
||||
|
License |
||||
|
------- |
||||
|
Affero General Public License v3.0 (AGPL v3) |
||||
|
(https://www.gnu.org/licenses/agpl-3.0-standalone.html) |
||||
|
|
||||
|
Company |
||||
|
------- |
||||
|
* `Cybrosys Techno Solutions <https://cybrosys.com/>`__ |
||||
|
|
||||
|
Credits |
||||
|
------- |
||||
|
* Developer : (V18) Ashok P K |
||||
|
Contact : odoo@cybrosys.com |
||||
|
|
||||
|
Contacts |
||||
|
-------- |
||||
|
* Mail Contact : odoo@cybrosys.com |
||||
|
* Website : https://cybrosys.com |
||||
|
|
||||
|
Bug Tracker |
||||
|
----------- |
||||
|
Bugs are tracked on GitHub Issues. In case of trouble, please check there if your issue has already been reported. |
||||
|
|
||||
|
Maintainer |
||||
|
========== |
||||
|
.. image:: https://cybrosys.com/images/logo.png |
||||
|
:target: https://cybrosys.com |
||||
|
|
||||
|
This module is maintained by Cybrosys Technologies. |
||||
|
For support and more information, please visit `Our Website <https://cybrosys.com/>`__ |
||||
|
|
||||
|
Further information |
||||
|
=================== |
||||
|
HTML Description: `<static/description/index.html>`__ |
@ -0,0 +1,23 @@ |
|||||
|
# -*- coding: utf-8 -*- |
||||
|
################################################################################ |
||||
|
# |
||||
|
# Cybrosys Technologies Pvt. Ltd. |
||||
|
# Copyright (C) 2024-TODAY Cybrosys Technologies(<https://www.cybrosys.com>). |
||||
|
# Author: Ashok PK (odoo@cybrosys.com) |
||||
|
# |
||||
|
# This program is free software: you can modify |
||||
|
# it under the terms of the GNU Affero General Public License (AGPL) as |
||||
|
# published by the Free Software Foundation, either version 3 of the |
||||
|
# License, or (at your option) any later version. |
||||
|
# |
||||
|
# This program is distributed in the hope that it will be useful, |
||||
|
# but WITHOUT ANY WARRANTY; without even the implied warranty of |
||||
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
||||
|
# GNU Affero General Public License for more details. |
||||
|
# |
||||
|
# You should have received a copy of the GNU Affero General Public License |
||||
|
# along with this program. If not, see <https://www.gnu.org/licenses/>. |
||||
|
# |
||||
|
################################################################################ |
||||
|
from . import controllers |
||||
|
from . import models |
@ -0,0 +1,49 @@ |
|||||
|
# -*- coding: utf-8 -*- |
||||
|
################################################################################ |
||||
|
# |
||||
|
# Cybrosys Technologies Pvt. Ltd. |
||||
|
# Copyright (C) 2024-TODAY Cybrosys Technologies(<https://www.cybrosys.com>). |
||||
|
# Author: Ashok PK (odoo@cybrosys.com) |
||||
|
# |
||||
|
# This program is free software: you can modify |
||||
|
# it under the terms of the GNU Affero General Public License (AGPL) as |
||||
|
# published by the Free Software Foundation, either version 3 of the |
||||
|
# License, or (at your option) any later version. |
||||
|
# |
||||
|
# This program is distributed in the hope that it will be useful, |
||||
|
# but WITHOUT ANY WARRANTY; without even the implied warranty of |
||||
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
||||
|
# GNU Affero General Public License for more details. |
||||
|
# |
||||
|
# You should have received a copy of the GNU Affero General Public License |
||||
|
# along with this program. If not, see <https://www.gnu.org/licenses/>. |
||||
|
# |
||||
|
################################################################################ |
||||
|
{ |
||||
|
'name': 'Shopping Through Agent', |
||||
|
'version': '18.0.1.0.0', |
||||
|
'category': 'eCommerce', |
||||
|
'summary': 'Agent can shop onbehalf of the customer.', |
||||
|
'description': "Enables agent to create sale orders on a website shop on " |
||||
|
"behalf of the customer.", |
||||
|
'author': 'Cybrosys Techno Solutions', |
||||
|
'company': 'Cybrosys Techno Solutions', |
||||
|
'maintainer': 'Cybrosys Techno Solutions', |
||||
|
'website': "https://www.cybrosys.com", |
||||
|
'depends': ['website_sale', 'sale_management'], |
||||
|
'data': [ |
||||
|
'data/website_menu_data.xml', |
||||
|
'views/res_partner_views.xml', |
||||
|
'views/sale_order_views.xml', |
||||
|
'views/account_move_views.xml', |
||||
|
'views/agent_shop_template.xml', |
||||
|
'views/sale_order_portal_template.xml', |
||||
|
'views/invoice_report_template.xml', |
||||
|
'views/sale_order_report_template.xml', |
||||
|
], |
||||
|
'images': ['static/description/banner.jpg'], |
||||
|
'license': 'AGPL-3', |
||||
|
'installable': True, |
||||
|
'auto_install': False, |
||||
|
'application': False, |
||||
|
} |
@ -0,0 +1,23 @@ |
|||||
|
# -*- coding: utf-8 -*- |
||||
|
################################################################################ |
||||
|
# |
||||
|
# Cybrosys Technologies Pvt. Ltd. |
||||
|
# Copyright (C) 2024-TODAY Cybrosys Technologies(<https://www.cybrosys.com>). |
||||
|
# Author: Ashok PK (odoo@cybrosys.com) |
||||
|
# |
||||
|
# This program is free software: you can modify |
||||
|
# it under the terms of the GNU Affero General Public License (AGPL) as |
||||
|
# published by the Free Software Foundation, either version 3 of the |
||||
|
# License, or (at your option) any later version. |
||||
|
# |
||||
|
# This program is distributed in the hope that it will be useful, |
||||
|
# but WITHOUT ANY WARRANTY; without even the implied warranty of |
||||
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
||||
|
# GNU Affero General Public License for more details. |
||||
|
# |
||||
|
# You should have received a copy of the GNU Affero General Public License |
||||
|
# along with this program. If not, see <https://www.gnu.org/licenses/>. |
||||
|
# |
||||
|
################################################################################ |
||||
|
from . import shopping_through_agent |
||||
|
from . import website_sale |
@ -0,0 +1,33 @@ |
|||||
|
# -*- coding: utf-8 -*- |
||||
|
################################################################################ |
||||
|
# |
||||
|
# Cybrosys Technologies Pvt. Ltd. |
||||
|
# Copyright (C) 2024-TODAY Cybrosys Technologies(<https://www.cybrosys.com>). |
||||
|
# Author: Ashok PK (odoo@cybrosys.com) |
||||
|
# |
||||
|
# This program is free software: you can modify |
||||
|
# it under the terms of the GNU Affero General Public License (AGPL) as |
||||
|
# published by the Free Software Foundation, either version 3 of the |
||||
|
# License, or (at your option) any later version. |
||||
|
# |
||||
|
# This program is distributed in the hope that it will be useful, |
||||
|
# but WITHOUT ANY WARRANTY; without even the implied warranty of |
||||
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
||||
|
# GNU Affero General Public License for more details. |
||||
|
# |
||||
|
# You should have received a copy of the GNU Affero General Public License |
||||
|
# along with this program. If not, see <https://www.gnu.org/licenses/>. |
||||
|
# |
||||
|
################################################################################ |
||||
|
from odoo.http import Controller, request, route |
||||
|
|
||||
|
|
||||
|
class Agent(Controller): |
||||
|
"""Class for the function to render a new page""" |
||||
|
@route(route='/agent/shop', auth='user', website=True) |
||||
|
def agent(self): |
||||
|
"""Function to pass the data to shop and also to clearing the cart""" |
||||
|
customer_ids = request.env['res.partner'].search( |
||||
|
[('agent_id', '=', request.env.user.partner_id.id)]) |
||||
|
return request.render('shopping_through_agent.agent_shop_template', |
||||
|
{'customer_ids': customer_ids}) |
@ -0,0 +1,153 @@ |
|||||
|
# -*- coding: utf-8 -*- |
||||
|
################################################################################ |
||||
|
# |
||||
|
# Cybrosys Technologies Pvt. Ltd. |
||||
|
# Copyright (C) 2024-TODAY Cybrosys Technologies(<https://www.cybrosys.com>). |
||||
|
# Author: Ashok PK (odoo@cybrosys.com) |
||||
|
# |
||||
|
# This program is free software: you can modify |
||||
|
# it under the terms of the GNU Affero General Public License (AGPL) as |
||||
|
# published by the Free Software Foundation, either version 3 of the |
||||
|
# License, or (at your option) any later version. |
||||
|
# |
||||
|
# This program is distributed in the hope that it will be useful, |
||||
|
# but WITHOUT ANY WARRANTY; without even the implied warranty of |
||||
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
||||
|
# GNU Affero General Public License for more details. |
||||
|
# |
||||
|
# You should have received a copy of the GNU Affero General Public License |
||||
|
# along with this program. If not, see <https://www.gnu.org/licenses/>. |
||||
|
# |
||||
|
################################################################################ |
||||
|
from odoo.addons.payment.controllers import portal as payment_portal |
||||
|
from odoo.http import request |
||||
|
|
||||
|
|
||||
|
class WebsiteSale(payment_portal.PaymentPortal): |
||||
|
"""Class to inherit the functions in the website sale""" |
||||
|
|
||||
|
def shop(self, page=0, category=None, search='', min_price=0.0, |
||||
|
max_price=0.0, ppg=False, **post): |
||||
|
"""Function to inherit shop and to set the posted value in the |
||||
|
website session.""" |
||||
|
res = super().shop(page, category, search, min_price, |
||||
|
max_price, ppg, **post) |
||||
|
order = request.website.sale_get_order() |
||||
|
if 'post_values' in request.session: |
||||
|
stored_post_values = request.session['post_values'] |
||||
|
if stored_post_values != post and post: |
||||
|
order.unlink() |
||||
|
if post: |
||||
|
request.session['post_values'] = post |
||||
|
return res |
||||
|
|
||||
|
def cart(self, access_token=None, revive='', **post): |
||||
|
"""Function to update the address from cart when the sale order is |
||||
|
created""" |
||||
|
res = super().cart(access_token, revive, **post) |
||||
|
if 'post_values' in request.session: |
||||
|
post_values = request.session['post_values'] |
||||
|
order = request.website.sale_get_order() |
||||
|
if post_values: |
||||
|
customer_id = post_values.get('customer') |
||||
|
if customer_id: |
||||
|
customer = request.env['res.partner'].browse( |
||||
|
int(customer_id)) |
||||
|
order.update({ |
||||
|
'partner_id': customer, |
||||
|
'partner_invoice_id': customer, |
||||
|
'partner_shipping_id': customer, |
||||
|
'agent_id': request.env.user.partner_id.id |
||||
|
if request.env.user.partner_id.is_agent else '' |
||||
|
}) |
||||
|
return res |
||||
|
|
||||
|
def _get_shop_payment_values(self, order, **kwargs): |
||||
|
"""Function to update the sale order details created from website""" |
||||
|
res = super()._get_shop_payment_values(order, **kwargs) |
||||
|
if 'post_values' in request.session: |
||||
|
post_values = request.session['post_values'] |
||||
|
if post_values: |
||||
|
customer_id = post_values.get('customer') |
||||
|
if customer_id: |
||||
|
customer = request.env['res.partner'].browse( |
||||
|
int(customer_id)) |
||||
|
website_sale_order = res.get('website_sale_order', {}) |
||||
|
website_sale_order.update({ |
||||
|
'partner_id': customer.id, |
||||
|
'partner_invoice_id': customer.id, |
||||
|
'partner_shipping_id': customer.id, |
||||
|
'agent_id': request.env.user.partner_id.id |
||||
|
if request.env.user.partner_id.is_agent else '', |
||||
|
}) |
||||
|
res.update({ |
||||
|
'partner': customer, |
||||
|
'partner_id': customer.id, |
||||
|
'website_sale_order': website_sale_order, |
||||
|
}) |
||||
|
return res |
||||
|
|
||||
|
def _prepare_shop_payment_confirmation_values(self, order): |
||||
|
""" |
||||
|
This method is called in the payment process route in order to |
||||
|
prepare the dict containing the values to be rendered by the |
||||
|
confirmation template. |
||||
|
""" |
||||
|
res = super()._prepare_shop_payment_confirmation_values(order) |
||||
|
if 'post_values' in request.session: |
||||
|
post_values = request.session['post_values'] |
||||
|
if post_values: |
||||
|
customer_id = post_values.get('customer') |
||||
|
if customer_id: |
||||
|
customer = request.env['res.partner'].browse( |
||||
|
int(customer_id)) |
||||
|
order.update({ |
||||
|
'partner_id': customer.id, |
||||
|
'partner_invoice_id': customer.id, |
||||
|
'partner_shipping_id': customer.id, |
||||
|
}) |
||||
|
return res |
||||
|
|
||||
|
def checkout_values(self, order, **kw): |
||||
|
"""Updating the billing and shipping address based on customer""" |
||||
|
res = super().checkout_values(order, **kw) |
||||
|
if 'post_values' in request.session: |
||||
|
post_values = request.session['post_values'] |
||||
|
if post_values: |
||||
|
customer_id = post_values.get('customer') |
||||
|
if customer_id: |
||||
|
customer = request.env['res.partner'].browse( |
||||
|
int(customer_id)) |
||||
|
res.update({ |
||||
|
'shippings': customer, |
||||
|
'billings': customer, |
||||
|
}) |
||||
|
return res |
||||
|
|
||||
|
def shop_payment_confirmation(self, **post): |
||||
|
"""Function to remove the values of post_values from the session.""" |
||||
|
res = super().shop_payment_confirmation(**post) |
||||
|
request.session['post_values'] = {} |
||||
|
return res |
||||
|
|
||||
|
|
||||
|
class PaymentPortal(payment_portal.PaymentPortal): |
||||
|
"""Class to inherit the function to change the details of the |
||||
|
transactions.""" |
||||
|
def shop_payment_transaction(self, order_id, access_token, **kwargs): |
||||
|
"""Function to change the order details for delivery and invoice""" |
||||
|
res = super().shop_payment_transaction(order_id, access_token, **kwargs) |
||||
|
order_id = request.env['sale.order'].browse(int(order_id)) |
||||
|
if 'post_values' in request.session: |
||||
|
post_values = request.session['post_values'] |
||||
|
if post_values: |
||||
|
customer_id = post_values.get('customer') |
||||
|
if customer_id: |
||||
|
customer = request.env['res.partner'].browse( |
||||
|
int(customer_id)) |
||||
|
order_id.update({ |
||||
|
'partner_id': customer.id, |
||||
|
'partner_invoice_id': customer.id, |
||||
|
'partner_shipping_id': customer.id, |
||||
|
}) |
||||
|
return res |
@ -0,0 +1,10 @@ |
|||||
|
<?xml version="1.0" encoding="UTF-8" ?> |
||||
|
<odoo> |
||||
|
<!--menu for Agent shop in website--> |
||||
|
<record id="agent_shop_menu" model="website.menu"> |
||||
|
<field name="name">Agent Shop</field> |
||||
|
<field name="url">/agent/shop</field> |
||||
|
<field name="parent_id" ref="website.main_menu"/> |
||||
|
<field name="sequence">10</field> |
||||
|
</record> |
||||
|
</odoo> |
@ -0,0 +1,7 @@ |
|||||
|
## Module <shopping_through_agent> |
||||
|
|
||||
|
#### 22.11.2024 |
||||
|
#### Version 18.0.1.0.0 |
||||
|
#### ADD |
||||
|
|
||||
|
- Initial Commit for Shopping Through Agent |
@ -0,0 +1,25 @@ |
|||||
|
# -*- coding: utf-8 -*- |
||||
|
################################################################################ |
||||
|
# |
||||
|
# Cybrosys Technologies Pvt. Ltd. |
||||
|
# Copyright (C) 2024-TODAY Cybrosys Technologies(<https://www.cybrosys.com>). |
||||
|
# Author: Ashok PK (odoo@cybrosys.com) |
||||
|
# |
||||
|
# This program is free software: you can modify |
||||
|
# it under the terms of the GNU Affero General Public License (AGPL) as |
||||
|
# published by the Free Software Foundation, either version 3 of the |
||||
|
# License, or (at your option) any later version. |
||||
|
# |
||||
|
# This program is distributed in the hope that it will be useful, |
||||
|
# but WITHOUT ANY WARRANTY; without even the implied warranty of |
||||
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
||||
|
# GNU Affero General Public License for more details. |
||||
|
# |
||||
|
# You should have received a copy of the GNU Affero General Public License |
||||
|
# along with this program. If not, see <https://www.gnu.org/licenses/>. |
||||
|
# |
||||
|
################################################################################ |
||||
|
from . import account_move |
||||
|
from . import res_partner |
||||
|
from . import sale_order |
||||
|
from . import website_menu |
@ -0,0 +1,30 @@ |
|||||
|
# -*- coding: utf-8 -*- |
||||
|
################################################################################ |
||||
|
# |
||||
|
# Cybrosys Technologies Pvt. Ltd. |
||||
|
# Copyright (C) 2024-TODAY Cybrosys Technologies(<https://www.cybrosys.com>). |
||||
|
# Author: Ashok PK (odoo@cybrosys.com) |
||||
|
# |
||||
|
# This program is free software: you can modify |
||||
|
# it under the terms of the GNU Affero General Public License (AGPL) as |
||||
|
# published by the Free Software Foundation, either version 3 of the |
||||
|
# License, or (at your option) any later version. |
||||
|
# |
||||
|
# This program is distributed in the hope that it will be useful, |
||||
|
# but WITHOUT ANY WARRANTY; without even the implied warranty of |
||||
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
||||
|
# GNU Affero General Public License for more details. |
||||
|
# |
||||
|
# You should have received a copy of the GNU Affero General Public License |
||||
|
# along with this program. If not, see <https://www.gnu.org/licenses/>. |
||||
|
# |
||||
|
################################################################################ |
||||
|
from odoo import fields, models |
||||
|
|
||||
|
|
||||
|
class AccountMove(models.Model): |
||||
|
"""Class to add the field in invoice""" |
||||
|
_inherit = 'account.move' |
||||
|
|
||||
|
agent_id = fields.Many2one(comodel_name='res.partner', string='Agent', |
||||
|
help='Select an agent for the customer') |
@ -0,0 +1,42 @@ |
|||||
|
# -*- coding: utf-8 -*- |
||||
|
################################################################################ |
||||
|
# |
||||
|
# Cybrosys Technologies Pvt. Ltd. |
||||
|
# Copyright (C) 2024-TODAY Cybrosys Technologies(<https://www.cybrosys.com>). |
||||
|
# Author: Ashok PK (odoo@cybrosys.com) |
||||
|
# |
||||
|
# This program is free software: you can modify |
||||
|
# it under the terms of the GNU Affero General Public License (AGPL) as |
||||
|
# published by the Free Software Foundation, either version 3 of the |
||||
|
# License, or (at your option) any later version. |
||||
|
# |
||||
|
# This program is distributed in the hope that it will be useful, |
||||
|
# but WITHOUT ANY WARRANTY; without even the implied warranty of |
||||
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
||||
|
# GNU Affero General Public License for more details. |
||||
|
# |
||||
|
# You should have received a copy of the GNU Affero General Public License |
||||
|
# along with this program. If not, see <https://www.gnu.org/licenses/>. |
||||
|
# |
||||
|
################################################################################ |
||||
|
from odoo import api, fields, models |
||||
|
|
||||
|
|
||||
|
class ResPartner(models.Model): |
||||
|
"""Class to add the fields in partner form""" |
||||
|
_inherit = 'res.partner' |
||||
|
|
||||
|
agent_id = fields.Many2one(comodel_name='res.partner', string='Agent', |
||||
|
help='Select an agent for the customer to ' |
||||
|
'allow agent can create sale order for ' |
||||
|
'the customer') |
||||
|
is_agent = fields.Boolean(string='Is Agent', |
||||
|
help='Enable if this person is a agent', |
||||
|
default=False) |
||||
|
|
||||
|
@api.onchange('is_agent') |
||||
|
def _onchange_agent(self): |
||||
|
"""On change function for the agent field""" |
||||
|
if not self.is_agent: |
||||
|
self.agent_id = '' |
||||
|
self.search([('agent_id', '=', self.name)]).write({'agent_id': ''}) |
@ -0,0 +1,38 @@ |
|||||
|
# -*- coding: utf-8 -*- |
||||
|
################################################################################ |
||||
|
# |
||||
|
# Cybrosys Technologies Pvt. Ltd. |
||||
|
# Copyright (C) 2024-TODAY Cybrosys Technologies(<https://www.cybrosys.com>). |
||||
|
# Author: Ashok PK (odoo@cybrosys.com) |
||||
|
# |
||||
|
# This program is free software: you can modify |
||||
|
# it under the terms of the GNU Affero General Public License (AGPL) as |
||||
|
# published by the Free Software Foundation, either version 3 of the |
||||
|
# License, or (at your option) any later version. |
||||
|
# |
||||
|
# This program is distributed in the hope that it will be useful, |
||||
|
# but WITHOUT ANY WARRANTY; without even the implied warranty of |
||||
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
||||
|
# GNU Affero General Public License for more details. |
||||
|
# |
||||
|
# You should have received a copy of the GNU Affero General Public License |
||||
|
# along with this program. If not, see <https://www.gnu.org/licenses/>. |
||||
|
# |
||||
|
################################################################################ |
||||
|
from odoo import fields, models |
||||
|
|
||||
|
|
||||
|
class SaleOrder(models.Model): |
||||
|
"""Class to add the field in sale order""" |
||||
|
_inherit = 'sale.order' |
||||
|
|
||||
|
agent_id = fields.Many2one( |
||||
|
'res.partner', 'Agent', |
||||
|
help='Select a agent for the customer') |
||||
|
|
||||
|
def _prepare_invoice(self): |
||||
|
"""Function to update the agent_id field in invoice based on the sale |
||||
|
order""" |
||||
|
res = super()._prepare_invoice() |
||||
|
res['agent_id'] = self.agent_id.id |
||||
|
return res |
@ -0,0 +1,38 @@ |
|||||
|
# -*- coding: utf-8 -*- |
||||
|
################################################################################ |
||||
|
# |
||||
|
# Cybrosys Technologies Pvt. Ltd. |
||||
|
# Copyright (C) 2024-TODAY Cybrosys Technologies(<https://www.cybrosys.com>). |
||||
|
# Author: Ashok PK (odoo@cybrosys.com) |
||||
|
# |
||||
|
# This program is free software: you can modify |
||||
|
# it under the terms of the GNU Affero General Public License (AGPL) as |
||||
|
# published by the Free Software Foundation, either version 3 of the |
||||
|
# License, or (at your option) any later version. |
||||
|
# |
||||
|
# This program is distributed in the hope that it will be useful, |
||||
|
# but WITHOUT ANY WARRANTY; without even the implied warranty of |
||||
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
||||
|
# GNU Affero General Public License for more details. |
||||
|
# |
||||
|
# You should have received a copy of the GNU Affero General Public License |
||||
|
# along with this program. If not, see <https://www.gnu.org/licenses/>. |
||||
|
# |
||||
|
################################################################################ |
||||
|
from odoo import models |
||||
|
|
||||
|
|
||||
|
class WebsiteMenu(models.Model): |
||||
|
"""Class to add a function for menu visibility""" |
||||
|
_inherit = 'website.menu' |
||||
|
|
||||
|
def _compute_visible(self): |
||||
|
"""Compute menu invisible for customer and visible for agent""" |
||||
|
super()._compute_visible() |
||||
|
self.env.registry.clear_cache('templates') |
||||
|
for menu in self: |
||||
|
visible = True |
||||
|
if menu.name == 'Agent Shop': |
||||
|
if not menu.env.user.partner_id.is_agent: |
||||
|
visible = False |
||||
|
menu.is_visible = visible |
After Width: | Height: | Size: 2.2 KiB |
After Width: | Height: | Size: 28 KiB |
After Width: | Height: | Size: 628 KiB |
After Width: | Height: | Size: 1.1 KiB |
After Width: | Height: | Size: 210 KiB |
After Width: | Height: | Size: 209 KiB |
After Width: | Height: | Size: 109 KiB |
After Width: | Height: | Size: 495 B |
After Width: | Height: | Size: 1.0 KiB |
After Width: | Height: | Size: 624 B |
After Width: | Height: | Size: 136 KiB |
After Width: | Height: | Size: 214 KiB |
After Width: | Height: | Size: 36 KiB |
After Width: | Height: | Size: 3.6 KiB |
After Width: | Height: | Size: 310 B |
After Width: | Height: | Size: 929 B |
After Width: | Height: | Size: 1.3 KiB |
After Width: | Height: | Size: 3.3 KiB |
After Width: | Height: | Size: 1.4 KiB |
After Width: | Height: | Size: 17 KiB |
After Width: | Height: | Size: 542 B |
After Width: | Height: | Size: 576 B |
After Width: | Height: | Size: 733 B |
After Width: | Height: | Size: 4.3 KiB |
After Width: | Height: | Size: 1.2 KiB |
After Width: | Height: | Size: 4.0 KiB |
After Width: | Height: | Size: 1.7 KiB |
After Width: | Height: | Size: 738 KiB |
After Width: | Height: | Size: 2.2 KiB |
After Width: | Height: | Size: 911 B |
After Width: | Height: | Size: 1.1 KiB |
After Width: | Height: | Size: 1.2 KiB |
After Width: | Height: | Size: 1.2 KiB |
After Width: | Height: | Size: 600 B |
After Width: | Height: | Size: 673 B |
After Width: | Height: | Size: 2.0 KiB |
After Width: | Height: | Size: 462 B |
After Width: | Height: | Size: 2.1 KiB |
After Width: | Height: | Size: 926 B |
After Width: | Height: | Size: 9.0 KiB |
After Width: | Height: | Size: 23 KiB |
After Width: | Height: | Size: 7.0 KiB |
After Width: | Height: | Size: 878 B |
After Width: | Height: | Size: 1.2 KiB |
After Width: | Height: | Size: 653 B |
After Width: | Height: | Size: 800 B |
After Width: | Height: | Size: 905 B |
After Width: | Height: | Size: 189 KiB |
After Width: | Height: | Size: 4.3 KiB |
After Width: | Height: | Size: 839 B |
After Width: | Height: | Size: 1.7 KiB |
After Width: | Height: | Size: 5.9 KiB |
After Width: | Height: | Size: 1.6 KiB |
After Width: | Height: | Size: 34 KiB |
After Width: | Height: | Size: 26 KiB |
After Width: | Height: | Size: 3.8 KiB |
After Width: | Height: | Size: 23 KiB |
After Width: | Height: | Size: 1.9 KiB |
After Width: | Height: | Size: 2.3 KiB |
After Width: | Height: | Size: 427 B |
After Width: | Height: | Size: 627 B |
After Width: | Height: | Size: 1.1 KiB |
After Width: | Height: | Size: 1.2 KiB |
After Width: | Height: | Size: 988 B |
After Width: | Height: | Size: 3.7 KiB |
After Width: | Height: | Size: 5.0 KiB |
After Width: | Height: | Size: 875 B |
After Width: | Height: | Size: 1.2 KiB |
After Width: | Height: | Size: 767 KiB |
After Width: | Height: | Size: 92 KiB |
After Width: | Height: | Size: 92 KiB |
After Width: | Height: | Size: 131 KiB |
After Width: | Height: | Size: 87 KiB |
After Width: | Height: | Size: 87 KiB |
After Width: | Height: | Size: 142 KiB |
After Width: | Height: | Size: 138 KiB |
After Width: | Height: | Size: 83 KiB |
After Width: | Height: | Size: 129 KiB |
After Width: | Height: | Size: 129 KiB |
After Width: | Height: | Size: 147 KiB |
After Width: | Height: | Size: 127 KiB |
After Width: | Height: | Size: 78 KiB |
After Width: | Height: | Size: 154 KiB |
After Width: | Height: | Size: 144 KiB |
After Width: | Height: | Size: 133 KiB |
After Width: | Height: | Size: 364 KiB |
After Width: | Height: | Size: 880 KiB |