Skip to content

Commit f7df6d1

Browse files
author
ilo
committed
[17.0][ADD] fieldservice_equipment_stock_return: add return order type
1 parent 0f9586a commit f7df6d1

23 files changed

+1158
-0
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,124 @@
1+
======================================
2+
Field Service - Stock Equipment Return
3+
======================================
4+
5+
..
6+
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
7+
!! This file is generated by oca-gen-addon-readme !!
8+
!! changes will be overwritten. !!
9+
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
10+
!! source digest: sha256:ccef108ff488fd2820ce9403b90512a866de4e4edaa606f7f03418b70520b741
11+
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
12+
13+
.. |badge1| image:: https://img.shields.io/badge/maturity-Beta-yellow.png
14+
:target: https://odoo-community.org/page/development-status
15+
:alt: Beta
16+
.. |badge2| image:: https://img.shields.io/badge/licence-AGPL--3-blue.png
17+
:target: http://www.gnu.org/licenses/agpl-3.0-standalone.html
18+
:alt: License: AGPL-3
19+
.. |badge3| image:: https://img.shields.io/badge/github-OCA%2Ffield--service-lightgray.png?logo=github
20+
:target: https://github.com/OCA/field-service/tree/17.0/fieldservice_equipment_stock_return
21+
:alt: OCA/field-service
22+
.. |badge4| image:: https://img.shields.io/badge/weblate-Translate%20me-F47D42.png
23+
:target: https://translation.odoo-community.org/projects/field-service-17-0/field-service-17-0-fieldservice_equipment_stock_return
24+
:alt: Translate me on Weblate
25+
.. |badge5| image:: https://img.shields.io/badge/runboat-Try%20me-875A7B.png
26+
:target: https://runboat.odoo-community.org/builds?repo=OCA/field-service&target_branch=17.0
27+
:alt: Try me on Runboat
28+
29+
|badge1| |badge2| |badge3| |badge4| |badge5|
30+
31+
This module allows you to return FSM equipments creating a new picking.
32+
33+
**Table of contents**
34+
35+
.. contents::
36+
:local:
37+
38+
Configuration
39+
=============
40+
41+
Check ``Field Service - Stock Equipment`` module configuration.
42+
43+
To configure this module, you need to:
44+
45+
- Go to Field Service > Configuration > Order Types
46+
- Check if you have at least one ``return`` order type
47+
- Set the ``Picking Type`` linked to the ``return`` order type
48+
49+
Usage
50+
=====
51+
52+
The ``Return`` field service order type can be used to create a field
53+
service order to dispatch someone to pickup equipments in its current
54+
location. From the equipment, it is possible to create an order to
55+
record the return of the equipment. This action will create a new
56+
picking with the equipment to be returned.
57+
58+
Bug Tracker
59+
===========
60+
61+
Bugs are tracked on `GitHub Issues <https://github.com/OCA/field-service/issues>`_.
62+
In case of trouble, please check there if your issue has already been reported.
63+
If you spotted it first, help us to smash it by providing a detailed and welcomed
64+
`feedback <https://github.com/OCA/field-service/issues/new?body=module:%20fieldservice_equipment_stock_return%0Aversion:%2017.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**>`_.
65+
66+
Do not contact contributors directly about support or help with technical issues.
67+
68+
Credits
69+
=======
70+
71+
Authors
72+
-------
73+
74+
* Camptocamp
75+
* Italo LOPES
76+
77+
Contributors
78+
------------
79+
80+
- Italo LOPES <italo.lopes@camptocamp.com>
81+
82+
Other credits
83+
-------------
84+
85+
The development of this module has been financially supported by:
86+
87+
- Camptocamp SA <https://camptocamp.com>
88+
89+
Maintainers
90+
-----------
91+
92+
This module is maintained by the OCA.
93+
94+
.. image:: https://odoo-community.org/logo.png
95+
:alt: Odoo Community Association
96+
:target: https://odoo-community.org
97+
98+
OCA, or the Odoo Community Association, is a nonprofit organization whose
99+
mission is to support the collaborative development of Odoo features and
100+
promote its widespread use.
101+
102+
.. |maintainer-brian10048| image:: https://github.com/brian10048.png?size=40px
103+
:target: https://github.com/brian10048
104+
:alt: brian10048
105+
.. |maintainer-wolfhall| image:: https://github.com/wolfhall.png?size=40px
106+
:target: https://github.com/wolfhall
107+
:alt: wolfhall
108+
.. |maintainer-max3903| image:: https://github.com/max3903.png?size=40px
109+
:target: https://github.com/max3903
110+
:alt: max3903
111+
.. |maintainer-smangukiya| image:: https://github.com/smangukiya.png?size=40px
112+
:target: https://github.com/smangukiya
113+
:alt: smangukiya
114+
.. |maintainer-imlopes| image:: https://github.com/imlopes.png?size=40px
115+
:target: https://github.com/imlopes
116+
:alt: imlopes
117+
118+
Current `maintainers <https://odoo-community.org/page/maintainer-role>`__:
119+
120+
|maintainer-brian10048| |maintainer-wolfhall| |maintainer-max3903| |maintainer-smangukiya| |maintainer-imlopes|
121+
122+
This module is part of the `OCA/field-service <https://github.com/OCA/field-service/tree/17.0/fieldservice_equipment_stock_return>`_ project on GitHub.
123+
124+
You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
from . import models
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
# Copyright 2024 Camptocamp SA (https://www.camptocamp.com).
2+
# @author: Italo Lopes <italo.lopes@camptocamp.com>
3+
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
4+
5+
{
6+
"name": "Field Service - Stock Equipment Return",
7+
"summary": "Integrate return orders for field service equipments",
8+
"version": "17.0.1.0.0",
9+
"category": "Field Service",
10+
"author": "Camptocamp, " "Italo LOPES, " "Odoo Community Association (OCA)",
11+
"website": "https://github.com/OCA/field-service",
12+
"depends": [
13+
"fieldservice_equipment_stock",
14+
],
15+
"data": [
16+
"data/fsm_order_type.xml",
17+
"views/fsm_equipment.xml",
18+
"views/fsm_order_view.xml",
19+
"views/fsm_order_type_view.xml",
20+
],
21+
"license": "AGPL-3",
22+
"development_status": "Beta",
23+
"maintainers": [
24+
"brian10048",
25+
"wolfhall",
26+
"max3903",
27+
"smangukiya",
28+
"imlopes",
29+
],
30+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
<?xml version="1.0" encoding="utf-8" ?>
2+
<odoo noupdate="1">
3+
4+
<record id="fsm_order_type_return" model="fsm.order.type">
5+
<field name="name">Return</field>
6+
<field name="internal_type">return</field>
7+
</record>
8+
9+
</odoo>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,73 @@
1+
# Translation of Odoo Server.
2+
# This file contains the translation of the following modules:
3+
# * fieldservice_equipment_stock_return
4+
#
5+
msgid ""
6+
msgstr ""
7+
"Project-Id-Version: Odoo Server 17.0+e\n"
8+
"Report-Msgid-Bugs-To: \n"
9+
"POT-Creation-Date: 2024-10-29 17:13+0000\n"
10+
"PO-Revision-Date: 2024-10-29 17:13+0000\n"
11+
"Last-Translator: \n"
12+
"Language-Team: \n"
13+
"MIME-Version: 1.0\n"
14+
"Content-Type: text/plain; charset=UTF-8\n"
15+
"Content-Transfer-Encoding: \n"
16+
"Plural-Forms: \n"
17+
18+
#. module: fieldservice_equipment_stock_return
19+
#: model_terms:ir.ui.view,arch_db:fieldservice_equipment_stock_return.fsm_equipment_form_view_stock
20+
msgid "Create Return"
21+
msgstr ""
22+
23+
#. module: fieldservice_equipment_stock_return
24+
#: model:ir.model,name:fieldservice_equipment_stock_return.model_fsm_equipment
25+
msgid "Field Service Equipment"
26+
msgstr ""
27+
28+
#. module: fieldservice_equipment_stock_return
29+
#: model:ir.model,name:fieldservice_equipment_stock_return.model_fsm_order
30+
msgid "Field Service Order"
31+
msgstr ""
32+
33+
#. module: fieldservice_equipment_stock_return
34+
#: model:ir.model,name:fieldservice_equipment_stock_return.model_fsm_order_type
35+
msgid "Field Service Order Type"
36+
msgstr ""
37+
38+
#. module: fieldservice_equipment_stock_return
39+
#. odoo-python
40+
#: code:addons/fieldservice_equipment_stock_return/models/fsm_order.py:0
41+
#, python-format
42+
msgid "Impossible to find the equipment current location."
43+
msgstr ""
44+
45+
#. module: fieldservice_equipment_stock_return
46+
#: model:ir.model.fields,field_description:fieldservice_equipment_stock_return.field_fsm_order_type__internal_type
47+
msgid "Internal Type"
48+
msgstr ""
49+
50+
#. module: fieldservice_equipment_stock_return
51+
#. odoo-python
52+
#: code:addons/fieldservice_equipment_stock_return/models/fsm_equipment.py:0
53+
#, python-format
54+
msgid "No return order type found."
55+
msgstr ""
56+
57+
#. module: fieldservice_equipment_stock_return
58+
#: model:ir.model.fields,field_description:fieldservice_equipment_stock_return.field_fsm_order_type__picking_type_id
59+
msgid "Picking Type"
60+
msgstr ""
61+
62+
#. module: fieldservice_equipment_stock_return
63+
#: model:ir.model.fields.selection,name:fieldservice_equipment_stock_return.selection__fsm_order_type__internal_type__return
64+
msgid "Return"
65+
msgstr ""
66+
67+
#. module: fieldservice_equipment_stock_return
68+
#. odoo-python
69+
#: code:addons/fieldservice_equipment_stock_return/models/fsm_order.py:0
70+
#, python-format
71+
msgid ""
72+
"You must set a Picking Type on the order type and an equipment on the order."
73+
msgstr ""
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,74 @@
1+
# Translation of Odoo Server.
2+
# This file contains the translation of the following modules:
3+
# * fieldservice_equipment_stock_return
4+
#
5+
msgid ""
6+
msgstr ""
7+
"Project-Id-Version: Odoo Server 17.0+e\n"
8+
"Report-Msgid-Bugs-To: \n"
9+
"POT-Creation-Date: 2024-10-29 17:13+0000\n"
10+
"PO-Revision-Date: 2024-10-29 17:13+0000\n"
11+
"Last-Translator: \n"
12+
"Language-Team: \n"
13+
"MIME-Version: 1.0\n"
14+
"Content-Type: text/plain; charset=UTF-8\n"
15+
"Content-Transfer-Encoding: \n"
16+
"Plural-Forms: \n"
17+
18+
#. module: fieldservice_equipment_stock_return
19+
#: model_terms:ir.ui.view,arch_db:fieldservice_equipment_stock_return.fsm_equipment_form_view_stock
20+
msgid "Create Return"
21+
msgstr "Créer un retour"
22+
23+
#. module: fieldservice_equipment_stock_return
24+
#: model:ir.model,name:fieldservice_equipment_stock_return.model_fsm_equipment
25+
msgid "Field Service Equipment"
26+
msgstr "Équipement de service sur site"
27+
28+
#. module: fieldservice_equipment_stock_return
29+
#: model:ir.model,name:fieldservice_equipment_stock_return.model_fsm_order
30+
msgid "Field Service Order"
31+
msgstr "Commande de service sur site"
32+
33+
#. module: fieldservice_equipment_stock_return
34+
#: model:ir.model,name:fieldservice_equipment_stock_return.model_fsm_order_type
35+
msgid "Field Service Order Type"
36+
msgstr "Type de commande de service sur site"
37+
38+
#. module: fieldservice_equipment_stock_return
39+
#. odoo-python
40+
#: code:addons/fieldservice_equipment_stock_return/models/fsm_order.py:0
41+
#, python-format
42+
msgid "Impossible to find the equipment current location."
43+
msgstr "Impossible de trouver l'emplacement actuel de l'équipement."
44+
45+
#. module: fieldservice_equipment_stock_return
46+
#: model:ir.model.fields,field_description:fieldservice_equipment_stock_return.field_fsm_order_type__internal_type
47+
msgid "Internal Type"
48+
msgstr "Type interne"
49+
50+
#. module: fieldservice_equipment_stock_return
51+
#. odoo-python
52+
#: code:addons/fieldservice_equipment_stock_return/models/fsm_equipment.py:0
53+
#, python-format
54+
msgid "No return order type found."
55+
msgstr "Aucun type de commande avec un type interne de retour trouvé."
56+
57+
#. module: fieldservice_equipment_stock_return
58+
#: model:ir.model.fields,field_description:fieldservice_equipment_stock_return.field_fsm_order_type__picking_type_id
59+
msgid "Picking Type"
60+
msgstr ""
61+
62+
#. module: fieldservice_equipment_stock_return
63+
#: model:ir.model.fields.selection,name:fieldservice_equipment_stock_return.selection__fsm_order_type__internal_type__return
64+
msgid "Return"
65+
msgstr "Retour"
66+
67+
#. module: fieldservice_equipment_stock_return
68+
#. odoo-python
69+
#: code:addons/fieldservice_equipment_stock_return/models/fsm_order.py:0
70+
#, python-format
71+
msgid ""
72+
"You must set a Picking Type on the order type and an equipment on the order."
73+
msgstr ""
74+
"Vous devez définir un type de opération sur le type de commande et un équipement."
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
from . import (
2+
fsm_equipment,
3+
fsm_order,
4+
fsm_order_type,
5+
)
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
# Copyright 2024 Camptocamp SA (https://www.camptocamp.com).
2+
# @author: Italo Lopes <italo.lopes@camptocamp.com>
3+
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
4+
5+
from odoo import _, models
6+
from odoo.exceptions import ValidationError
7+
8+
9+
class FSMEquipment(models.Model):
10+
_inherit = "fsm.equipment"
11+
12+
def create_equipment_order_return(self):
13+
self.ensure_one()
14+
order_type = self.env.ref(
15+
"fieldservice_equipment_stock_return.fsm_order_type_return",
16+
raise_if_not_found=False,
17+
)
18+
if not order_type:
19+
order_type = self.env["fsm.order.type"].search(
20+
[("internal_type", "=", "return")], limit=1
21+
)
22+
if not order_type:
23+
raise ValidationError(_("No return order type found."))
24+
return {
25+
"name": "Return Equipment",
26+
"type": "ir.actions.act_window",
27+
"res_model": "fsm.order",
28+
"view_mode": "form",
29+
"context": {
30+
"default_equipment_id": self.id,
31+
"default_type": order_type and order_type.id or False,
32+
},
33+
}

0 commit comments

Comments
 (0)