Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
259 changes: 259 additions & 0 deletions fieldservice_subcontracting/README.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,259 @@
==============================
Field Service - Subcontracting
==============================

..
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!! This file is generated by oca-gen-addon-readme !!
!! changes will be overwritten. !!
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!! source digest: sha256:41b5c72d6fa5b02d85ebaad0832f8fa7d1c9c22aa7709b4d38c602797304345b
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!

.. |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%2Ffield--service-lightgray.png?logo=github
:target: https://github.com/OCA/field-service/tree/18.0/fieldservice_subcontracting
:alt: OCA/field-service
.. |badge4| image:: https://img.shields.io/badge/weblate-Translate%20me-F47D42.png
:target: https://translation.odoo-community.org/projects/field-service-18-0/field-service-18-0-fieldservice_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/field-service&target_branch=18.0
:alt: Try me on Runboat

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

This module integrates Field Service with Purchasing to automate the
subcontracting workflow.

It allows users to:

1. Mark Field Service workers as subcontractors.
2. Configure a service product on Field Service order templates.
3. Create draft Purchase Orders for subcontracted orders.
4. Set the Purchase Order Expected Arrival from the Field Service Order
Scheduled End.
5. Keep the Purchase Order Expected Arrival synchronized when the Field
Service Order planned dates change.
6. Update delivered quantities from Field Service timesheets.
7. Reassign workers on orders with linked subcontract Purchase Orders.

The module uses ``fieldservice_stage_server_action`` to trigger
automation on stage transitions.

**Table of contents**

.. contents::
:local:

Use Cases / Context
===================

1. Field Service operations sometimes require external workers or
companies to perform part of the service delivery.
2. A Field Service Order can be assigned to a subcontractor worker.
3. The company can create a Purchase Order for that external service
without manually duplicating information between Field Service and
Purchase.
4. The Purchase Order Expected Arrival is set from the Field Service
Order Scheduled End (``scheduled_date_end``).
5. When the Field Service Order planned dates change, the linked
subcontract Purchase Order Expected Arrival is updated to match the
current Scheduled End.
6. The Purchase Order remains under the standard Odoo purchase flow: it
is created as a draft, reviewed and confirmed manually, and later
billed by the vendor.
7. Timesheet hours logged on the Field Service Order can be pushed to
the Purchase Order line as delivered quantity.
8. Vendor bills based on received quantities can then be created with
the correct quantity.
9. Worker reassignment is available for orders with at least one linked
subcontract Purchase Order, even if all linked subcontract Purchase
Orders are cancelled.
10. Worker reassignment is only available before the Field Service Order
reaches a closed stage.

Configuration
=============

Worker setup
------------

1. Go to Field Service > Master Data > Workers.
2. Open the worker that represents the external vendor.
3. Make sure the related partner is configured as a vendor.
4. Enable Is Subcontractor on the worker.

|Subcontractor checkbox on the worker form|

Template setup
--------------

1. Go to Field Service > Master Data > Templates.
2. Open the template that can create subcontract Purchase Orders.
3. Set the Subcontracting Service Product.
4. Use a service product that is purchased based on received quantities.
5. Configure a vendor price on the product for each subcontractor
partner that can receive a Purchase Order.
6. If vendor bills are controlled by received quantities, update the
delivered quantity before creating the vendor bill.

|Subcontracting product on the Field Service template|

Stage automation
----------------

1. Go to Field Service > Configuration > Stages.
2. Open the stage that should create the draft Purchase Order.
3. Assign the server action FSO: Create Subcontract PO.

|Server action to create the subcontract Purchase Order|

1. Open the closing stage that should update delivered quantities.
2. Assign the server action FSO: Update Subcontract PO Delivered Qty.
3. This action copies timesheet hours to the Purchase Order delivered
quantity.

|Server action to update subcontract delivered quantity|

.. |Subcontractor checkbox on the worker form| image:: https://raw.githubusercontent.com/OCA/field-service/18.0/fieldservice_subcontracting/static/readme/worker_subcontractor.png
.. |Subcontracting product on the Field Service template| image:: https://raw.githubusercontent.com/OCA/field-service/18.0/fieldservice_subcontracting/static/readme/template_subcontract_product.png
.. |Server action to create the subcontract Purchase Order| image:: https://raw.githubusercontent.com/OCA/field-service/18.0/fieldservice_subcontracting/static/readme/stage_create_subcontract_po_action.png
.. |Server action to update subcontract delivered quantity| image:: https://raw.githubusercontent.com/OCA/field-service/18.0/fieldservice_subcontracting/static/readme/stage_update_subcontract_po_qty_action.png

Usage
=====

Create the subcontract Purchase Order
-------------------------------------

1. Create or open a Field Service Order that uses a template configured
for subcontracting.
2. Assign a subcontractor worker.
3. Move the order to the stage configured to create the subcontract
Purchase Order.

|Field Service Order buttons for subcontracting|

1. Use the Purchase Order smart button to open the generated draft
Purchase Order.
2. Review the Purchase Order. Its Expected Arrival is set from the Field
Service Order Scheduled End (``scheduled_date_end``).
3. Confirm the Purchase Order manually.

|Field Service Order smart button on the Purchase Order|

