Skip to content

Commit

Permalink
Merge PR #30 into 18.0
Browse files Browse the repository at this point in the history
Signed-off-by LoisRForgeFlow
  • Loading branch information
OCA-git-bot committed Jan 16, 2025
2 parents 7220fcf + f9c4199 commit 8f8d916
Show file tree
Hide file tree
Showing 18 changed files with 907 additions and 0 deletions.
80 changes: 80 additions & 0 deletions stock_orderpoint_move_link/README.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,80 @@
==========================
Stock Orderpoint Move Link
==========================

..
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!! This file is generated by oca-gen-addon-readme !!
!! changes will be overwritten. !!
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!! source digest: sha256:e48b874278a5a3db3d37d13b0c1ae1c08f6ef83c019d7317079fb964925a870d
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
.. |badge1| image:: https://img.shields.io/badge/maturity-Beta-yellow.png
:target: https://odoo-community.org/page/development-status
:alt: Beta
.. |badge2| image:: https://img.shields.io/badge/licence-LGPL--3-blue.png
:target: http://www.gnu.org/licenses/lgpl-3.0-standalone.html
:alt: License: LGPL-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_move_link
: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_move_link
: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|

This module adds to stock moves a direct link to the reordering rules
that created them. In chained moves, the reordering rule is propagated.

**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_move_link%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
-------

* ForgeFlow

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

