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
112 changes: 112 additions & 0 deletions ddmrp_exclude_moves_adu_calc/README.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,112 @@
============================
DDMRP Exclude Moves ADU Calc
============================

.. !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!! This file is generated by oca-gen-addon-readme !!
!! changes will be overwritten. !!
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!

.. |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%2Fddmrp-lightgray.png?logo=github
:target: https://github.com/OCA/ddmrp/tree/13.0/ddmrp_exclude_moves_adu_calc
:alt: OCA/ddmrp
.. |badge4| image:: https://img.shields.io/badge/weblate-Translate%20me-F47D42.png
:target: https://translation.odoo-community.org/projects/ddmrp-13-0/ddmrp-13-0-ddmrp_exclude_moves_adu_calc
:alt: Translate me on Weblate
.. |badge5| image:: https://img.shields.io/badge/runbot-Try%20me-875A7B.png
:target: https://runbot.odoo-community.org/runbot/255/13.0
:alt: Try me on Runbot

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

This module adds new criteria to exclude moves from the calculation of the
Average Daily Usage (ADU) on a Buffer, based on:

* Locations
* Specific stock moves

**Table of contents**

.. contents::
:local:

Usage
=====

You can exclude specific moves or all moves towards a specific location:

* Go to *Inventory > Reports > Stock Moves* and click on *Action > Exclude
from ADU* for a specific move or several.
* Go to *Inventory > Configuration > WH Management > Locations* and check the
flag *Exclude this location from ADU calculation* for the desired locations.

Changelog
=========

13.0.1.0.0 (2021-03-15)
~~~~~~~~~~~~~~~~~~~~~~~

* Standard migration of the module to v13.

11.0.1.0.0 (2018-09-17)
~~~~~~~~~~~~~~~~~~~~~~~

* Start of history. Migrated to OCA/ddmrp.

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

Bugs are tracked on `GitHub Issues <https://github.com/OCA/ddmrp/issues>`_.
In case of trouble, please check there if your issue has already been reported.
If you spotted it first, help us smashing it by providing a detailed and welcomed
`feedback <https://github.com/OCA/ddmrp/issues/new?body=module:%20ddmrp_exclude_moves_adu_calc%0Aversion:%2013.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 <jordi.ballester@forgeflow.com>
* Lois Rilo Antelo <lois.rilo@forgeflow.com>

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.

.. |maintainer-JordiBForgeFlow| image:: https://github.com/JordiBForgeFlow.png?size=40px
:target: https://github.com/JordiBForgeFlow
:alt: JordiBForgeFlow
.. |maintainer-LoisRForgeFlow| image:: https://github.com/LoisRForgeFlow.png?size=40px
:target: https://github.com/LoisRForgeFlow
:alt: LoisRForgeFlow

Current `maintainers <https://odoo-community.org/page/maintainer-role>`__:

|maintainer-JordiBForgeFlow| |maintainer-LoisRForgeFlow|

This module is part of the `OCA/ddmrp <https://github.com/OCA/ddmrp/tree/13.0/ddmrp_exclude_moves_adu_calc>`_ 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 ddmrp_exclude_moves_adu_calc/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
from . import models
18 changes: 18 additions & 0 deletions ddmrp_exclude_moves_adu_calc/__manifest__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
# Copyright 2017-21 ForgeFlow (http://www.forgeflow.com)
# License LGPL-3.0 or later (https://www.gnu.org/licenses/lgpl.html).

{
"name": "DDMRP Exclude Moves ADU Calc",
"summary": "Define additional rules to exclude certain moves from ADU "
"calculation",
"version": "14.0.1.0.0",
"author": "ForgeFlow, " "Odoo Community Association (OCA)",
"maintainers": ["JordiBForgeFlow", "LoisRForgeFlow"],
"website": "https://github.com/OCA/ddmrp",
"category": "Warehouse Management",
"depends": ["ddmrp"],
"data": ["views/stock_move_view.xml", "views/stock_location_view.xml"],
"license": "LGPL-3",
"installable": True,
"application": False,
}
63 changes: 63 additions & 0 deletions ddmrp_exclude_moves_adu_calc/i18n/ddmrp_exclude_moves_adu_calc.pot
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
# Translation of Odoo Server.
# This file contains the translation of the following modules:
# * ddmrp_exclude_moves_adu_calc
#
msgid ""
msgstr ""
"Project-Id-Version: Odoo Server 13.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: ddmrp_exclude_moves_adu_calc
#: model:ir.actions.server,name:ddmrp_exclude_moves_adu_calc.action_server_mrp_production_request_refresh
msgid "Exclude from ADU"
msgstr ""

