Skip to content

Commit 8dfd9eb

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

22 files changed

+1104
-0
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,115 @@
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+
Bug Tracker
50+
===========
51+
52+
Bugs are tracked on `GitHub Issues <https://github.com/OCA/field-service/issues>`_.
53+
In case of trouble, please check there if your issue has already been reported.
54+
If you spotted it first, help us to smash it by providing a detailed and welcomed
55+
`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**>`_.
56+
57+
Do not contact contributors directly about support or help with technical issues.
58+
59+
Credits
60+
=======
61+
62+
Authors
63+
-------
64+
65+
* Camptocamp
66+
* Italo LOPES
67+
68+
Contributors
69+
------------
70+
71+
- Italo LOPES <italo.lopes@camptocamp.com>
72+
73+
Other credits
74+
-------------
75+
76+
The development of this module has been financially supported by:
77+
78+
- Camptocamp SA <https://camptocamp.com>
79+
80+
Maintainers
81+
-----------
82+
83+
This module is maintained by the OCA.
84+
85+
.. image:: https://odoo-community.org/logo.png
86+
:alt: Odoo Community Association
87+
:target: https://odoo-community.org
88+
89+
OCA, or the Odoo Community Association, is a nonprofit organization whose
90+
mission is to support the collaborative development of Odoo features and
91+
promote its widespread use.
92+
93+
.. |maintainer-brian10048| image:: https://github.com/brian10048.png?size=40px
94+
:target: https://github.com/brian10048
95+
:alt: brian10048
96+
.. |maintainer-wolfhall| image:: https://github.com/wolfhall.png?size=40px
97+
:target: https://github.com/wolfhall
98+
:alt: wolfhall
99+
.. |maintainer-max3903| image:: https://github.com/max3903.png?size=40px
100+
:target: https://github.com/max3903
101+
:alt: max3903
102+
.. |maintainer-smangukiya| image:: https://github.com/smangukiya.png?size=40px
103+
:target: https://github.com/smangukiya
104+
:alt: smangukiya
105+
.. |maintainer-imlopes| image:: https://github.com/imlopes.png?size=40px
106+
:target: https://github.com/imlopes
107+
:alt: imlopes
108+
109+
Current `maintainers <https://odoo-community.org/page/maintainer-role>`__:
110+
111+
|maintainer-brian10048| |maintainer-wolfhall| |maintainer-max3903| |maintainer-smangukiya| |maintainer-imlopes|
112+
113+
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.
114+
115+
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,81 @@
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 14:22+0000\n"
10+
"PO-Revision-Date: 2024-10-29 14:22+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+
#. odoo-python
20+
#: code:addons/fieldservice_equipment_stock_return/models/fsm_order.py:0
21+
#, python-format
22+
msgid ""
23+
"Cannot create a return order because order type does not have a current "
24+
"Picking Type."
25+
msgstr ""
26+
27+
#. module: fieldservice_equipment_stock_return
28+
#. odoo-python
29+
#: code:addons/fieldservice_equipment_stock_return/models/fsm_order.py:0
30+
#, python-format
31+
msgid "Cannot create return order without an equipment."
32+
msgstr ""
33+
34+
#. module: fieldservice_equipment_stock_return
35+
#: model_terms:ir.ui.view,arch_db:fieldservice_equipment_stock_return.fsm_equipment_form_view_stock
36+
msgid "Create Return"
37+
msgstr ""
38+
39+
#. module: fieldservice_equipment_stock_return
40+
#: model:ir.model,name:fieldservice_equipment_stock_return.model_fsm_equipment
41+
msgid "Field Service Equipment"
42+
msgstr ""
43+
44+
#. module: fieldservice_equipment_stock_return
45+
#: model:ir.model,name:fieldservice_equipment_stock_return.model_fsm_order
46+
msgid "Field Service Order"
47+
msgstr ""
48+
49+
#. module: fieldservice_equipment_stock_return
50+
#: model:ir.model,name:fieldservice_equipment_stock_return.model_fsm_order_type
51+
msgid "Field Service Order Type"
52+
msgstr ""
53+
54+
#. module: fieldservice_equipment_stock_return
55+
#. odoo-python
56+
#: code:addons/fieldservice_equipment_stock_return/models/fsm_order.py:0
57+
#, python-format
58+
msgid "Impossible to find the equipment current location."
59+
msgstr ""
60+
61+
#. module: fieldservice_equipment_stock_return
62+
#: model:ir.model.fields,field_description:fieldservice_equipment_stock_return.field_fsm_order_type__internal_type
63+
msgid "Internal Type"
64+
msgstr ""
65+
66+
#. module: fieldservice_equipment_stock_return
67+
#. odoo-python
68+
#: code:addons/fieldservice_equipment_stock_return/models/fsm_equipment.py:0
69+
#, python-format
70+
msgid "No return order type found."
71+
msgstr ""
72+
73+
#. module: fieldservice_equipment_stock_return
74+
#: model:ir.model.fields,field_description:fieldservice_equipment_stock_return.field_fsm_order_type__picking_type_id
75+
msgid "Picking Type"
76+
msgstr ""
77+
78+
#. module: fieldservice_equipment_stock_return
79+
#: model:ir.model.fields.selection,name:fieldservice_equipment_stock_return.selection__fsm_order_type__internal_type__return
80+
msgid "Return"
81+
msgstr ""
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,81 @@
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 14:22+0000\n"
10+
"PO-Revision-Date: 2024-10-29 14:22+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+
#. odoo-python
20+
#: code:addons/fieldservice_equipment_stock_return/models/fsm_order.py:0
21+
#, python-format
22+
msgid ""
23+
"Cannot create a return order because order type does not have a current "
24+
"Picking Type."
25+
msgstr "Impossible de créer une commande de retour car le type choisie n'a pas de Type de Picking définie."
26+
27+
#. module: fieldservice_equipment_stock_return
28+
#. odoo-python
29+
#: code:addons/fieldservice_equipment_stock_return/models/fsm_order.py:0
30+
#, python-format
31+
msgid "Cannot create return order without an equipment."
32+
msgstr "Impossible de créer une commande de retour sans équipement."
33+
34+
#. module: fieldservice_equipment_stock_return
35+
#: model_terms:ir.ui.view,arch_db:fieldservice_equipment_stock_return.fsm_equipment_form_view_stock
36+
msgid "Create Return"
37+
msgstr "Créer un retour"
38+
39+
#. module: fieldservice_equipment_stock_return
40+
#: model:ir.model,name:fieldservice_equipment_stock_return.model_fsm_equipment
41+
msgid "Field Service Equipment"
42+
msgstr ""
43+
44+
#. module: fieldservice_equipment_stock_return
45+
#: model:ir.model,name:fieldservice_equipment_stock_return.model_fsm_order
46+
msgid "Field Service Order"
47+
msgstr ""
48+
49+
#. module: fieldservice_equipment_stock_return
50+
#: model:ir.model,name:fieldservice_equipment_stock_return.model_fsm_order_type
51+
msgid "Field Service Order Type"
52+
msgstr ""
53+
54+
#. module: fieldservice_equipment_stock_return
55+
#. odoo-python
56+
#: code:addons/fieldservice_equipment_stock_return/models/fsm_order.py:0
57+
#, python-format
58+
msgid "Impossible to find the equipment current location."
59+
msgstr "Impossible de trouver l'emplacement actuel de l'équipement."
60+
61+
#. module: fieldservice_equipment_stock_return
62+
#: model:ir.model.fields,field_description:fieldservice_equipment_stock_return.field_fsm_order_type__internal_type
63+
msgid "Internal Type"
64+
msgstr ""
65+
66+
#. module: fieldservice_equipment_stock_return
67+
#. odoo-python
68+
#: code:addons/fieldservice_equipment_stock_return/models/fsm_equipment.py:0
69+
#, python-format
70+
msgid "No return order type found."
71+
msgstr "Aucun type de commande avec un type interne de retour trouvé."
72+
73+
#. module: fieldservice_equipment_stock_return
74+
#: model:ir.model.fields,field_description:fieldservice_equipment_stock_return.field_fsm_order_type__picking_type_id
75+
msgid "Picking Type"
76+
msgstr ""
77+
78+
#. module: fieldservice_equipment_stock_return
79+
#: model:ir.model.fields.selection,name:fieldservice_equipment_stock_return.selection__fsm_order_type__internal_type__return
80+
msgid "Return"
81+
msgstr "Retour"
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)