- Jordi Ballester Alomar <[email protected]>
- Kitti Upariphutthiphong <[email protected]>
- Héctor Villarreal Ortega <[email protected]>
- Guewen Baconnier <[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_move_link>`_ project on GitHub.

You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute.
3 changes: 3 additions & 0 deletions stock_orderpoint_move_link/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# Copyright 2019 ForgeFlow, S.L.
# License LGPL-3.0 or later (https://www.gnu.org/licenses/lgpl.html).
from . import models
16 changes: 16 additions & 0 deletions stock_orderpoint_move_link/__manifest__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
# Copyright 2019 ForgeFlow, S.L.
# License LGPL-3.0 or later (https://www.gnu.org/licenses/lgpl.html).

{
"name": "Stock Orderpoint Move Link",
"summary": "Link Reordering rules to stock moves",
"version": "18.0.1.0.0",
"license": "LGPL-3",
"website": "https://github.com/OCA/stock-logistics-orderpoint",
"author": "ForgeFlow, Odoo Community Association (OCA)",
"category": "Warehouse Management",
"depends": ["stock"],
"data": ["views/stock_move_views.xml"],
"installable": True,
"auto_install": False,
}
42 changes: 42 additions & 0 deletions stock_orderpoint_move_link/i18n/it.po
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
# Translation of Odoo Server.
# This file contains the translation of the following modules:
# * stock_orderpoint_move_link
#
msgid ""
msgstr ""
"Project-Id-Version: Odoo Server 16.0\n"
"Report-Msgid-Bugs-To: \n"
"PO-Revision-Date: 2023-11-24 17:37+0000\n"
"Last-Translator: mymage <[email protected]>\n"
"Language-Team: none\n"
"Language: it\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: \n"
"Plural-Forms: nplurals=2; plural=n != 1;\n"
"X-Generator: Weblate 4.17\n"

#. module: stock_orderpoint_move_link
#: model:ir.model.fields,field_description:stock_orderpoint_move_link.field_stock_move__orderpoint_ids
msgid "Linked Reordering Rules"
msgstr "Regole riordino collegate"

#. module: stock_orderpoint_move_link
#: model:ir.model,name:stock_orderpoint_move_link.model_stock_warehouse_orderpoint
msgid "Minimum Inventory Rule"
msgstr "Regola giacenza minima"

#. module: stock_orderpoint_move_link
#: model:ir.model,name:stock_orderpoint_move_link.model_stock_move
msgid "Stock Move"
msgstr "Movimento di magazzino"

#. module: stock_orderpoint_move_link
#: model:ir.model,name:stock_orderpoint_move_link.model_stock_rule
msgid "Stock Rule"
msgstr "Regola di giacenza"

#. module: stock_orderpoint_move_link
#: model_terms:ir.ui.view,arch_db:stock_orderpoint_move_link.view_warehouse_orderpoint_move_form
msgid "Transfers"
msgstr "Trasferimenti"
39 changes: 39 additions & 0 deletions stock_orderpoint_move_link/i18n/stock_orderpoint_move_link.pot
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
# Translation of Odoo Server.
# This file contains the translation of the following modules:
# * stock_orderpoint_move_link
#
msgid ""
msgstr ""
"Project-Id-Version: Odoo Server 16.0\n"
"Report-Msgid-Bugs-To: \n"
"Last-Translator: \n"
"Language-Team: \n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: \n"
"Plural-Forms: \n"

#. module: stock_orderpoint_move_link
#: model:ir.model.fields,field_description:stock_orderpoint_move_link.field_stock_move__orderpoint_ids
msgid "Linked Reordering Rules"
msgstr ""

#. module: stock_orderpoint_move_link
#: model:ir.model,name:stock_orderpoint_move_link.model_stock_warehouse_orderpoint
msgid "Minimum Inventory Rule"
msgstr ""

#. module: stock_orderpoint_move_link
#: model:ir.model,name:stock_orderpoint_move_link.model_stock_move
msgid "Stock Move"
msgstr ""

#. module: stock_orderpoint_move_link
#: model:ir.model,name:stock_orderpoint_move_link.model_stock_rule
msgid "Stock Rule"
msgstr ""

#. module: stock_orderpoint_move_link
#: model_terms:ir.ui.view,arch_db:stock_orderpoint_move_link.view_warehouse_orderpoint_move_form
msgid "Transfers"
msgstr ""
42 changes: 42 additions & 0 deletions stock_orderpoint_move_link/i18n/zh_CN.po
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
# Translation of Odoo Server.
# This file contains the translation of the following modules:
# * stock_orderpoint_move_link
#
msgid ""
msgstr ""
"Project-Id-Version: Odoo Server 12.0\n"
"Report-Msgid-Bugs-To: \n"
"PO-Revision-Date: 2019-10-12 16:36+0000\n"
"Last-Translator: 黎伟杰 <[email protected]>\n"
"Language-Team: none\n"
"Language: zh_CN\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: \n"
"Plural-Forms: nplurals=1; plural=0;\n"
"X-Generator: Weblate 3.8\n"

#. module: stock_orderpoint_move_link
#: model:ir.model.fields,field_description:stock_orderpoint_move_link.field_stock_move__orderpoint_ids
msgid "Linked Reordering Rules"
msgstr "链接的重新订购规则"

#. module: stock_orderpoint_move_link
#: model:ir.model,name:stock_orderpoint_move_link.model_stock_warehouse_orderpoint
msgid "Minimum Inventory Rule"
msgstr "最小库存规则"

#. module: stock_orderpoint_move_link
#: model:ir.model,name:stock_orderpoint_move_link.model_stock_move
msgid "Stock Move"
msgstr "库存移动"

#. module: stock_orderpoint_move_link
#: model:ir.model,name:stock_orderpoint_move_link.model_stock_rule
msgid "Stock Rule"
msgstr "库存规则"

#. module: stock_orderpoint_move_link
#: model_terms:ir.ui.view,arch_db:stock_orderpoint_move_link.view_warehouse_orderpoint_move_form
msgid "Transfers"
msgstr "调拨"
5 changes: 5 additions & 0 deletions stock_orderpoint_move_link/models/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# Copyright 2019 ForgeFlow, S.L.
# License LGPL-3.0 or later (https://www.gnu.org/licenses/lgpl.html).
from . import stock
from . import stock_move
from . import stock_warehouse_orderpoint
34 changes: 34 additions & 0 deletions stock_orderpoint_move_link/models/stock.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
# Copyright 2019 ForgeFlow, S.L., Ecosoft
# License LGPL-3.0 or later (https://www.gnu.org/licenses/lgpl.html).
from odoo import models


class StockRule(models.Model):
_inherit = "stock.rule"

def _get_stock_move_values(
self,
product_id,
product_qty,
product_uom,
location_id,
name,
origin,
company_id,
values,
):
vals = super()._get_stock_move_values(
product_id,
product_qty,
product_uom,
location_id,
name,
origin,
company_id,
values,
)
if values.get("orderpoint_id"):
vals["orderpoint_ids"] = [(4, values["orderpoint_id"].id)]
elif values.get("orderpoint_ids"):
vals["orderpoint_ids"] = [(4, o.id) for o in values["orderpoint_ids"]]
return vals
22 changes: 22 additions & 0 deletions stock_orderpoint_move_link/models/stock_move.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
# Copyright 2019 ForgeFlow, S.L.
# License LGPL-3.0 or later (https://www.gnu.org/licenses/lgpl.html).
from odoo import fields, models


class StockMove(models.Model):
_inherit = "stock.move"

orderpoint_ids = fields.Many2many(
comodel_name="stock.warehouse.orderpoint", string="Linked Reordering Rules"
)

def _prepare_procurement_values(self):
res = super()._prepare_procurement_values()
if self.orderpoint_ids:
res["orderpoint_ids"] = self.orderpoint_ids
return res

def _merge_moves_fields(self):
res = super()._merge_moves_fields()
res["orderpoint_ids"] = [(4, m.id) for m in self.mapped("orderpoint_ids")]
return res
17 changes: 17 additions & 0 deletions stock_orderpoint_move_link/models/stock_warehouse_orderpoint.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
# Copyright 2019 ForgeFlow S.L.
# (http://www.forgeflow.com)
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl.html).

from odoo import models


class StockWarehouseOrderpoint(models.Model):
_inherit = "stock.warehouse.orderpoint"

def action_view_stock_picking(self):
result = self.env["ir.actions.act_window"]._for_xml_id(
"stock.action_picking_tree_all"
)
result["context"] = {}
result["domain"] = f"[('move_ids.orderpoint_ids', 'in', {self.ids})]"
return result
3 changes: 3 additions & 0 deletions stock_orderpoint_move_link/pyproject.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
[build-system]
requires = ["whool"]
build-backend = "whool.buildapi"
4 changes: 4 additions & 0 deletions stock_orderpoint_move_link/readme/CONTRIBUTORS.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
- Jordi Ballester Alomar \<[email protected]\>
- Kitti Upariphutthiphong \<[email protected]\>
- Héctor Villarreal Ortega \<[email protected]\>
- Guewen Baconnier \<[email protected]\>
2 changes: 2 additions & 0 deletions stock_orderpoint_move_link/readme/DESCRIPTION.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
This module adds to stock moves a direct link to the reordering rules
that created them. In chained moves, the reordering rule is propagated.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading

0 comments on commit 8f8d916

Please sign in to comment.