#. module: ddmrp_exclude_moves_adu_calc
#: model:ir.model.fields,field_description:ddmrp_exclude_moves_adu_calc.field_stock_location__exclude_from_adu
msgid "Exclude this location from ADU calculation"
msgstr ""

#. module: ddmrp_exclude_moves_adu_calc
#: model:ir.model.fields,field_description:ddmrp_exclude_moves_adu_calc.field_stock_move__exclude_from_adu
msgid "Exclude this move from ADU calculation"
msgstr ""

#. module: ddmrp_exclude_moves_adu_calc
#: model:ir.model.fields,help:ddmrp_exclude_moves_adu_calc.field_stock_location__exclude_from_adu
msgid ""
"If this flag is set stock moves into this location will be excluded from ADU"
" calculation in the origin location buffer."
msgstr ""

#. module: ddmrp_exclude_moves_adu_calc
#: model:ir.model.fields,help:ddmrp_exclude_moves_adu_calc.field_stock_move__exclude_from_adu
msgid ""
"If this flag is set this stock move will be excluded from ADU calculation"
msgstr ""

#. module: ddmrp_exclude_moves_adu_calc
#: model:ir.model,name:ddmrp_exclude_moves_adu_calc.model_stock_location
msgid "Inventory Locations"
msgstr ""

#. module: ddmrp_exclude_moves_adu_calc
#: code:addons/ddmrp_exclude_moves_adu_calc/models/stock_move.py:0
#, python-format
msgid "Only inventory managers are allowed perform this action."
msgstr ""

#. module: ddmrp_exclude_moves_adu_calc
#: model:ir.model,name:ddmrp_exclude_moves_adu_calc.model_stock_buffer
msgid "Stock Buffer"
msgstr ""

#. module: ddmrp_exclude_moves_adu_calc
#: model:ir.model,name:ddmrp_exclude_moves_adu_calc.model_stock_move
msgid "Stock Move"
msgstr ""
64 changes: 64 additions & 0 deletions ddmrp_exclude_moves_adu_calc/i18n/fr.po
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
# Translation of Odoo Server.
# This file contains the translation of the following modules:
# * ddmrp_exclude_moves_adu_calc
#
msgid ""
msgstr ""
"Project-Id-Version: Odoo Server 11.0\n"
"Report-Msgid-Bugs-To: \n"
"Last-Translator: Automatically generated\n"
"Language-Team: none\n"
"Language: fr\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"

#. module: ddmrp_exclude_moves_adu_calc
#: model:ir.actions.server,name:ddmrp_exclude_moves_adu_calc.action_server_mrp_production_request_refresh
msgid "Exclude from ADU"
msgstr ""

#. module: ddmrp_exclude_moves_adu_calc
#: model:ir.model.fields,field_description:ddmrp_exclude_moves_adu_calc.field_stock_location__exclude_from_adu
msgid "Exclude this location from ADU calculation"
msgstr ""

#. module: ddmrp_exclude_moves_adu_calc
#: model:ir.model.fields,field_description:ddmrp_exclude_moves_adu_calc.field_stock_move__exclude_from_adu
msgid "Exclude this move from ADU calculation"
msgstr ""

#. module: ddmrp_exclude_moves_adu_calc
#: model:ir.model.fields,help:ddmrp_exclude_moves_adu_calc.field_stock_location__exclude_from_adu
msgid ""
"If this flag is set stock moves into this location will be excluded from ADU "
"calculation in the origin location buffer."
msgstr ""

#. module: ddmrp_exclude_moves_adu_calc
#: model:ir.model.fields,help:ddmrp_exclude_moves_adu_calc.field_stock_move__exclude_from_adu
msgid ""
"If this flag is set this stock move will be excluded from ADU calculation"
msgstr ""

#. module: ddmrp_exclude_moves_adu_calc
#: model:ir.model,name:ddmrp_exclude_moves_adu_calc.model_stock_location
msgid "Inventory Locations"
msgstr ""

#. module: ddmrp_exclude_moves_adu_calc
#: code:addons/ddmrp_exclude_moves_adu_calc/models/stock_move.py:0
#, python-format
msgid "Only inventory managers are allowed perform this action."
msgstr ""

