Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
85 changes: 85 additions & 0 deletions stock_orderpoint_variant_mto_as_mts/README.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,85 @@
===================================
Stock Orderpoint Variant MTO as MTS
===================================

..
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!! This file is generated by oca-gen-addon-readme !!
!! changes will be overwritten. !!
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!! source digest: sha256:fba59931517ad2e10732e30f4e3e969d138737e893163feedd3c7e7a305f784f
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!

.. |badge1| image:: https://img.shields.io/badge/maturity-Alpha-red.png
:target: https://odoo-community.org/page/development-status
:alt: Alpha
.. |badge2| image:: https://img.shields.io/badge/licence-AGPL--3-blue.png
:target: http://www.gnu.org/licenses/agpl-3.0-standalone.html
:alt: License: AGPL-3
.. |badge3| image:: https://img.shields.io/badge/github-OCA%2Fstock--logistics--orderpoint-lightgray.png?logo=github
:target: https://github.com/OCA/stock-logistics-orderpoint/tree/18.0/stock_orderpoint_variant_mto_as_mts
:alt: OCA/stock-logistics-orderpoint
.. |badge4| image:: https://img.shields.io/badge/weblate-Translate%20me-F47D42.png
:target: https://translation.odoo-community.org/projects/stock-logistics-orderpoint-18-0/stock-logistics-orderpoint-18-0-stock_orderpoint_variant_mto_as_mts
:alt: Translate me on Weblate
.. |badge5| image:: https://img.shields.io/badge/runboat-Try%20me-875A7B.png
:target: https://runboat.odoo-community.org/builds?repo=OCA/stock-logistics-orderpoint&target_branch=18.0
:alt: Try me on Runboat

|badge1| |badge2| |badge3| |badge4| |badge5|

Glue module between ``stock_orderpoint_mto_as_mts`` and
``product_variant_route_mto`` to trigger reordering rules for product
variants

.. IMPORTANT::
This is an alpha version, the data model and design can change at any time without warning.
Only for development or testing purpose, do not use in production.
`More details on development status <https://odoo-community.org/page/development-status>`_

**Table of contents**

.. contents::
:local:

Bug Tracker
===========

Bugs are tracked on `GitHub Issues <https://github.com/OCA/stock-logistics-orderpoint/issues>`_.
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
`feedback <https://github.com/OCA/stock-logistics-orderpoint/issues/new?body=module:%20stock_orderpoint_variant_mto_as_mts%0Aversion:%2018.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.

Credits
=======

Authors
-------

* Camptocamp SA
* BCIM

Contributors
------------

- Henry Backman <[email protected]>
- Jacques-Etienne Baudoux (BICM) <[email protected]>

Maintainers
-----------

This module is maintained by the OCA.

.. image:: https://odoo-community.org/logo.png
:alt: Odoo Community Association
:target: https://odoo-community.org

OCA, or the Odoo Community Association, is a nonprofit organization whose
mission is to support the collaborative development of Odoo features and
promote its widespread use.

This module is part of the `OCA/stock-logistics-orderpoint <https://github.com/OCA/stock-logistics-orderpoint/tree/18.0/stock_orderpoint_variant_mto_as_mts>`_ project on GitHub.

You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute.
1 change: 1 addition & 0 deletions stock_orderpoint_variant_mto_as_mts/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
from . import models
17 changes: 17 additions & 0 deletions stock_orderpoint_variant_mto_as_mts/__manifest__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
# Copyright 2025 Camptocamp SA
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl.html).

{
"name": "Stock Orderpoint Variant MTO as MTS",
"summary": "Stock Orderpoint Variant MTO as MTS",
"version": "18.0.1.0.0",
"development_status": "Alpha",
"license": "AGPL-3",
"website": "https://github.com/OCA/stock-logistics-orderpoint",
"author": "Camptocamp SA, BCIM, Odoo Community Association (OCA)",
"category": "Warehouse Management",
"depends": ["stock_orderpoint_mto_as_mts", "product_variant_route_mto"],
"data": [],
"installable": True,
"auto_install": True,
}
2 changes: 2 additions & 0 deletions stock_orderpoint_variant_mto_as_mts/models/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
from . import product_product
from . import stock_route
21 changes: 21 additions & 0 deletions stock_orderpoint_variant_mto_as_mts/models/product_product.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
# Copyright 2025 Camptocamp SA
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl).

from odoo import models


class ProductProduct(models.Model):
_inherit = "product.product"

def write(self, vals):
if self.env.context.get("orderpoint_mto_as_mts"):
return super().write(vals)
if "is_mto" in vals:
original_mto_products = self.filtered("is_mto")
res = super().write(vals)
if "is_mto" in vals:
# is_mto may have changed
original_mto_products._archive_orderpoints_on_mto_removal()
original_not_mto_products = self - original_mto_products
original_not_mto_products._ensure_default_orderpoint_for_mto()
return res
25 changes: 25 additions & 0 deletions stock_orderpoint_variant_mto_as_mts/models/stock_route.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
# Copyright 2025 Jacques-Etienne Baudoux (BCIM) <[email protected]>
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl).

from odoo import models


class StockRoute(models.Model):
_inherit = "stock.route"

def write(self, vals):
if "is_mto" not in vals:
return super().write(vals)
products = self.product_ids.product_variant_ids
products |= self.env["product.product"].search(
[("categ_id", "child_of", self.categ_ids.ids)]
)
products = products.with_context(orderpoint_mto_as_mts=True)
if vals["is_mto"]:
products.is_mto = True
else:
mto_routes = self.env["stock.route"].search([("is_mto", "=", True)])
if not mto_routes:
# When the last mto route is unflagged
products.is_mto = False
return super().write(vals)
3 changes: 3 additions & 0 deletions stock_orderpoint_variant_mto_as_mts/pyproject.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
[build-system]
requires = ["whool"]
build-backend = "whool.buildapi"
2 changes: 2 additions & 0 deletions stock_orderpoint_variant_mto_as_mts/readme/CONTRIBUTORS.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
- Henry Backman \<[email protected]\>
- Jacques-Etienne Baudoux (BICM) \<[email protected]\>
2 changes: 2 additions & 0 deletions stock_orderpoint_variant_mto_as_mts/readme/DESCRIPTION.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
Glue module between `stock_orderpoint_mto_as_mts` and `product_variant_route_mto` to
trigger reordering rules for product variants
Loading
Loading