1. If the Purchase Order is not created, check the Field Service Order
chatter.
2. Review the reason posted by the module.
3. Fix the missing configuration or worker data.
4. Move the order through the configured stage again if needed.

Update the Purchase Order Expected Arrival
------------------------------------------

1. Change the Field Service Order planned dates.
2. Save the Field Service Order.
3. The active subcontract Purchase Order Expected Arrival is updated
with the current Field Service Order Scheduled End
(``scheduled_date_end``).
4. The generated Purchase Order line expected date is updated as well,
so the Purchase Order header keeps the same Expected Arrival.

Update delivered quantities
---------------------------

1. Log timesheet hours on the Field Service Order.
2. Move the Field Service Order to the stage configured to update
subcontract delivered quantities.
3. The module updates the delivered quantity on the subcontract Purchase
Order line with the total timesheet hours of the Field Service Order.
4. The ordered quantity remains unchanged after the Purchase Order is
created.
5. Create the vendor bill after the delivered quantity has been updated
when the product bills based on received quantities.

Reassign or cancel an order
---------------------------

1. Use the Reassign Worker button when an order with at least one
subcontract Purchase Order must be reassigned.
2. The Reassign Worker button remains available even if all linked
subcontract Purchase Orders are cancelled.
3. The Reassign Worker button is only available while the Field Service
Order is not in a closed stage.
4. If the Field Service Order is already in a closed stage, move it to
a non-closed stage before reassigning the worker, if the business
process allows it.
5. Select the new worker in the reassignment wizard.
6. Confirm the wizard.
7. The wizard cancels draft vendor bills linked to active subcontract
Purchase Orders before cancelling those Purchase Orders.
8. The wizard cancels active subcontract Purchase Orders.
9. If the new worker is also a subcontractor, the module creates a new
Purchase Order for that subcontractor.
10. To cancel a Field Service Order with active subcontract Purchase
Orders, use the standard cancel action.
11. Choose whether to cancel only the Field Service Order or also its
active subcontract Purchase Orders.
12. If there are posted vendor bills, manage the Purchase Orders and
vendor bills manually before reassigning or cancelling the Field
Service Order.

.. |Field Service Order buttons for subcontracting| image:: https://raw.githubusercontent.com/OCA/field-service/18.0/fieldservice_subcontracting/static/readme/fso_purchase_order_buttons.png
.. |Field Service Order smart button on the Purchase Order| image:: https://raw.githubusercontent.com/OCA/field-service/18.0/fieldservice_subcontracting/static/readme/purchase_order_fso_button.png

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

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

* Binhex

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

- `Binhex <https://www.binhex.cloud>`__:

- Edilio Escalona Almira e.escalona@binhex.cloud

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-edescalona| image:: https://github.com/edescalona.png?size=40px
:target: https://github.com/edescalona
:alt: edescalona

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

|maintainer-edescalona|

This module is part of the `OCA/field-service <https://github.com/OCA/field-service/tree/18.0/fieldservice_subcontracting>`_ project on GitHub.

You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute.
2 changes: 2 additions & 0 deletions fieldservice_subcontracting/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
from . import models
from . import wizards
32 changes: 32 additions & 0 deletions fieldservice_subcontracting/__manifest__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
# Copyright 2026 Binhex
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl).
{
"name": "Field Service - Subcontracting",
"version": "18.0.1.0.0",
"category": "Field Service",
"license": "AGPL-3",
"summary": "Auto-create Purchase Orders when FSOs are assigned to "
"subcontractor workers",
"author": "Binhex, Odoo Community Association (OCA)",
"website": "https://github.com/OCA/field-service",
"depends": [
"fieldservice",
"fieldservice_project",
"fieldservice_timesheet",
"fieldservice_stage_server_action",
"purchase",
],
"data": [
"security/ir.model.access.csv",
"data/server_action_data.xml",
"wizards/fsm_order_cancel_confirm_views.xml",
"wizards/fsm_order_reassign_confirm_views.xml",
"views/fsm_person_views.xml",
"views/fsm_template_views.xml",
"views/fsm_order_views.xml",
"views/purchase_order_views.xml",
],
"installable": True,
"development_status": "Beta",
"maintainers": ["edescalona"],
}
20 changes: 20 additions & 0 deletions fieldservice_subcontracting/data/server_action_data.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
<?xml version="1.0" encoding="utf-8" ?>
<!-- Copyright 2026 Binhex
License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl). -->
<odoo>
<!-- Create Subcontract PO on stage transition -->
<record id="action_create_subcontract_po" model="ir.actions.server">
<field name="name">FSO: Create Subcontract PO</field>
<field name="model_id" ref="fieldservice.model_fsm_order" />
<field name="state">code</field>
<field name="code">(record or records)._create_subcontract_po()</field>
</record>

<!-- Update PO delivered qty on FSO Done -->
<record id="action_update_subcontract_po_qty" model="ir.actions.server">
<field name="name">FSO: Update Subcontract PO Delivered Qty</field>
<field name="model_id" ref="fieldservice.model_fsm_order" />
<field name="state">code</field>
<field name="code">(record or records)._update_subcontract_po_qty()</field>
</record>
</odoo>
Loading
Loading