#. module: ddmrp_exclude_moves_adu_calc
#: model:ir.model,name:ddmrp_exclude_moves_adu_calc.model_stock_buffer
msgid "Stock Buffer"
msgstr ""

#. module: ddmrp_exclude_moves_adu_calc
#: model:ir.model,name:ddmrp_exclude_moves_adu_calc.model_stock_move
msgid "Stock Move"
msgstr ""
3 changes: 3 additions & 0 deletions ddmrp_exclude_moves_adu_calc/models/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
from . import stock_location
from . import stock_move
from . import stock_buffer
21 changes: 21 additions & 0 deletions ddmrp_exclude_moves_adu_calc/models/stock_buffer.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
# Copyright 2017-21 ForgeFlow (http://www.forgeflow.com)
# License LGPL-3.0 or later (https://www.gnu.org/licenses/lgpl.html).

from odoo import api, models


class StockBuffer(models.Model):
_inherit = "stock.buffer"

@api.model
def _exclude_past_moves_domain(self):
return [("exclude_from_adu", "=", True)]

@api.model
def _past_moves_domain(self, date_from, date_to, locations):
new_locs = locations.filtered(lambda l: not l.exclude_from_adu)
res = super()._past_moves_domain(date_from, date_to, new_locs)
exclude_moves = self.env["stock.move"].search(self._exclude_past_moves_domain())
if exclude_moves:
res.append(("id", "not in", exclude_moves.ids))
return res
15 changes: 15 additions & 0 deletions ddmrp_exclude_moves_adu_calc/models/stock_location.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
# Copyright 2017-21 ForgeFlow (http://www.forgeflow.com)
# License LGPL-3.0 or later (https://www.gnu.org/licenses/lgpl.html).

from odoo import fields, models


class StockLocation(models.Model):
_inherit = "stock.location"

exclude_from_adu = fields.Boolean(
string="Exclude this location from ADU calculation",
copy=False,
help="If this flag is set stock moves into this location will be "
"excluded from ADU calculation in the origin location buffer.",
)
25 changes: 25 additions & 0 deletions ddmrp_exclude_moves_adu_calc/models/stock_move.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
# Copyright 2017-21 ForgeFlow (http://www.forgeflow.com)
# License LGPL-3.0 or later (https://www.gnu.org/licenses/lgpl.html).

from odoo import _, fields, models
from odoo.exceptions import UserError


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

exclude_from_adu = fields.Boolean(
string="Exclude this move from ADU calculation",
copy=False,
help="If this flag is set this stock move will be excluded from ADU "
"calculation",
index=True,
)

def _toggle_exclude_from_adu(self):
if not self.env.user.has_group("stock.group_stock_manager"):
raise UserError(
_("Only inventory managers are allowed perform this action.")
)
for rec in self:
rec.exclude_from_adu = not rec.exclude_from_adu
4 changes: 4 additions & 0 deletions ddmrp_exclude_moves_adu_calc/readme/CONTRIBUTORS.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
* Jordi Ballester Alomar <jordi.ballester@forgeflow.com>
* Lois Rilo Antelo <lois.rilo@forgeflow.com>
* `Trobz <https://trobz.com>`_:
* Khoi Vo <khoivha@trobz.com>
1 change: 1 addition & 0 deletions ddmrp_exclude_moves_adu_calc/readme/CREDITS.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
The migration of this module from 13.0 to 14.0 was financially supported by Camptocamp
5 changes: 5 additions & 0 deletions ddmrp_exclude_moves_adu_calc/readme/DESCRIPTION.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
This module adds new criteria to exclude moves from the calculation of the
Average Daily Usage (ADU) on a Buffer, based on:

* Locations
* Specific stock moves
9 changes: 9 additions & 0 deletions ddmrp_exclude_moves_adu_calc/readme/HISTORY.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
13.0.1.0.0 (2021-03-15)
~~~~~~~~~~~~~~~~~~~~~~~

* Standard migration of the module to v13.

11.0.1.0.0 (2018-09-17)
~~~~~~~~~~~~~~~~~~~~~~~

* Start of history. Migrated to OCA/ddmrp.
6 changes: 6 additions & 0 deletions ddmrp_exclude_moves_adu_calc/readme/USAGE.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
You can exclude specific moves or all moves towards a specific location:

* Go to *Inventory > Reports > Stock Moves* and click on *Action > Exclude
from ADU* for a specific move or several.
* Go to *Inventory > Configuration > WH Management > Locations* and check the
flag *Exclude this location from ADU calculation* for the desired locations.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading