[IMP] base_technical_user: pre_commit auto fixes

pull/2805/head
John Herholz 2024-01-11 11:49:21 +01:00
parent 2493468820
commit 1e9f3825c4
9 changed files with 57 additions and 54 deletions

View File

@ -17,24 +17,23 @@ Base Technical User
:target: http://www.gnu.org/licenses/agpl-3.0-standalone.html :target: http://www.gnu.org/licenses/agpl-3.0-standalone.html
:alt: License: AGPL-3 :alt: License: AGPL-3
.. |badge3| image:: https://img.shields.io/badge/github-OCA%2Fserver--tools-lightgray.png?logo=github .. |badge3| image:: https://img.shields.io/badge/github-OCA%2Fserver--tools-lightgray.png?logo=github
:target: https://github.com/OCA/server-tools/tree/16.0/base_technical_user :target: https://github.com/OCA/server-tools/tree/17.0/base_technical_user
:alt: OCA/server-tools :alt: OCA/server-tools
.. |badge4| image:: https://img.shields.io/badge/weblate-Translate%20me-F47D42.png .. |badge4| image:: https://img.shields.io/badge/weblate-Translate%20me-F47D42.png
:target: https://translation.odoo-community.org/projects/server-tools-16-0/server-tools-16-0-base_technical_user :target: https://translation.odoo-community.org/projects/server-tools-17-0/server-tools-17-0-base_technical_user
:alt: Translate me on Weblate :alt: Translate me on Weblate
.. |badge5| image:: https://img.shields.io/badge/runboat-Try%20me-875A7B.png .. |badge5| image:: https://img.shields.io/badge/runboat-Try%20me-875A7B.png
:target: https://runboat.odoo-community.org/builds?repo=OCA/server-tools&target_branch=16.0 :target: https://runboat.odoo-community.org/builds?repo=OCA/server-tools&target_branch=17.0
:alt: Try me on Runboat :alt: Try me on Runboat
|badge1| |badge2| |badge3| |badge4| |badge5| |badge1| |badge2| |badge3| |badge4| |badge5|
This module extends the functionality of company management. This module extends the functionality of company management. It allows
It allows you to bind a technical user on the company in order to use it in you to bind a technical user on the company in order to use it in batch
batch processes. processes.
The technical user must The technical user must - be inactive to avoid login - be in the
- be inactive to avoid login required groups depending of what you need to do
- be in the required groups depending of what you need to do
**Table of contents** **Table of contents**
@ -44,23 +43,24 @@ The technical user must
Usage Usage
===== =====
If you install the module, you will find a tab on the company form allowing If you install the module, you will find a tab on the company form
to define the technical user. allowing to define the technical user.
In your code you can use the following helper that will return you In your code you can use the following helper that will return you
- a self with the user tech if configured - a self with the user tech if configured
- or a self with sudo user - or a self with sudo user
.. code-block:: python .. code:: python
self_tech = self.sudo_tech() self_tech = self.sudo_tech()
If you want to raise an error if the tech user in not configured just call it with If you want to raise an error if the tech user in not configured just
call it with
.. code-block:: python .. code:: python
self_tech = self.sudo_tech(raise_if_missing) self_tech = self.sudo_tech(raise_if_missing)
Bug Tracker Bug Tracker
=========== ===========
@ -68,7 +68,7 @@ Bug Tracker
Bugs are tracked on `GitHub Issues <https://github.com/OCA/server-tools/issues>`_. Bugs are tracked on `GitHub Issues <https://github.com/OCA/server-tools/issues>`_.
In case of trouble, please check there if your issue has already been reported. In case of trouble, please check there if your issue has already been reported.
If you spotted it first, help us to smash it by providing a detailed and welcomed If you spotted it first, help us to smash it by providing a detailed and welcomed
`feedback <https://github.com/OCA/server-tools/issues/new?body=module:%20base_technical_user%0Aversion:%2016.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**>`_. `feedback <https://github.com/OCA/server-tools/issues/new?body=module:%20base_technical_user%0Aversion:%2017.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**>`_.
Do not contact contributors directly about support or help with technical issues. Do not contact contributors directly about support or help with technical issues.
@ -76,17 +76,17 @@ Credits
======= =======
Authors Authors
~~~~~~~ -------
* ACSONE SA/NV * ACSONE SA/NV
Contributors Contributors
~~~~~~~~~~~~ ------------
* Cédric Pigeon <cedric.pigeon@acsone.eu> - Cédric Pigeon <cedric.pigeon@acsone.eu>
Maintainers Maintainers
~~~~~~~~~~~ -----------
This module is maintained by the OCA. This module is maintained by the OCA.
@ -98,6 +98,6 @@ OCA, or the Odoo Community Association, is a nonprofit organization whose
mission is to support the collaborative development of Odoo features and mission is to support the collaborative development of Odoo features and
promote its widespread use. promote its widespread use.
This module is part of the `OCA/server-tools <https://github.com/OCA/server-tools/tree/16.0/base_technical_user>`_ project on GitHub. This module is part of the `OCA/server-tools <https://github.com/OCA/server-tools/tree/17.0/base_technical_user>`_ project on GitHub.
You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute. You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute.

