Skip to content

Commit

Permalink
[17.0][ADD] repair_stock_dest: New module repair_stock_dest
Browse files Browse the repository at this point in the history
  • Loading branch information
ppyczko committed Sep 23, 2024
1 parent 53414c7 commit d15b5f6
Show file tree
Hide file tree
Showing 18 changed files with 930 additions and 0 deletions.
105 changes: 105 additions & 0 deletions repair_stock_dest/README.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,105 @@
========================
Repair Stock Destination
========================

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

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

This module adds the ability to specify the destination location of a
repaired product.

**Table of contents**

.. contents::
:local:

Usage
=====

To use this module, you need to:

Create a repair order:

1. Go to Repairs > Orders.
2. Create a new repair order.
3. Before confirming the repair, in the Miscellaneous tab, you can view
and change the Product Destination Location where the repaired
product will be stored. The value of this field comes from the
Default Product Destination Location field of the corresponding
Operation Type.

To be able to view the location related fields, make sure your user has
been added to the Technical / Manage Multiple Stock Locations group.

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

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

* Patryk Pyczko

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

- `APSL-Nagarro <https://apsl.tech>`__:

- Patryk Pyczko <[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.

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

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

|maintainer-ppyczko|

This module is part of the `OCA/repair <https://github.com/OCA/repair/tree/17.0/repair_stock_dest>`_ 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 repair_stock_dest/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl).

from . import models
17 changes: 17 additions & 0 deletions repair_stock_dest/__manifest__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
# Copyright 2024 Patryk Pyczko (APSL-Nagarro)<[email protected]>
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl).

{
"name": "Repair Stock Destination",
"summary": "Add destination field to a repair order",
"version": "17.0.1.0.0",
"category": "Repair",
"website": "https://github.com/OCA/repair",
"author": "Patryk Pyczko, Odoo Community Association (OCA)",
"maintainers": ["ppyczko"],
"license": "AGPL-3",
"application": False,
"installable": True,
"depends": ["repair"],
"data": ["views/repair_views.xml", "views/stock_picking_type_views.xml"],
}
50 changes: 50 additions & 0 deletions repair_stock_dest/i18n/ca_ES.po
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
# Translation of Odoo Server.
# This file contains the translation of the following modules:
# * repair_stock_dest
#
msgid ""
msgstr ""
"Project-Id-Version: Odoo Server 17.0\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2024-09-23 10:45+0000\n"
"PO-Revision-Date: 2024-09-23 10:45+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: repair_stock_dest
#: model:ir.model.fields,field_description:repair_stock_dest.field_stock_picking_type__default_product_location_dest_id
msgid "Default Product Destination Location"
msgstr "Ubicació de destí del producte per defecte"

#. module: repair_stock_dest
#: model:ir.model,name:repair_stock_dest.model_stock_picking_type
msgid "Picking Type"
msgstr "Tipus d'operació"

#. module: repair_stock_dest
#: model:ir.model.fields,field_description:repair_stock_dest.field_repair_order__product_location_dest_id
msgid "Product Destination Location"
msgstr "Ubicació de destí del producte"

#. module: repair_stock_dest
#: model:ir.model,name:repair_stock_dest.model_repair_order
msgid "Repair Order"
msgstr "Ordre de reparació"

#. module: repair_stock_dest
#: model:ir.model.fields,help:repair_stock_dest.field_stock_picking_type__default_product_location_dest_id
msgid ""
"This is the default product destination location when you create a repair "
"order with this operation type."
msgstr ""
"Aquesta és la ubicació de destí del producte per defecte quan crees una "
"ordre de reparació amb aquest tipus d'operació."

#. module: repair_stock_dest
#: model:ir.model.fields,help:repair_stock_dest.field_repair_order__product_location_dest_id
msgid "This is the location where the repaired product will be stored."
msgstr "Aquesta és la ubicació on s'emmagatzemarà el producte reparat."
50 changes: 50 additions & 0 deletions repair_stock_dest/i18n/es.po
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
# Translation of Odoo Server.
# This file contains the translation of the following modules:
# * repair_stock_dest
#
msgid ""
msgstr ""
"Project-Id-Version: Odoo Server 17.0\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2024-09-23 10:44+0000\n"
"PO-Revision-Date: 2024-09-23 10:44+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: repair_stock_dest
#: model:ir.model.fields,field_description:repair_stock_dest.field_stock_picking_type__default_product_location_dest_id
msgid "Default Product Destination Location"
msgstr "Ubicación de destino del producto por defecto"

