-
Notifications
You must be signed in to change notification settings - Fork 21
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[MIG] Migrate website_sale_multic_ux to 16.0
[ADD] Add new module website_multicompany [ADD] Add new module website_sale_multicompany
- Loading branch information
Showing
13 changed files
with
299 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,74 @@ | ||
.. |company| replace:: ADHOC SA | ||
|
||
.. |company_logo| image:: https://raw.githubusercontent.com/ingadhoc/maintainer-tools/master/resources/adhoc-logo.png | ||
:alt: ADHOC SA | ||
:target: https://www.adhoc.com.ar | ||
|
||
.. |icon| image:: https://raw.githubusercontent.com/ingadhoc/maintainer-tools/master/resources/adhoc-icon.png | ||
|
||
.. image:: https://img.shields.io/badge/license-AGPL--3-blue.png | ||
:target: https://www.gnu.org/licenses/agpl | ||
:alt: License: AGPL-3 | ||
|
||
============================== | ||
Website Multicompany | ||
============================== | ||
|
||
# This module allows portal users to view their records of the companies they have assigned as allowed companies (company_ids). By default Odoo usually allows to see only the company of the website. | ||
# By installing this module automatically on the whole website users will see records of the company_ids they have assigned. | ||
|
||
# Este modulo es para que usuarios portal vean registros de las compañías que tienen asignadas como compañías permitidas (company_ids). Por defecto Odoo suele dejar ver solo lo de la compañía del sitio web. | ||
# Al instalar este módulo automáticamente en todo el sitio web los usuarios van a ver registros de las company_ids que tengan asignadas. | ||
|
||
Installation | ||
============ | ||
|
||
To install this module, you need to: | ||
|
||
#. Only install the module | ||
|
||
Configuration | ||
============= | ||
|
||
To configure this module, you need to: | ||
|
||
#. Go to a Payment acquirer and select a journal that belongs to a different company than the Payment method | ||
|
||
Usage | ||
===== | ||
|
||
.. image:: https://odoo-community.org/website/image/ir.attachment/5784_f2813bd/datas | ||
:alt: Try me on Runbot | ||
:target: http://runbot.adhoc.com.ar/ | ||
|
||
Bug Tracker | ||
=========== | ||
|
||
Bugs are tracked on `GitHub Issues | ||
<https://github.com/ingadhoc/multi-company/issues>`_. In case of trouble, please | ||
check there if your issue has already been reported. If you spotted it first, | ||
help us smashing it by providing a detailed and welcomed feedback. | ||
|
||
Usage | ||
===== | ||
|
||
.. image:: https://odoo-community.org/website/image/ir.attachment/5784_f2813bd/datas | ||
:alt: Try me on Runbot | ||
:target: http://runbot.adhoc.com.ar/ | ||
|
||
|
||
* |company| |icon| | ||
|
||
Contributors | ||
------------ | ||
|
||
Maintainer | ||
---------- | ||
|
||
|company_logo| | ||
|
||
This module is maintained by the |company|. | ||
|
||
To contribute to this module, please visit https://www.adhoc.com.ar. | ||
|
||
Este modulo es para que usuarios portal vean registros de las compañías que tienen asignadas como compañías permitidas (company_ids). Por defecto Odoo suele dejar ver solo lo de la compañía del sitio web. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
from . import models |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
############################################################################## | ||
# | ||
# Copyright (C) 2023 ADHOC SA (http://www.adhoc.com.ar) | ||
# All Rights Reserved. | ||
# | ||
# This program is free software: you can redistribute it and/or modify | ||
# it under the terms of the GNU Affero General Public License 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 <http://www.gnu.org/licenses/>. | ||
# | ||
############################################################################## | ||
{ | ||
'name': 'Website Multicompany', | ||
'version': "16.0.1.0.0", | ||
'author': 'ADHOC SA', | ||
'website': 'www.adhoc.com.ar', | ||
'license': 'AGPL-3', | ||
'depends': [ | ||
'website', | ||
], | ||
'data': [], | ||
'demo': [], | ||
'installable': True, | ||
'auto_install': False, | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
from . import website |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
############################################################################## | ||
# For copyright and license notices, see __manifest__.py file in module root | ||
# directory | ||
############################################################################## | ||
|
||
import logging | ||
from odoo import models, tools | ||
from odoo.http import request | ||
|
||
class Http(models.AbstractModel): | ||
_inherit = 'ir.http' | ||
|
||
@classmethod | ||
def _frontend_pre_dispatch(cls): | ||
super()._frontend_pre_dispatch() | ||
user = request.env.user | ||
website = request.env['website'].get_current_website() | ||
|
||
if user.id != website._get_cached('user_id'): | ||
users_company_ids = website._get_cached_companies() | ||
request.update_context( | ||
allowed_company_ids=users_company_ids, | ||
) | ||
request.website = website.with_context(request.context) | ||
|
||
class Website(models.Model): | ||
|
||
_inherit = 'website' | ||
|
||
@tools.ormcache('self.env.uid') | ||
def _get_cached_companies(self): | ||
return self.env.user.company_ids.ids | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,71 @@ | ||
.. |company| replace:: ADHOC SA | ||
|
||
.. |company_logo| image:: https://raw.githubusercontent.com/ingadhoc/maintainer-tools/master/resources/adhoc-logo.png | ||
:alt: ADHOC SA | ||
:target: https://www.adhoc.com.ar | ||
|
||
.. |icon| image:: https://raw.githubusercontent.com/ingadhoc/maintainer-tools/master/resources/adhoc-icon.png | ||
|
||
.. image:: https://img.shields.io/badge/license-AGPL--3-blue.png | ||
:target: https://www.gnu.org/licenses/agpl | ||
:alt: License: AGPL-3 | ||
|
||
============================== | ||
Website Sale Multicompany | ||
============================== | ||
|
||
# Con este modulo, cuando un usuario hace una compra en sitio web la misma se hará en la compañía por defecto que tenga seteada el usuario (company_id) en vez de la compañía del sitio web. Los métodos de envío y pago que se mostrarán serán lo de la compañía de la orden. | ||
|
||
Installation | ||
============ | ||
|
||
To install this module, you need to: | ||
|
||
#. Only install the module | ||
|
||
Configuration | ||
============= | ||
|
||
To configure this module, you need to: | ||
|
||
#. Go to a Payment acquirer and select a journal that belongs to a different company than the Payment method | ||
|
||
Usage | ||
===== | ||
|
||
.. image:: https://odoo-community.org/website/image/ir.attachment/5784_f2813bd/datas | ||
:alt: Try me on Runbot | ||
:target: http://runbot.adhoc.com.ar/ | ||
|
||
Bug Tracker | ||
=========== | ||
|
||
Bugs are tracked on `GitHub Issues | ||
<https://github.com/ingadhoc/multi-company/issues>`_. In case of trouble, please | ||
check there if your issue has already been reported. If you spotted it first, | ||
help us smashing it by providing a detailed and welcomed feedback. | ||
|
||
Usage | ||
===== | ||
|
||
.. image:: https://odoo-community.org/website/image/ir.attachment/5784_f2813bd/datas | ||
:alt: Try me on Runbot | ||
:target: http://runbot.adhoc.com.ar/ | ||
|
||
|
||
* |company| |icon| | ||
* Eficent |iconEficent| Part of the code used for this module was extracted from Eficent's `multicompany-fixes/mcfix_accpount <https://github.com/Eficent/multicompany-fixes/tree/11.0/mcfix_account>`_ module | ||
|
||
Contributors | ||
------------ | ||
|
||
Maintainer | ||
---------- | ||
|
||
|company_logo| | ||
|
||
This module is maintained by the |company|. | ||
|
||
To contribute to this module, please visit https://www.adhoc.com.ar. | ||
|
||
Este modulo es para que usuarios portal vean registros de las compañías que tienen asignadas como compañías permitidas (company_ids). Por defecto Odoo suele dejar ver solo lo de la compañía del sitio web. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
from . import models |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
############################################################################## | ||
# | ||
# Copyright (C) 2023 ADHOC SA (http://www.adhoc.com.ar) | ||
# All Rights Reserved. | ||
# | ||
# This program is free software: you can redistribute it and/or modify | ||
# it under the terms of the GNU Affero General Public License 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 <http://www.gnu.org/licenses/>. | ||
# | ||
############################################################################## | ||
{ | ||
'name': 'Website Sale multicompany', | ||
'version': "16.0.1.0.0", | ||
'author': 'ADHOC SA', | ||
'website': 'www.adhoc.com.ar', | ||
'license': 'AGPL-3', | ||
'depends': [ | ||
'website_sale', | ||
'website_multic', | ||
], | ||
'data': [], | ||
'demo': [], | ||
'installable': True, | ||
'auto_install': False, | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
from . import website | ||
from . import sale_order |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
############################################################################## | ||
# For copyright and license notices, see __manifest__.py file in module root | ||
# directory | ||
############################################################################## | ||
|
||
from odoo import models, fields | ||
|
||
|
||
class SaleOrder(models.Model): | ||
|
||
_inherit = 'sale.order' | ||
|
||
analytic_account_id = fields.Many2one( | ||
check_company=False, # Unrequired company | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
############################################################################## | ||
# For copyright and license notices, see __manifest__.py file in module root | ||
# directory | ||
############################################################################## | ||
|
||
import logging | ||
from odoo import models, tools | ||
from odoo.http import request | ||
|
||
|
||
class Website(models.Model): | ||
|
||
_inherit = 'website' | ||
|
||
def sale_get_order(self, force_create=False, update_pricelist=False): | ||
sale_order_sudo = super().sale_get_order(force_create, update_pricelist) | ||
vals = {} | ||
if sale_order_sudo.company_id != self.env.user.company_id: | ||
vals['company_id'] = self.env.user.company_id.id | ||
if hasattr(sale_order_sudo, 'warehouse_id') and sale_order_sudo.warehouse_id.company_id != self.env.user.company_id: | ||
vals['warehouse_id'] = ( | ||
self.env['ir.default'].get('sale.order', 'warehouse_id', company_id=self.env.user.company_id.id) or | ||
self.env['stock.warehouse'].sudo().search([('company_id', '=', self.env.user.company_id.id)], limit=1).id | ||
) | ||
if vals: | ||
sale_order_sudo.write(vals) | ||
return sale_order_sudo |