View File

@ -0,0 +1,3 @@
[build-system]
requires = ["whool"]
build-backend = "whool.buildapi"

View File

@ -0,0 +1 @@
- Cédric Pigeon \<<cedric.pigeon@acsone.eu>\>

View File

@ -1 +0,0 @@
* Cédric Pigeon <cedric.pigeon@acsone.eu>

View File

@ -0,0 +1,6 @@
This module extends the functionality of company management. It allows
you to bind a technical user on the company in order to use it in batch
processes.
The technical user must - be inactive to avoid login - be in the
required groups depending of what you need to do

View File

@ -1,7 +0,0 @@
This module extends the functionality of company management.
It allows you to bind a technical user on the company in order to use it in
batch processes.
The technical user must
- be inactive to avoid login
- be in the required groups depending of what you need to do

View File

@ -1,17 +1,18 @@
If you install the module, you will find a tab on the company form allowing If you install the module, you will find a tab on the company form
to define the technical user. allowing to define the technical user.
In your code you can use the following helper that will return you In your code you can use the following helper that will return you
- a self with the user tech if configured - a self with the user tech if configured
- or a self with sudo user - or a self with sudo user
.. code-block:: python ``` python
self_tech = self.sudo_tech()
```
self_tech = self.sudo_tech() If you want to raise an error if the tech user in not configured just
call it with
If you want to raise an error if the tech user in not configured just call it with ``` python
self_tech = self.sudo_tech(raise_if_missing)
.. code-block:: python ```
self_tech = self.sudo_tech(raise_if_missing)

View File

