Skip to content

Commit

Permalink
[ADD] mrp_2_steps_consumed_qty_sync: New module
Browse files Browse the repository at this point in the history
TT50868
  • Loading branch information
sergio-teruel committed Sep 19, 2024
1 parent 0519696 commit 102690b
Show file tree
Hide file tree
Showing 14 changed files with 708 additions and 0 deletions.
88 changes: 88 additions & 0 deletions mrp_2_steps_consumed_qty_sync/README.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,88 @@
=============================
MRP 2 steps consumed qty sync
=============================

..
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!! This file is generated by oca-gen-addon-readme !!
!! changes will be overwritten. !!
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!! source digest: sha256:bf57d7cafed692fe20d0710b88e16940f6dd8eeda49c9490253d6468ede6ded8
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
.. |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-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%2Fmanufacture-lightgray.png?logo=github
:target: https://github.com/OCA/manufacture/tree/15.0/mrp_2_steps_consumed_qty_sync
:alt: OCA/manufacture
.. |badge4| image:: https://img.shields.io/badge/weblate-Translate%20me-F47D42.png
:target: https://translation.odoo-community.org/projects/manufacture-15-0/manufacture-15-0-mrp_2_steps_consumed_qty_sync
: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/manufacture&target_branch=15.0
:alt: Try me on Runboat

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

This module allows to update the quantities consumed from a production order components
when the previous picking in two steps setting is validated.

**Table of contents**

.. contents::
:local:

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

Bugs are tracked on `GitHub Issues <https://github.com/OCA/manufacture/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/manufacture/issues/new?body=module:%20mrp_2_steps_consumed_qty_sync%0Aversion:%2015.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
~~~~~~~

* Tecnativa

Contributors
~~~~~~~~~~~~

* `Tecnativa <https://www.tecnativa.com>`__:

* Sergio Teruel
* Carlos Dauden

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-sergio-teruel| image:: https://github.com/sergio-teruel.png?size=40px
:target: https://github.com/sergio-teruel
:alt: sergio-teruel

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

|maintainer-sergio-teruel|

This module is part of the `OCA/manufacture <https://github.com/OCA/manufacture/tree/15.0/mrp_2_steps_consumed_qty_sync>`_ 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 mrp_2_steps_consumed_qty_sync/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
from . import models
21 changes: 21 additions & 0 deletions mrp_2_steps_consumed_qty_sync/__manifest__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
# Copyright 2024 Tecnativa - Sergio Teruel
# Copyright 2024 Tecnativa - Carlos Dauden
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl)
{
"name": "MRP 2 steps consumed qty sync",
"summary": "Update consumed quantities when in 2 steps production scope "
"the picking is validated",
"version": "15.0.0.1.0",
"development_status": "Beta",
"license": "AGPL-3",
"author": "Tecnativa, Odoo Community Association (OCA)",
"maintainers": [
"sergio-teruel",
],
"website": "https://github.com/OCA/manufacture",
"category": "Manufacturing",
"depends": [
"mrp",
],
"installable": True,
}
23 changes: 23 additions & 0 deletions mrp_2_steps_consumed_qty_sync/i18n/es.po
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
# Translation of Odoo Server.
# This file contains the translation of the following modules:
# * mrp_2_steps_consumed_qty_sync
#
msgid ""
msgstr ""
"Project-Id-Version: Odoo Server 15.0\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2024-09-17 13:16+0000\n"
"PO-Revision-Date: 2024-09-17 15:17+0200\n"
"Last-Translator: Sergio Teruel <sergio.teruel@tecnativa.com>\n"
"Language-Team: \n"
"Language: es\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"Plural-Forms: nplurals=2; plural=(n != 1);\n"
"X-Generator: Poedit 3.0.1\n"

#. module: mrp_2_steps_consumed_qty_sync
#: model:ir.model,name:mrp_2_steps_consumed_qty_sync.model_stock_picking
msgid "Transfer"
msgstr "Albarán"
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
# Translation of Odoo Server.
# This file contains the translation of the following modules:
# * mrp_2_steps_consumed_qty_sync
#
msgid ""
msgstr ""
"Project-Id-Version: Odoo Server 15.0\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2024-09-17 13:16+0000\n"
"PO-Revision-Date: 2024-09-17 13:16+0000\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: mrp_2_steps_consumed_qty_sync
#: model:ir.model,name:mrp_2_steps_consumed_qty_sync.model_stock_picking
msgid "Transfer"
msgstr ""
1 change: 1 addition & 0 deletions mrp_2_steps_consumed_qty_sync/models/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
from . import stock_picking
30 changes: 30 additions & 0 deletions mrp_2_steps_consumed_qty_sync/models/stock_picking.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
# Copyright 2024 Tecnativa - Sergio Teruel
# Copyright 2024 Tecnativa - Carlos Dauden
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl)

from odoo import models


class StockPicking(models.Model):
_inherit = "stock.picking"

def _action_done(self):
res = super()._action_done()
for picking in self:
picking_type = picking.picking_type_id
if picking_type == picking_type.warehouse_id.pbm_type_id:
productions = (
picking.move_lines.move_dest_ids.raw_material_production_id
)
# Update the component initial demand in production order and assign
# the moves to cover cases like pick more quantities than expected.
# In this cases the quantity done is not propagated to linked move
for move in productions.move_raw_ids:
move.product_uom_qty = sum(
move.move_orig_ids.filtered(
lambda sm: sm.state == "done"
).mapped("quantity_done")
)
productions.move_raw_ids._action_assign()
productions.move_raw_ids._set_quantities_to_reservation()
return res
4 changes: 4 additions & 0 deletions mrp_2_steps_consumed_qty_sync/readme/CONTRIBUTORS.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
* `Tecnativa <https://www.tecnativa.com>`__:

* Sergio Teruel
* Carlos Dauden
2 changes: 2 additions & 0 deletions mrp_2_steps_consumed_qty_sync/readme/DESCRIPTION.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
This module allows to update the quantities consumed from a production order components
when the previous picking in two steps setting is validated.
Loading

0 comments on commit 102690b

Please sign in to comment.