Skip to content

Commit bee6c75

Browse files
committed
[IMP] stock_product_variant_mto: pre-commit auto fixes
1 parent 2f402c7 commit bee6c75

File tree

14 files changed

+603
-55
lines changed

14 files changed

+603
-55
lines changed
Lines changed: 91 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,91 @@
1+
=========================
2+
Stock Product Variant MTO
3+
=========================
4+
5+
..
6+
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
7+
!! This file is generated by oca-gen-addon-readme !!
8+
!! changes will be overwritten. !!
9+
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
10+
!! source digest: sha256:19127c85672968523ba9dac247eafabed27aaff202e5e8cc20d87b1f6ee204c6
11+
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
12+
13+
.. |badge1| image:: https://img.shields.io/badge/maturity-Alpha-red.png
14+
:target: https://odoo-community.org/page/development-status
15+
:alt: Alpha
16+
.. |badge2| image:: https://img.shields.io/badge/licence-AGPL--3-blue.png
17+
:target: http://www.gnu.org/licenses/agpl-3.0-standalone.html
18+
:alt: License: AGPL-3
19+
.. |badge3| image:: https://img.shields.io/badge/github-OCA%2Fstock--logistics--workflow-lightgray.png?logo=github
20+
:target: https://github.com/OCA/stock-logistics-workflow/tree/18.0/stock_product_variant_mto
21+
:alt: OCA/stock-logistics-workflow
22+
.. |badge4| image:: https://img.shields.io/badge/weblate-Translate%20me-F47D42.png
23+
:target: https://translation.odoo-community.org/projects/stock-logistics-workflow-18-0/stock-logistics-workflow-18-0-stock_product_variant_mto
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/stock-logistics-workflow&target_branch=18.0
27+
:alt: Try me on Runboat
28+
29+
|badge1| |badge2| |badge3| |badge4| |badge5|
30+
31+
This module allows to define if a product variant can use the Make To
32+
Order route without any dependency on its template routes settings.
33+
34+
.. IMPORTANT::
35+
This is an alpha version, the data model and design can change at any time without warning.
36+
Only for development or testing purpose, do not use in production.
37+
`More details on development status <https://odoo-community.org/page/development-status>`_
38+
39+
**Table of contents**
40+
41+
.. contents::
42+
:local:
43+
44+
Bug Tracker
45+
===========
46+
47+
Bugs are tracked on `GitHub Issues <https://github.com/OCA/stock-logistics-workflow/issues>`_.
48+
In case of trouble, please check there if your issue has already been reported.
49+
If you spotted it first, help us to smash it by providing a detailed and welcomed
50+
`feedback <https://github.com/OCA/stock-logistics-workflow/issues/new?body=module:%20stock_product_variant_mto%0Aversion:%2018.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**>`_.
51+
52+
Do not contact contributors directly about support or help with technical issues.
53+
54+
Credits
55+
=======
56+
57+
Authors
58+
-------
59+
60+
* Camptocamp SA
61+
62+
Contributors
63+
------------
64+
65+
- Matthieu Méquignon <[email protected]>
66+
- Akim Juillerat <[email protected]>
67+
68+
Maintainers
69+
-----------
70+
71+
This module is maintained by the OCA.
72+
73+
.. image:: https://odoo-community.org/logo.png
74+
:alt: Odoo Community Association
75+
:target: https://odoo-community.org
76+
77+
OCA, or the Odoo Community Association, is a nonprofit organization whose
78+
mission is to support the collaborative development of Odoo features and
79+
promote its widespread use.
80+
81+
.. |maintainer-mmequignon| image:: https://github.com/mmequignon.png?size=40px
82+
:target: https://github.com/mmequignon
83+
:alt: mmequignon
84+
85+
Current `maintainer <https://odoo-community.org/page/maintainer-role>`__:
86+
87+
|maintainer-mmequignon|
88+
89+
This module is part of the `OCA/stock-logistics-workflow <https://github.com/OCA/stock-logistics-workflow/tree/18.0/stock_product_variant_mto>`_ project on GitHub.
90+
91+
You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute.

stock_product_variant_mto/__manifest__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
"version": "14.0.1.0.0",
88
"development_status": "Alpha",
99
"category": "Inventory",
10-
"website": "https://github.com/OCA/stock-workflow",
10+
"website": "https://github.com/OCA/stock-logistics-workflow",
1111
"author": "Camptocamp SA, Odoo Community Association (OCA)",
1212
"maintainers": ["mmequignon"],
1313
"license": "AGPL-3",

stock_product_variant_mto/models/product_product.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
# Copyright 2023 Camptocamp SA
22
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl)
33

4-
from odoo import api, models, fields
4+
from odoo import api, fields, models
55

66
IS_MTO_HELP = """
77
Check or Uncheck this field to enable the Make To Order on the variant,
@@ -10,6 +10,7 @@
1010
will reset this setting on its variants.
1111
"""
1212

13+
1314
class ProductProduct(models.Model):
1415
_inherit = "product.product"
1516

@@ -25,7 +26,7 @@ class ProductProduct(models.Model):
2526
"stock.location.route",
2627
compute="_compute_route_ids",
2728
domain="[('product_selectable', '=', True)]",
28-
store=False
29+
store=False,
2930
)
3031

3132
def _compute_is_mto(self):
Lines changed: 23 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,14 @@
11
# Copyright 2023 Camptocamp SA
22
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl)
33

4-
from odoo import _, api, models, fields
4+
from odoo import _, api, models
5+
56

67
class ProductTemplate(models.Model):
78
_inherit = "product.template"
89

910
def write(self, values):
10-
if not "route_ids" in values:
11+
if "route_ids" not in values:
1112
return super().write(values)
1213
# As _compute_is_mto cannot use api.depends (or it would reset MTO
1314
# route on variants as soon as there is a change on the template routes),
@@ -18,26 +19,40 @@ def write(self, values):
1819
res = super().write(values)
1920
templates_mto_after = self.filtered(lambda t: mto_route in t.route_ids)
2021
templates_mto_added = template_not_mto_before & templates_mto_after
21-
templates_mto_removed = (self - template_not_mto_before) & (self - templates_mto_after)
22-
(templates_mto_added | templates_mto_removed).product_variant_ids._compute_is_mto()
22+
templates_mto_removed = (self - template_not_mto_before) & (
23+
self - templates_mto_after
24+
)
25+
(
26+
templates_mto_added | templates_mto_removed
27+
).product_variant_ids._compute_is_mto()
2328
return res
2429

2530
@api.onchange("route_ids")
2631
def onchange_route_ids(self):
2732
mto_route = self.env.ref("stock.route_warehouse0_mto", raise_if_not_found=False)
28-
if mto_route not in self._origin.route_ids and mto_route in self.route_ids._origin:
33+
if (
34+
mto_route not in self._origin.route_ids
35+
and mto_route in self.route_ids._origin
36+
):
2937
# Return warning activating MTO route
3038
return {
3139
"warning": {
3240
"title": _("Warning"),
33-
"message": _("Activating MTO route will reset `Variant is MTO` setting on the variants.")
41+
"message": _(
42+
"Activating MTO route will reset `Variant is MTO` setting on the variants."
43+
),
3444
}
3545
}
36-
if mto_route in self._origin.route_ids and mto_route not in self.route_ids._origin:
46+
if (
47+
mto_route in self._origin.route_ids
48+
and mto_route not in self.route_ids._origin
49+
):
3750
# Return warning deactivating MTO route
3851
return {
3952
"warning": {
4053
"title": _("Warning"),
41-
"message": _("Deactivating MTO route will reset `Variant is MTO` setting on the variants.")
54+
"message": _(
55+
"Deactivating MTO route will reset `Variant is MTO` setting on the variants."
56+
),
4257
}
4358
}
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
[build-system]
2+
requires = ["whool"]
3+
build-backend = "whool.buildapi"
File renamed without changes.
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
- Matthieu Méquignon \<<[email protected]>\>
2+
- Akim Juillerat \<<[email protected]>\>

stock_product_variant_mto/readme/CONTRIBUTORS.rst

Lines changed: 0 additions & 2 deletions
This file was deleted.
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
This module allows to define if a product variant can use the Make To
2+
Order route without any dependency on its template routes settings.

stock_product_variant_mto/readme/DESCRIPTION.rst

Lines changed: 0 additions & 3 deletions
This file was deleted.

0 commit comments

Comments
 (0)