@ -369,13 +369,12 @@ ul.auto-toc {
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!! source digest: sha256:099eb071622953ab64fab1fa82cdb808104319009ed7e981e72b55f3dcda994d !! source digest: sha256:099eb071622953ab64fab1fa82cdb808104319009ed7e981e72b55f3dcda994d
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! --> !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! -->
<p><a class="reference external image-reference" href="https://odoo-community.org/page/development-status"><img alt="Beta" src="https://img.shields.io/badge/maturity-Beta-yellow.png" /></a> <a class="reference external image-reference" href="http://www.gnu.org/licenses/agpl-3.0-standalone.html"><img alt="License: AGPL-3" src="https://img.shields.io/badge/licence-AGPL--3-blue.png" /></a> <a class="reference external image-reference" href="https://github.com/OCA/server-tools/tree/16.0/base_technical_user"><img alt="OCA/server-tools" src="https://img.shields.io/badge/github-OCA%2Fserver--tools-lightgray.png?logo=github" /></a> <a class="reference external image-reference" href="https://translation.odoo-community.org/projects/server-tools-16-0/server-tools-16-0-base_technical_user"><img alt="Translate me on Weblate" src="https://img.shields.io/badge/weblate-Translate%20me-F47D42.png" /></a> <a class="reference external image-reference" href="https://runboat.odoo-community.org/builds?repo=OCA/server-tools&amp;target_branch=16.0"><img alt="Try me on Runboat" src="https://img.shields.io/badge/runboat-Try%20me-875A7B.png" /></a></p> <p><a class="reference external image-reference" href="https://odoo-community.org/page/development-status"><img alt="Beta" src="https://img.shields.io/badge/maturity-Beta-yellow.png" /></a> <a class="reference external image-reference" href="http://www.gnu.org/licenses/agpl-3.0-standalone.html"><img alt="License: AGPL-3" src="https://img.shields.io/badge/licence-AGPL--3-blue.png" /></a> <a class="reference external image-reference" href="https://github.com/OCA/server-tools/tree/17.0/base_technical_user"><img alt="OCA/server-tools" src="https://img.shields.io/badge/github-OCA%2Fserver--tools-lightgray.png?logo=github" /></a> <a class="reference external image-reference" href="https://translation.odoo-community.org/projects/server-tools-17-0/server-tools-17-0-base_technical_user"><img alt="Translate me on Weblate" src="https://img.shields.io/badge/weblate-Translate%20me-F47D42.png" /></a> <a class="reference external image-reference" href="https://runboat.odoo-community.org/builds?repo=OCA/server-tools&amp;target_branch=17.0"><img alt="Try me on Runboat" src="https://img.shields.io/badge/runboat-Try%20me-875A7B.png" /></a></p>
<p>This module extends the functionality of company management. <p>This module extends the functionality of company management. It allows
It allows you to bind a technical user on the company in order to use it in you to bind a technical user on the company in order to use it in batch
batch processes.</p> processes.</p>
<p>The technical user must <p>The technical user must - be inactive to avoid login - be in the
- be inactive to avoid login required groups depending of what you need to do</p>
- be in the required groups depending of what you need to do</p>
<p><strong>Table of contents</strong></p> <p><strong>Table of contents</strong></p>
<div class="contents local topic" id="contents"> <div class="contents local topic" id="contents">
<ul class="simple"> <ul class="simple">
@ -391,8 +390,8 @@ batch processes.</p>
</div> </div>
<div class="section" id="usage"> <div class="section" id="usage">
<h1><a class="toc-backref" href="#toc-entry-1">Usage</a></h1> <h1><a class="toc-backref" href="#toc-entry-1">Usage</a></h1>
<p>If you install the module, you will find a tab on the company form allowing <p>If you install the module, you will find a tab on the company form
to define the technical user.</p> allowing to define the technical user.</p>
<p>In your code you can use the following helper that will return you</p> <p>In your code you can use the following helper that will return you</p>
<ul class="simple"> <ul class="simple">
<li>a self with the user tech if configured</li> <li>a self with the user tech if configured</li>
@ -401,7 +400,8 @@ to define the technical user.</p>
<pre class="code python literal-block"> <pre class="code python literal-block">
<span class="n">self_tech</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">sudo_tech</span><span class="p">()</span> <span class="n">self_tech</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">sudo_tech</span><span class="p">()</span>
</pre> </pre>
<p>If you want to raise an error if the tech user in not configured just call it with</p> <p>If you want to raise an error if the tech user in not configured just
call it with</p>
<pre class="code python literal-block"> <pre class="code python literal-block">
<span class="n">self_tech</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">sudo_tech</span><span class="p">(</span><span class="n">raise_if_missing</span><span class="p">)</span> <span class="n">self_tech</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">sudo_tech</span><span class="p">(</span><span class="n">raise_if_missing</span><span class="p">)</span>
</pre> </pre>
@ -411,7 +411,7 @@ to define the technical user.</p>
<p>Bugs are tracked on <a class="reference external" href="https://github.com/OCA/server-tools/issues">GitHub Issues</a>. <p>Bugs are tracked on <a class="reference external" href="https://github.com/OCA/server-tools/issues">GitHub Issues</a>.
In case of trouble, please check there if your issue has already been reported. In case of trouble, please check there if your issue has already been reported.
If you spotted it first, help us to smash it by providing a detailed and welcomed If you spotted it first, help us to smash it by providing a detailed and welcomed
<a class="reference external" href="https://github.com/OCA/server-tools/issues/new?body=module:%20base_technical_user%0Aversion:%2016.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**">feedback</a>.</p> <a class="reference external" href="https://github.com/OCA/server-tools/issues/new?body=module:%20base_technical_user%0Aversion:%2017.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**">feedback</a>.</p>
<p>Do not contact contributors directly about support or help with technical issues.</p> <p>Do not contact contributors directly about support or help with technical issues.</p>
</div> </div>
<div class="section" id="credits"> <div class="section" id="credits">
@ -435,7 +435,7 @@ If you spotted it first, help us to smash it by providing a detailed and welcome
<p>OCA, or the Odoo Community Association, is a nonprofit organization whose <p>OCA, or the Odoo Community Association, is a nonprofit organization whose
mission is to support the collaborative development of Odoo features and mission is to support the collaborative development of Odoo features and
promote its widespread use.</p> promote its widespread use.</p>
<p>This module is part of the <a class="reference external" href="https://github.com/OCA/server-tools/tree/16.0/base_technical_user">OCA/server-tools</a> project on GitHub.</p> <p>This module is part of the <a class="reference external" href="https://github.com/OCA/server-tools/tree/17.0/base_technical_user">OCA/server-tools</a> project on GitHub.</p>
<p>You are welcome to contribute. To learn how please visit <a class="reference external" href="https://odoo-community.org/page/Contribute">https://odoo-community.org/page/Contribute</a>.</p> <p>You are welcome to contribute. To learn how please visit <a class="reference external" href="https://odoo-community.org/page/Contribute">https://odoo-community.org/page/Contribute</a>.</p>
</div> </div>
</div> </div>

View File

@ -11,7 +11,7 @@ from odoo.tests import TransactionCase
class SudoTechCase(TransactionCase): class SudoTechCase(TransactionCase):
@classmethod @classmethod
def setUpClass(cls): def setUpClass(cls):
super(SudoTechCase, cls).setUpClass() super().setUpClass()
cls.user_tech = ( cls.user_tech = (
cls.env["res.users"] cls.env["res.users"]
.with_context(tracking_disable=True, no_reset_password=True) .with_context(tracking_disable=True, no_reset_password=True)