#. module: repair_stock_dest
#: model:ir.model,name:repair_stock_dest.model_stock_picking_type
msgid "Picking Type"
msgstr "Tipo de operación"

#. module: repair_stock_dest
#: model:ir.model.fields,field_description:repair_stock_dest.field_repair_order__product_location_dest_id
msgid "Product Destination Location"
msgstr "Ubicación de destino del producto"

#. module: repair_stock_dest
#: model:ir.model,name:repair_stock_dest.model_repair_order
msgid "Repair Order"
msgstr "Orden de reparación"

#. module: repair_stock_dest
#: model:ir.model.fields,help:repair_stock_dest.field_stock_picking_type__default_product_location_dest_id
msgid ""
"This is the default product destination location when you create a repair "
"order with this operation type."
msgstr ""
"Esta es la ubicación de destino del producto por defecto cuando creas una "
"orden de reparación con este tipo de operación."

#. module: repair_stock_dest
#: model:ir.model.fields,help:repair_stock_dest.field_repair_order__product_location_dest_id
msgid "This is the location where the repaired product will be stored."
msgstr "Esta es la ubicación donde se almacenará el producto reparado."
4 changes: 4 additions & 0 deletions repair_stock_dest/models/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).

from . import repair
from . import stock_picking_type
35 changes: 35 additions & 0 deletions repair_stock_dest/models/repair.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
# Copyright 2024 Patryk Pyczko (APSL-Nagarro)<[email protected]>
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl).

from odoo import api, fields, models


class RepairOrder(models.Model):
_inherit = "repair.order"

product_location_dest_id = fields.Many2one(
"stock.location",
"Product Destination Location",
compute="_compute_product_location_dest_id",
store=True,
readonly=False,
required=True,
precompute=True,
index=True,
check_company=True,
help="This is the location where the repaired product will be stored.",
)

@api.depends("picking_type_id")
def _compute_product_location_dest_id(self):
for repair in self:
repair.product_location_dest_id = (
repair.picking_type_id.default_product_location_dest_id
)

def action_repair_done(self):
res = super().action_repair_done()

for record in self:
record.move_id.location_dest_id = record.product_location_dest_id.id
return res
27 changes: 27 additions & 0 deletions repair_stock_dest/models/stock_picking_type.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
# Copyright 2024 Patryk Pyczko (APSL-Nagarro)<[email protected]>
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl).

from odoo import api, fields, models


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

default_product_location_dest_id = fields.Many2one(
"stock.location",
"Default Product Destination Location",
compute="_compute_default_product_location_dest_id",
check_company=True,
store=True,
readonly=False,
precompute=True,
help="This is the default product destination location when you create a "
"repair order with this operation type.",
)

@api.depends("code")
def _compute_default_product_location_dest_id(self):
for picking_type in self:
stock_location = picking_type.warehouse_id.lot_stock_id
if picking_type.code == "repair_operation":
picking_type.default_product_location_dest_id = stock_location.id
3 changes: 3 additions & 0 deletions repair_stock_dest/pyproject.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
[build-system]
requires = ["whool"]
build-backend = "whool.buildapi"
3 changes: 3 additions & 0 deletions repair_stock_dest/readme/CONTRIBUTORS.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
- [APSL-Nagarro](https://apsl.tech):

> - Patryk Pyczko \<<[email protected]>\>
1 change: 1 addition & 0 deletions repair_stock_dest/readme/DESCRIPTION.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
This module adds the ability to specify the destination location of a repaired product.
9 changes: 9 additions & 0 deletions repair_stock_dest/readme/USAGE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
To use this module, you need to:

Create a repair order:

1. Go to Repairs > Orders.
2. Create a new repair order.
3. Before confirming the repair, in the Miscellaneous tab, you can view and change the Product Destination Location where the repaired product will be stored. The value of this field comes from the Default Product Destination Location field of the corresponding Operation Type.

To be able to view the location related fields, make sure your user has been added to the Technical / Manage Multiple Stock Locations group.
Binary file added repair_stock_dest/static/description/icon.png
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 d15b5f6

Please sign in to comment.