Skip to content

Commit d9888e3

Browse files
committed
[15.0][ADD] fieldservice_sale_stock_product_tags: New module fieldservice_sale_stock_product_tags
1 parent c3b6d97 commit d9888e3

File tree

17 files changed

+882
-0
lines changed

17 files changed

+882
-0
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,103 @@
1+
=======================================
2+
Field Service - Sale Stock Product Tags
3+
=======================================
4+
5+
..
6+
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
7+
!! This file is generated by oca-gen-addon-readme !!
8+
!! changes will be overwritten. !!
9+
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
10+
!! source digest: sha256:daaa7c594ceadfc80161e693db3f2dfc9abaa08d866be5266f59d829096580d4
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/15.0/fieldservice_sale_stock_product_tags
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-15-0/field-service-15-0-fieldservice_sale_stock_product_tags
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=15.0
27+
:alt: Try me on Runboat
28+
29+
|badge1| |badge2| |badge3| |badge4| |badge5|
30+
31+
This module extends Field Service (FSM) functionality by automatically assigning FSM tags to orders based on product template tags.
32+
33+
**Features:**
34+
- Automatically assigns FSM tags to open FSM orders based on products in linked stock moves.
35+
- Ensures missing FSM tags are created dynamically.
36+
- Supports manual tag assignment without being overwritten.
37+
38+
**Table of contents**
39+
40+
.. contents::
41+
:local:
42+
43+
Usage
44+
=====
45+
46+
To use this module, you need to:
47+
48+
1. Navigate to **Field Service > Master Data > Products**.
49+
2. Select a product or create a new one.
50+
3. In the **General Information** tab, add a tag in the **Tags** field.
51+
4. Navigate to **Sales**.
52+
5. Create a new sale, add the product, and confirm it.
53+
6. The linked FSM order will have the tag assigned automatically.
54+
7. If no FSM tag matches the product tag, a new one will be created with the same name and color.
55+
56+
Bug Tracker
57+
===========
58+
59+
Bugs are tracked on `GitHub Issues <https://github.com/OCA/field-service/issues>`_.
60+
In case of trouble, please check there if your issue has already been reported.
61+
If you spotted it first, help us to smash it by providing a detailed and welcomed
62+
`feedback <https://github.com/OCA/field-service/issues/new?body=module:%20fieldservice_sale_stock_product_tags%0Aversion:%2015.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**>`_.
63+
64+
Do not contact contributors directly about support or help with technical issues.
65+
66+
Credits
67+
=======
68+
69+
Authors
70+
~~~~~~~
71+
72+
* APSL-Nagarro
73+
74+
Contributors
75+
~~~~~~~~~~~~
76+
77+
* `APSL-Nagarro <https://www.apsl.tech>`_:
78+
* Patryk Pyczko <ppyczko@apsl.net>
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-ppyczko| image:: https://github.com/ppyczko.png?size=40px
94+
:target: https://github.com/ppyczko
95+
:alt: ppyczko
96+
97+
Current `maintainer <https://odoo-community.org/page/maintainer-role>`__:
98+
99+
|maintainer-ppyczko|
100+
101+
This module is part of the `OCA/field-service <https://github.com/OCA/field-service/tree/15.0/fieldservice_sale_stock_product_tags>`_ project on GitHub.
102+
103+
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,3 @@
1+
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl).
2+
3+
from . import models
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
# Copyright 2025 Patryk Pyczko (APSL-Nagarro)<ppyczko@apsl.net>
2+
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl).
3+
4+
{
5+
"name": "Field Service - Sale Stock Product Tags",
6+
"version": "15.0.1.0.0",
7+
"summary": "Automatically assigns FSM tags to FSM orders based on product template tags.",
8+
"category": "Field Service",
9+
"website": "https://github.com/OCA/field-service",
10+
"author": "APSL-Nagarro, Odoo Community Association (OCA)",
11+
"maintainers": ["ppyczko"],
12+
"license": "AGPL-3",
13+
"application": False,
14+
"installable": True,
15+
"depends": ["fieldservice_sale_stock", "product_template_tags"],
16+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
# Translation of Odoo Server.
2+
# This file contains the translation of the following modules:
3+
# * fieldservice_sale_stock_product_tags
4+
#
5+
msgid ""
6+
msgstr ""
7+
"Project-Id-Version: Odoo Server 15.0\n"
8+
"Report-Msgid-Bugs-To: \n"
9+
"POT-Creation-Date: 2025-03-18 11:27+0000\n"
10+
"PO-Revision-Date: 2025-03-18 11:27+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_sale_stock_product_tags
19+
#: model:ir.model.fields,help:fieldservice_sale_stock_product_tags.field_fsm_order__tag_ids
20+
msgid "Classify and analyze your orders"
21+
msgstr "Classifica i analitza les teves comandes"
22+
23+
#. module: fieldservice_sale_stock_product_tags
24+
#: model:ir.model,name:fieldservice_sale_stock_product_tags.model_fsm_order
25+
msgid "Field Service Order"
26+
msgstr "Ordre de Servei de Camp"
27+
28+
#. module: fieldservice_sale_stock_product_tags
29+
#: model:ir.model.fields,field_description:fieldservice_sale_stock_product_tags.field_fsm_order__tag_ids
30+
msgid "Tags"
31+
msgstr "Etiquetes"
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
# Translation of Odoo Server.
2+
# This file contains the translation of the following modules:
3+
# * fieldservice_sale_stock_product_tags
4+
#
5+
msgid ""
6+
msgstr ""
7+
"Project-Id-Version: Odoo Server 15.0\n"
8+
"Report-Msgid-Bugs-To: \n"
9+
"POT-Creation-Date: 2025-03-18 11:27+0000\n"
10+
"PO-Revision-Date: 2025-03-18 11:27+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_sale_stock_product_tags
19+
#: model:ir.model.fields,help:fieldservice_sale_stock_product_tags.field_fsm_order__tag_ids
20+
msgid "Classify and analyze your orders"
21+
msgstr "Clasifica y analiza tus pedidos"
22+
23+
#. module: fieldservice_sale_stock_product_tags
24+
#: model:ir.model,name:fieldservice_sale_stock_product_tags.model_fsm_order
25+
msgid "Field Service Order"
26+
msgstr "Orden de Servicio de Campo"
27+
28+
#. module: fieldservice_sale_stock_product_tags
29+
#: model:ir.model.fields,field_description:fieldservice_sale_stock_product_tags.field_fsm_order__tag_ids
30+
msgid "Tags"
31+
msgstr "Etiquetas"
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
# Translation of Odoo Server.
2+
# This file contains the translation of the following modules:
3+
# * fieldservice_sale_stock_product_tags
4+
#
5+
msgid ""
6+
msgstr ""
7+
"Project-Id-Version: Odoo Server 15.0\n"
8+
"Report-Msgid-Bugs-To: \n"
9+
"POT-Creation-Date: 2025-03-18 11:25+0000\n"
10+
"PO-Revision-Date: 2025-03-18 11:25+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_sale_stock_product_tags
19+
#: model:ir.model.fields,help:fieldservice_sale_stock_product_tags.field_fsm_order__tag_ids
20+
msgid "Classify and analyze your orders"
21+
msgstr ""
22+
23+
#. module: fieldservice_sale_stock_product_tags
24+
#: model:ir.model,name:fieldservice_sale_stock_product_tags.model_fsm_order
25+
msgid "Field Service Order"
26+
msgstr ""
27+
28+
#. module: fieldservice_sale_stock_product_tags
29+
#: model:ir.model.fields,field_description:fieldservice_sale_stock_product_tags.field_fsm_order__tag_ids
30+
msgid "Tags"
31+
msgstr ""
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl).
2+
3+
from . import fsm_order
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
# Copyright 2025 Patryk Pyczko (APSL-Nagarro)<ppyczko@apsl.net>
2+
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl).
3+
4+
from odoo import api, fields, models
5+
6+
7+
class FSMOrder(models.Model):
8+
_inherit = "fsm.order"
9+
10+
tag_ids = fields.Many2many(
11+
"fsm.tag",
12+
"fsm_order_tag_rel",
13+
"fsm_order_id",
14+
"tag_id",
15+
string="Tags",
16+
compute="_compute_fsm_tags",
17+
inverse="_inverse_fsm_tags",
18+
store=True,
19+
help="Classify and analyze your orders",
20+
)
21+
22+
@api.depends("move_ids.product_id.tag_ids")
23+
def _compute_fsm_tags(self):
24+
FSMTag = self.env["fsm.tag"]
25+
for order in self:
26+
if order.stage_id.is_closed:
27+
continue
28+
29+
product_tags = order.move_ids.mapped("product_id.tag_ids")
30+
31+
auto_tags = FSMTag.search([("name", "in", product_tags.mapped("name"))])
32+
missing_tags = product_tags.filtered(
33+
lambda tag: tag.name not in auto_tags.mapped("name")
34+
)
35+
36+
auto_tags |= FSMTag.create(
37+
[{"name": tag.name, "color": tag.color or 10} for tag in missing_tags]
38+
)
39+
40+
order.tag_ids |= auto_tags
41+
42+
def _inverse_fsm_tags(self):
43+
pass
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
* `APSL-Nagarro <https://www.apsl.tech>`_:
2+
* Patryk Pyczko <ppyczko@apsl.net>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
This module extends Field Service (FSM) functionality by automatically assigning FSM tags to orders based on product template tags.
2+
3+
**Features:**
4+
- Automatically assigns FSM tags to open FSM orders based on products in linked stock moves.
5+
- Ensures missing FSM tags are created dynamically.
6+
- Supports manual tag assignment without being overwritten.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
To use this module, you need to:
2+
3+
1. Navigate to **Field Service > Master Data > Products**.
4+
2. Select a product or create a new one.
5+
3. In the **General Information** tab, add a tag in the **Tags** field.
6+
4. Navigate to **Sales**.
7+
5. Create a new sale, add the product, and confirm it.
8+
6. The linked FSM order will have the tag assigned automatically.
9+
7. If no FSM tag matches the product tag, a new one will be created with the same name and color.
Loading

0 commit comments

Comments
 (0)