Skip to content

Commit 6eb71c7

Browse files
committed
Merge PR #188 into 17.0
Signed-off-by simahawk
2 parents e78a9de + f3c31a4 commit 6eb71c7

21 files changed

Lines changed: 1110 additions & 0 deletions
Lines changed: 165 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,165 @@
1+
GNU LESSER GENERAL PUBLIC LICENSE
2+
Version 3, 29 June 2007
3+
4+
Copyright (C) 2007 Free Software Foundation, Inc. <https://fsf.org/>
5+
Everyone is permitted to copy and distribute verbatim copies
6+
of this license document, but changing it is not allowed.
7+
8+
9+
This version of the GNU Lesser General Public License incorporates
10+
the terms and conditions of version 3 of the GNU General Public
11+
License, supplemented by the additional permissions listed below.
12+
13+
0. Additional Definitions.
14+
15+
As used herein, "this License" refers to version 3 of the GNU Lesser
16+
General Public License, and the "GNU GPL" refers to version 3 of the GNU
17+
General Public License.
18+
19+
"The Library" refers to a covered work governed by this License,
20+
other than an Application or a Combined Work as defined below.
21+
22+
An "Application" is any work that makes use of an interface provided
23+
by the Library, but which is not otherwise based on the Library.
24+
Defining a subclass of a class defined by the Library is deemed a mode
25+
of using an interface provided by the Library.
26+
27+
A "Combined Work" is a work produced by combining or linking an
28+
Application with the Library. The particular version of the Library
29+
with which the Combined Work was made is also called the "Linked
30+
Version".
31+
32+
The "Minimal Corresponding Source" for a Combined Work means the
33+
Corresponding Source for the Combined Work, excluding any source code
34+
for portions of the Combined Work that, considered in isolation, are
35+
based on the Application, and not on the Linked Version.
36+
37+
The "Corresponding Application Code" for a Combined Work means the
38+
object code and/or source code for the Application, including any data
39+
and utility programs needed for reproducing the Combined Work from the
40+
Application, but excluding the System Libraries of the Combined Work.
41+
42+
1. Exception to Section 3 of the GNU GPL.
43+
44+
You may convey a covered work under sections 3 and 4 of this License
45+
without being bound by section 3 of the GNU GPL.
46+
47+
2. Conveying Modified Versions.
48+
49+
If you modify a copy of the Library, and, in your modifications, a
50+
facility refers to a function or data to be supplied by an Application
51+
that uses the facility (other than as an argument passed when the
52+
facility is invoked), then you may convey a copy of the modified
53+
version:
54+
55+
a) under this License, provided that you make a good faith effort to
56+
ensure that, in the event an Application does not supply the
57+
function or data, the facility still operates, and performs
58+
whatever part of its purpose remains meaningful, or
59+
60+
b) under the GNU GPL, with none of the additional permissions of
61+
this License applicable to that copy.
62+
63+
3. Object Code Incorporating Material from Library Header Files.
64+
65+
The object code form of an Application may incorporate material from
66+
a header file that is part of the Library. You may convey such object
67+
code under terms of your choice, provided that, if the incorporated
68+
material is not limited to numerical parameters, data structure
69+
layouts and accessors, or small macros, inline functions and templates
70+
(ten or fewer lines in length), you do both of the following:
71+
72+
a) Give prominent notice with each copy of the object code that the
73+
Library is used in it and that the Library and its use are
74+
covered by this License.
75+
76+
b) Accompany the object code with a copy of the GNU GPL and this license
77+
document.
78+
79+
4. Combined Works.
80+
81+
You may convey a Combined Work under terms of your choice that,
82+
taken together, effectively do not restrict modification of the
83+
portions of the Library contained in the Combined Work and reverse
84+
engineering for debugging such modifications, if you also do each of
85+
the following:
86+
87+
a) Give prominent notice with each copy of the Combined Work that
88+
the Library is used in it and that the Library and its use are
89+
covered by this License.
90+
91+
b) Accompany the Combined Work with a copy of the GNU GPL and this license
92+
document.
93+
94+
c) For a Combined Work that displays copyright notices during
95+
execution, include the copyright notice for the Library among
96+
these notices, as well as a reference directing the user to the
97+
copies of the GNU GPL and this license document.
98+
99+
d) Do one of the following:
100+
101+
0) Convey the Minimal Corresponding Source under the terms of this
102+
License, and the Corresponding Application Code in a form
103+
suitable for, and under terms that permit, the user to
104+
recombine or relink the Application with a modified version of
105+
the Linked Version to produce a modified Combined Work, in the
106+
manner specified by section 6 of the GNU GPL for conveying
107+
Corresponding Source.
108+
109+
1) Use a suitable shared library mechanism for linking with the
110+
Library. A suitable mechanism is one that (a) uses at run time
111+
a copy of the Library already present on the user's computer
112+
system, and (b) will operate properly with a modified version
113+
of the Library that is interface-compatible with the Linked
114+
Version.
115+
116+
e) Provide Installation Information, but only if you would otherwise
117+
be required to provide such information under section 6 of the
118+
GNU GPL, and only to the extent that such information is
119+
necessary to install and execute a modified version of the
120+
Combined Work produced by recombining or relinking the
121+
Application with a modified version of the Linked Version. (If
122+
you use option 4d0, the Installation Information must accompany
123+
the Minimal Corresponding Source and Corresponding Application
124+
Code. If you use option 4d1, you must provide the Installation
125+
Information in the manner specified by section 6 of the GNU GPL
126+
for conveying Corresponding Source.)
127+
128+
5. Combined Libraries.
129+
130+
You may place library facilities that are a work based on the
131+
Library side by side in a single library together with other library
132+
facilities that are not Applications and are not covered by this
133+
License, and convey such a combined library under terms of your
134+
choice, if you do both of the following:
135+
136+
a) Accompany the combined library with a copy of the same work based
137+
on the Library, uncombined with any other library facilities,
138+
conveyed under the terms of this License.
139+
140+
b) Give prominent notice with the combined library that part of it
141+
is a work based on the Library, and explaining where to find the
142+
accompanying uncombined form of the same work.
143+
144+
6. Revised Versions of the GNU Lesser General Public License.
145+
146+
The Free Software Foundation may publish revised and/or new versions
147+
of the GNU Lesser General Public License from time to time. Such new
148+
versions will be similar in spirit to the present version, but may
149+
differ in detail to address new problems or concerns.
150+
151+
Each version is given a distinguishing version number. If the
152+
Library as you received it specifies that a certain numbered version
153+
of the GNU Lesser General Public License "or any later version"
154+
applies to it, you have the option of following the terms and
155+
conditions either of that published version or of any later version
156+
published by the Free Software Foundation. If the Library as you
157+
received it does not specify a version number of the GNU Lesser
158+
General Public License, you may choose any version of the GNU Lesser
159+
General Public License ever published by the Free Software Foundation.
160+
161+
If the Library as you received it specifies that a proxy can decide
162+
whether future versions of the GNU Lesser General Public License shall
163+
apply, that proxy's public statement of acceptance of any version is
164+
permanent authorization for you to choose that version for the
165+
Library.
Lines changed: 163 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,163 @@
1+
=============================
2+
Server Environment Autocreate
3+
=============================
4+
5+
..
6+
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
7+
!! This file is generated by oca-gen-addon-readme !!
8+
!! changes will be overwritten. !!
9+
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
10+
!! source digest: sha256:c41974e39c6f11adbecf0ad0a3a5d3ce800c956e62b57a0ba270146c2de654a1
11+
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
12+
13+
.. |badge1| image:: https://img.shields.io/badge/maturity-Beta-yellow.png
14+
:target: https://odoo-community.org/page/development-status
15+
:alt: Beta
16+
.. |badge2| image:: https://img.shields.io/badge/licence-LGPL--3-blue.png
17+
:target: http://www.gnu.org/licenses/lgpl-3.0-standalone.html
18+
:alt: License: LGPL-3
19+
.. |badge3| image:: https://img.shields.io/badge/github-OCA%2Fserver--env-lightgray.png?logo=github
20+
:target: https://github.com/OCA/server-env/tree/17.0/server_environment_autocreate
21+
:alt: OCA/server-env
22+
.. |badge4| image:: https://img.shields.io/badge/weblate-Translate%20me-F47D42.png
23+
:target: https://translation.odoo-community.org/projects/server-env-17-0/server-env-17-0-server_environment_autocreate
24+
:alt: Translate me on Weblate
25+
.. |badge5| image:: https://img.shields.io/badge/runboat-Try%20me-875A7B.png
26+
:target: https://runboat.odoo-community.org/builds?repo=OCA/server-env&target_branch=17.0
27+
:alt: Try me on Runboat
28+
29+
|badge1| |badge2| |badge3| |badge4| |badge5|
30+
31+
This module adds a way to create automaticaly records using
32+
server_environment server.env.mixin.
33+
34+
**Table of contents**
35+
36+
.. contents::
37+
:local:
38+
39+
Use Cases / Context
40+
===================
41+
42+
Modules that uses server_environment server.env.mixin need to be created
43+
manually in the database. This module avoid that needs by adding a way
44+
to autocreate records.
45+
46+
Configuration
47+
=============
48+
49+
This module does not need any configuration in Odoo.
50+
51+
The configuration is made in either server_environment_files, the
52+
environment variable or the configuration file as described in
53+
server_environment.
54+
55+
On top of the fields available when defining a record inheriting
56+
server.env.mixin, it is possible to add ``__autocreate = {}``. The value
57+
is a dictionary that will be passed when the record is created. This
58+
allows setting required field values that are not made available. The
59+
values are only used once, when the object is created. Changes are not
60+
used.
61+
62+
To continue the example provided by server_environment, to have this
63+
module create the record for storage_backend.my_sftp, the file would
64+
look like:
65+
66+
::
67+
68+
# These variables are not odoo standard variables,
69+
# they are there to represent what your file could look like
70+
export WORKERS='8'
71+
export MAX_CRON_THREADS='1'
72+
export LOG_LEVEL=info
73+
export LOG_HANDLER=":INFO"
74+
export DB_MAXCONN=5
75+
76+
# server environment options
77+
export SERVER_ENV_CONFIG="
78+
[storage_backend.my_sftp]
79+
__autocreate={}
80+
sftp_server=10.10.10.10
81+
sftp_login=foo
82+
sftp_port=22200
83+
directory_path=Odoo
84+
"
85+
86+
Another example, using a value in the creation dictionnary, when using
87+
`fs_storage <https://github.com/OCA/storage/tree/17.0/fs_storage>`__
88+
module, the name of the storage is required so the configuration would
89+
look like:
90+
91+
.. code:: ini
92+
93+
[fs_storage.my_sftp]
94+
__autocreate = {"name": "My SFTP"}
95+
protocol=sftp
96+
options={"host": "10.10.10.10", "username": "foo", "password": "xxxxxxxxx"}
97+
98+
When the module creates such a record, it will add an xml id in the form
99+
``__server_environment_autocreate__.<section name with space replaced by ->``.
100+
101+
When the module is removed, the created record are kept. They can be
102+
found by searching the xmlid for the pseudo module
103+
``__server_environment_autocreate__``.
104+
105+
If the creation fails with an exception, or if the values dictionary is
106+
incorrect, this will prevent the loading of the registry. This is
107+
intended, so that odoo does not start without the intended
108+
configuration.
109+
110+
Usage
111+
=====
112+
113+
This module does not impact the user interface.
114+
115+
Known issues / Roadmap
116+
======================
117+
118+
- This module does not guarantee that any model record can be created,
119+
extra steps might be needed.
120+
- If a created record is not referenced in the configuration anymore,
121+
it is not removed.
122+
123+
Bug Tracker
124+
===========
125+
126+
Bugs are tracked on `GitHub Issues <https://github.com/OCA/server-env/issues>`_.
127+
In case of trouble, please check there if your issue has already been reported.
128+
If you spotted it first, help us to smash it by providing a detailed and welcomed
129+
`feedback <https://github.com/OCA/server-env/issues/new?body=module:%20server_environment_autocreate%0Aversion:%2017.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**>`_.
130+
131+
Do not contact contributors directly about support or help with technical issues.
132+
133+
Credits
134+
=======
135+
136+
Authors
137+
-------
138+
139+
* XCG Consulting
140+
141+
Contributors
142+
------------
143+
144+
- XCG Consulting, part of `Orbeet <https://orbeet.io/>`__:
145+
146+
- Vincent Hatakeyama <vincent.hatakeyama@orbeet.io>
147+
148+
Maintainers
149+
-----------
150+
151+
This module is maintained by the OCA.
152+
153+
.. image:: https://odoo-community.org/logo.png
154+
:alt: Odoo Community Association
155+
:target: https://odoo-community.org
156+
157+
OCA, or the Odoo Community Association, is a nonprofit organization whose
158+
mission is to support the collaborative development of Odoo features and
159+
promote its widespread use.
160+
161+
This module is part of the `OCA/server-env <https://github.com/OCA/server-env/tree/17.0/server_environment_autocreate>`_ project on GitHub.
162+
163+
You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute.
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
from . import models
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
# Copyright 2025 XCG Consulting
2+
# License LGPL-3.0 or later (https://www.gnu.org/licenses/lgpl.html)
3+
4+
{
5+
"name": "Server Environment Autocreate",
6+
"summary": """Add ability to auto create records""",
7+
"version": "17.0.1.0.0",
8+
"license": "LGPL-3",
9+
"author": "XCG Consulting,Odoo Community Association (OCA)",
10+
"depends": ["server_environment"],
11+
"development_status": "Beta",
12+
"category": "Tools",
13+
"website": "https://github.com/OCA/server-env",
14+
}
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
from . import server_env_mixin

0 commit comments

Comments
 (0)