-
-
Notifications
You must be signed in to change notification settings - Fork 485
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Signed-off-by LoisRForgeFlow
- Loading branch information
Showing
18 changed files
with
1,335 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,80 @@ | ||
========================================= | ||
Unbuild orders with return subcontracting | ||
========================================= | ||
|
||
.. | ||
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! | ||
!! This file is generated by oca-gen-addon-readme !! | ||
!! changes will be overwritten. !! | ||
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! | ||
!! source digest: sha256:11f2e6d4a0a7c585038a75213c3ea46945a33fa40ecde95aef22f0cc999c8853 | ||
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! | ||
.. |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%2Fmanufacture-lightgray.png?logo=github | ||
:target: https://github.com/OCA/manufacture/tree/16.0/mrp_unbuild_subcontracting | ||
:alt: OCA/manufacture | ||
.. |badge4| image:: https://img.shields.io/badge/weblate-Translate%20me-F47D42.png | ||
:target: https://translation.odoo-community.org/projects/manufacture-16-0/manufacture-16-0-mrp_unbuild_subcontracting | ||
: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=16.0 | ||
:alt: Try me on Runboat | ||
|
||
|badge1| |badge2| |badge3| |badge4| |badge5| | ||
|
||
This module automatically creates an unbuild in draft state when a subcontracting picking return is created. In addition, when the picking is validated, the unbuild is also validated. | ||
To view the unbuilds created, you have to select the operation Subcontracted Unbuild Orders in debug mode | ||
|
||
**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_unbuild_subcontracting%0Aversion:%2016.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 | ||
~~~~~~~~~~~~ | ||
|
||
* `ForgeFlow <https://www.forgeflow.com>`_: | ||
|
||
* Thiago Mulero <thiago.mulero@forgeflow.com> | ||
* Bernat Puig <bernat.puig@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. | ||
|
||
This module is part of the `OCA/manufacture <https://github.com/OCA/manufacture/tree/16.0/mrp_unbuild_subcontracting>`_ project on GitHub. | ||
|
||
You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
from . import models |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
# Copyright 2022 ForgeFlow S.L. (https://www.forgeflow.com) | ||
# License LGPL-3.0 or later (https://www.gnu.org/licenses/lgpl.html). | ||
{ | ||
"name": "Unbuild orders with return subcontracting", | ||
"version": "16.0.1.0.0", | ||
"license": "LGPL-3", | ||
"category": "Manufacture", | ||
"summary": "Unbuild orders are created automatically " | ||
"when is returned a product subcontracted", | ||
"author": "ForgeFlow, Odoo Community Association (OCA)", | ||
"website": "https://github.com/OCA/manufacture", | ||
"depends": ["mrp_account", "mrp_subcontracting_purchase"], | ||
"data": ["views/mrp_unbuild_views.xml"], | ||
"installable": True, | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,94 @@ | ||
# Translation of Odoo Server. | ||
# This file contains the translation of the following modules: | ||
# * mrp_unbuild_subcontracting | ||
# | ||
msgid "" | ||
msgstr "" | ||
"Project-Id-Version: Odoo Server 14.0\n" | ||
"Report-Msgid-Bugs-To: \n" | ||
"PO-Revision-Date: 2022-12-23 13:45+0000\n" | ||
"Last-Translator: mymage <stefano.consolaro@mymage.it>\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.14.1\n" | ||
|
||
#. module: mrp_unbuild_subcontracting | ||
#: model_terms:ir.actions.act_window,help:mrp_unbuild_subcontracting.mrp_unbuild_subcontracted | ||
msgid "" | ||
"An unbuild order is used to break down a finished product into its " | ||
"components." | ||
msgstr "" | ||
"Un ordine di smontaggio viene utilizzato per separare un prodotto finito nei " | ||
"sui componenti." | ||
|
||
#. module: mrp_unbuild_subcontracting | ||
#: model:ir.model.fields,field_description:mrp_unbuild_subcontracting.field_mrp_unbuild__display_name | ||
#: model:ir.model.fields,field_description:mrp_unbuild_subcontracting.field_stock_move__display_name | ||
#: model:ir.model.fields,field_description:mrp_unbuild_subcontracting.field_stock_picking__display_name | ||
msgid "Display Name" | ||
msgstr "Nome visualizzato" | ||
|
||
#. module: mrp_unbuild_subcontracting | ||
#: model:ir.model.fields,field_description:mrp_unbuild_subcontracting.field_mrp_unbuild__id | ||
#: model:ir.model.fields,field_description:mrp_unbuild_subcontracting.field_stock_move__id | ||
#: model:ir.model.fields,field_description:mrp_unbuild_subcontracting.field_stock_picking__id | ||
msgid "ID" | ||
msgstr "ID" | ||
|
||
#. module: mrp_unbuild_subcontracting | ||
#: model:ir.model.fields,field_description:mrp_unbuild_subcontracting.field_mrp_unbuild__is_subcontracted | ||
msgid "Is Subcontracted" | ||
msgstr "In conto lavoro" | ||
|
||
#. module: mrp_unbuild_subcontracting | ||
#: model:ir.model.fields,field_description:mrp_unbuild_subcontracting.field_mrp_unbuild____last_update | ||
#: model:ir.model.fields,field_description:mrp_unbuild_subcontracting.field_stock_move____last_update | ||
#: model:ir.model.fields,field_description:mrp_unbuild_subcontracting.field_stock_picking____last_update | ||
msgid "Last Modified on" | ||
msgstr "Ultima modifica il" | ||
|
||
#. module: mrp_unbuild_subcontracting | ||
#: model_terms:ir.actions.act_window,help:mrp_unbuild_subcontracting.mrp_unbuild_subcontracted | ||
msgid "No unbuild order found" | ||
msgstr "Nessun ordine di smontaggio trovato" | ||
|
||
#. module: mrp_unbuild_subcontracting | ||
#: model:ir.model,name:mrp_unbuild_subcontracting.model_stock_move | ||
msgid "Stock Move" | ||
msgstr "Movimento di magazzino" | ||
|
||
#. module: mrp_unbuild_subcontracting | ||
#: model:ir.ui.menu,name:mrp_unbuild_subcontracting.menu_mrp_unbuild_subcontracted | ||
msgid "Subcontracted Unbuild Orders" | ||
msgstr "Ordini di smontaggio in conto lavoro" | ||
|
||
#. module: mrp_unbuild_subcontracting | ||
#: model:ir.model.fields,field_description:mrp_unbuild_subcontracting.field_stock_picking__subcontracted_unbuild_ids | ||
msgid "Suncontracted unbuilds" | ||
msgstr "Smontaggi in conto lavoro" | ||
|
||
#. module: mrp_unbuild_subcontracting | ||
#: code:addons/mrp_unbuild_subcontracting/models/stock_move.py:0 | ||
#, python-format | ||
msgid "To subcontract, use a planned transfer." | ||
msgstr "Per conto lavoro, utilizzare un trasferimento pianificato." | ||
|
||
#. module: mrp_unbuild_subcontracting | ||
#: model:ir.model,name:mrp_unbuild_subcontracting.model_stock_picking | ||
#: model:ir.model.fields,field_description:mrp_unbuild_subcontracting.field_mrp_unbuild__picking_id | ||
msgid "Transfer" | ||
msgstr "Trasferimento" | ||
|
||
#. module: mrp_unbuild_subcontracting | ||
#: model:ir.model,name:mrp_unbuild_subcontracting.model_mrp_unbuild | ||
msgid "Unbuild Order" | ||
msgstr "Ordine di smontaggio" | ||
|
||
#. module: mrp_unbuild_subcontracting | ||
#: model:ir.actions.act_window,name:mrp_unbuild_subcontracting.mrp_unbuild_subcontracted | ||
msgid "Unbuild Orders - Subcontracted" | ||
msgstr "Ordini smontaggio - In conto lavoro" |
89 changes: 89 additions & 0 deletions
89
mrp_unbuild_subcontracting/i18n/mrp_unbuild_subcontracting.pot
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,89 @@ | ||
# Translation of Odoo Server. | ||
# This file contains the translation of the following modules: | ||
# * mrp_unbuild_subcontracting | ||
# | ||
msgid "" | ||
msgstr "" | ||
"Project-Id-Version: Odoo Server 14.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: mrp_unbuild_subcontracting | ||
#: model_terms:ir.actions.act_window,help:mrp_unbuild_subcontracting.mrp_unbuild_subcontracted | ||
msgid "" | ||
"An unbuild order is used to break down a finished product into its " | ||
"components." | ||
msgstr "" | ||
|
||
#. module: mrp_unbuild_subcontracting | ||
#: model:ir.model.fields,field_description:mrp_unbuild_subcontracting.field_mrp_unbuild__display_name | ||
#: model:ir.model.fields,field_description:mrp_unbuild_subcontracting.field_stock_move__display_name | ||
#: model:ir.model.fields,field_description:mrp_unbuild_subcontracting.field_stock_picking__display_name | ||
msgid "Display Name" | ||
msgstr "" | ||
|
||
#. module: mrp_unbuild_subcontracting | ||
#: model:ir.model.fields,field_description:mrp_unbuild_subcontracting.field_mrp_unbuild__id | ||
#: model:ir.model.fields,field_description:mrp_unbuild_subcontracting.field_stock_move__id | ||
#: model:ir.model.fields,field_description:mrp_unbuild_subcontracting.field_stock_picking__id | ||
msgid "ID" | ||
msgstr "" | ||
|
||
#. module: mrp_unbuild_subcontracting | ||
#: model:ir.model.fields,field_description:mrp_unbuild_subcontracting.field_mrp_unbuild__is_subcontracted | ||
msgid "Is Subcontracted" | ||
msgstr "" | ||
|
||
#. module: mrp_unbuild_subcontracting | ||
#: model:ir.model.fields,field_description:mrp_unbuild_subcontracting.field_mrp_unbuild____last_update | ||
#: model:ir.model.fields,field_description:mrp_unbuild_subcontracting.field_stock_move____last_update | ||
#: model:ir.model.fields,field_description:mrp_unbuild_subcontracting.field_stock_picking____last_update | ||
msgid "Last Modified on" | ||
msgstr "" | ||
|
||
#. module: mrp_unbuild_subcontracting | ||
#: model_terms:ir.actions.act_window,help:mrp_unbuild_subcontracting.mrp_unbuild_subcontracted | ||
msgid "No unbuild order found" | ||
msgstr "" | ||
|
||
#. module: mrp_unbuild_subcontracting | ||
#: model:ir.model,name:mrp_unbuild_subcontracting.model_stock_move | ||
msgid "Stock Move" | ||
msgstr "" | ||
|
||
#. module: mrp_unbuild_subcontracting | ||
#: model:ir.ui.menu,name:mrp_unbuild_subcontracting.menu_mrp_unbuild_subcontracted | ||
msgid "Subcontracted Unbuild Orders" | ||
msgstr "" | ||
|
||
#. module: mrp_unbuild_subcontracting | ||
#: model:ir.model.fields,field_description:mrp_unbuild_subcontracting.field_stock_picking__subcontracted_unbuild_ids | ||
msgid "Suncontracted unbuilds" | ||
msgstr "" | ||
|
||
#. module: mrp_unbuild_subcontracting | ||
#: code:addons/mrp_unbuild_subcontracting/models/stock_move.py:0 | ||
#, python-format | ||
msgid "To subcontract, use a planned transfer." | ||
msgstr "" | ||
|
||
#. module: mrp_unbuild_subcontracting | ||
#: model:ir.model,name:mrp_unbuild_subcontracting.model_stock_picking | ||
#: model:ir.model.fields,field_description:mrp_unbuild_subcontracting.field_mrp_unbuild__picking_id | ||
msgid "Transfer" | ||
msgstr "" | ||
|
||
#. module: mrp_unbuild_subcontracting | ||
#: model:ir.model,name:mrp_unbuild_subcontracting.model_mrp_unbuild | ||
msgid "Unbuild Order" | ||
msgstr "" | ||
|
||
#. module: mrp_unbuild_subcontracting | ||
#: model:ir.actions.act_window,name:mrp_unbuild_subcontracting.mrp_unbuild_subcontracted | ||
msgid "Unbuild Orders - Subcontracted" | ||
msgstr "" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
from . import stock_picking | ||
from . import mrp_unbuild | ||
from . import stock_move |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
from odoo import fields, models | ||
|
||
|
||
class MrpUnbuild(models.Model): | ||
_inherit = "mrp.unbuild" | ||
|
||
picking_id = fields.Many2one("stock.picking", "Transfer", readonly=True) | ||
is_subcontracted = fields.Boolean("Is Subcontracted?", readonly=True) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
from collections import defaultdict | ||
|
||
from odoo import _, models | ||
from odoo.exceptions import UserError | ||
from odoo.tools.float_utils import float_is_zero | ||
|
||
|
||
class StockMove(models.Model): | ||
_inherit = "stock.move" | ||
|
||
def _action_confirm(self, merge=True, merge_into=False): | ||
if self.origin_returned_move_id: | ||
subcontract_details_per_picking = defaultdict(list) | ||
move_to_not_merge = self.env["stock.move"] | ||
for move in self: | ||
if ( | ||
move.location_dest_id.usage == "supplier" | ||
and move.location_id | ||
== self.picking_id.picking_type_id.default_location_src_id | ||
): | ||
continue | ||
if move.move_orig_ids.production_id: | ||
continue | ||
bom = move._get_subcontract_bom() | ||
if not bom: | ||
continue | ||
if ( | ||
float_is_zero( | ||
move.product_qty, precision_rounding=move.product_uom.rounding | ||
) | ||
and move.picking_id.immediate_transfer is True | ||
): | ||
raise UserError(_("To subcontract, use a planned transfer.")) | ||
subcontract_details_per_picking[move.picking_id].append((move, bom)) | ||
move_to_not_merge |= move | ||
for picking, subcontract_details in subcontract_details_per_picking.items(): | ||
picking._subcontracted_produce_unbuild(subcontract_details) | ||
|
||
# We avoid merging move due to complication with stock.rule. | ||
res = super(StockMove, move_to_not_merge)._action_confirm(merge=False) | ||
res |= super(StockMove, self - move_to_not_merge)._action_confirm( | ||
merge=merge, merge_into=merge_into | ||
) | ||
if subcontract_details_per_picking: | ||
self.env["stock.picking"].concat( | ||
*list(subcontract_details_per_picking.keys()) | ||
).action_assign() | ||
return res | ||
result = super(StockMove, self)._action_confirm( | ||
merge=merge, merge_into=merge_into | ||
) | ||
return result |
Oops, something went wrong.