-
-
Notifications
You must be signed in to change notification settings - Fork 322
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
b57c983
commit 9a19dea
Showing
9 changed files
with
96 additions
and
0 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
to update |
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,5 @@ | ||
# Copyright 2023 Camptocamp SA | ||
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html) | ||
|
||
from . import models | ||
from .hooks import post_init_hook |
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,18 @@ | ||
# Copyright 2023 Camptocamp SA | ||
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html) | ||
|
||
{ | ||
"name": "pingen.com server environment", | ||
"version": "16.0.1.0.0", | ||
"author": "Camptocamp,Odoo Community Association (OCA)", | ||
"maintainers": ["ajaniszewska-dev"], | ||
"license": "AGPL-3", | ||
"category": "Reporting", | ||
"complexity": "easy", | ||
"depends": ["pingen", "server_environment"], | ||
"website": "https://github.com/OCA/report-print-send", | ||
"post_init_hook": "post_init_hook", | ||
"installable": True, | ||
"auto_install": False, | ||
"application": 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,15 @@ | ||
# Copyright 2023 Camptocamp SA | ||
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html) | ||
|
||
|
||
def post_init_hook(cr, registry): | ||
# When installing pingen_env we want to delete data from DB | ||
cr.execute( | ||
"""UPDATE res_company | ||
SET pingen_clientid = NULL, | ||
pingen_client_secretid = NULL, | ||
pingen_organization = NULL, | ||
pingen_staging = NULL, | ||
pingen_webhook_secret = NULL; | ||
""" | ||
) |
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,4 @@ | ||
# Copyright 2023 Camptocamp SA | ||
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html) | ||
|
||
from . import res_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,45 @@ | ||
# Copyright 2023 Camptocamp SA | ||
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html) | ||
|
||
from odoo import api, fields, models | ||
|
||
from odoo.addons.server_environment import serv_config | ||
|
||
|
||
class ResCompany(models.Model): | ||
_inherit = ["res.company"] | ||
|
||
pingen_clientid = fields.Char( | ||
compute="_compute_pingen_env", required=False, readonly=True | ||
) | ||
pingen_client_secretid = fields.Char( | ||
compute="_compute_pingen_env", required=False, readonly=True | ||
) | ||
pingen_organization = fields.Char( | ||
compute="_compute_pingen_env", required=False, readonly=True | ||
) | ||
pingen_staging = fields.Boolean( | ||
compute="_compute_pingen_env", required=False, readonly=True | ||
) | ||
pingen_webhook_secret = fields.Char( | ||
compute="_compute_pingen_env", required=False, readonly=True | ||
) | ||
|
||
@api.depends() | ||
def _compute_pingen_env(self): | ||
global_section_name = "pingen" | ||
for company in self: | ||
# default vals | ||
config_vals = { | ||
"pingen_clientid": "", | ||
"pingen_client_secretid": "", | ||
"pingen_organization": "", | ||
"pingen_staging": True, | ||
"pingen_webhook_secret": "", | ||
} | ||
if serv_config.has_section(global_section_name): | ||
config_vals.update(serv_config.items(global_section_name)) | ||
custom_section_name = global_section_name + "." + company.name | ||
if serv_config.has_section(custom_section_name): | ||
config_vals.update(serv_config.items(custom_section_name)) | ||
company.update(config_vals) | ||
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 @@ | ||
* Anna Janiszewska <[email protected]> |
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 @@ | ||
../../../../pingen_env |
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,6 @@ | ||
import setuptools | ||
|
||
setuptools.setup( | ||
setup_requires=['setuptools-odoo'], | ||
odoo_addon=True, | ||
) |