Skip to main content

Auto-create Purchase Orders when FSOs are assigned to subcontractor workers

Project description

Odoo Community Association

Field Service - Subcontracting

Beta License: AGPL-3 OCA/field-service Translate me on Weblate Try me on Runboat

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

It allows users to:

  1. Mark subcontractor vendors on partners.

  2. Configure a service product on Field Service order templates.

  3. Resolve the Purchase Order vendor from the assigned worker or its parent company.

  4. Create draft Purchase Orders for subcontracted orders.

  5. Set the Purchase Order Expected Arrival from the Field Service Order Scheduled End.

  6. Keep the Purchase Order Expected Arrival synchronized when the Field Service Order planned dates change.

  7. Update delivered quantities from Field Service timesheets.

  8. 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

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 an internal worker, an individual subcontractor, or an employee of a subcontractor company.

  3. The module resolves the Purchase Order vendor from the assigned worker: when the worker partner has a subcontractor parent company, that parent company receives the Purchase Order; otherwise, the worker partner receives it when it is marked as subcontractor.

  4. If neither the worker partner nor its parent company is marked as subcontractor, the worker is treated as internal and no Purchase Order is created.

  5. The company can create a Purchase Order for that external service without manually duplicating information between Field Service and Purchase.

  6. The Purchase Order Expected Arrival is set from the Field Service Order Scheduled End (scheduled_date_end).

  7. When the Field Service Order planned dates change, the linked subcontract Purchase Order Expected Arrival is updated to match the current Scheduled End.

  8. 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.

  9. Timesheet hours logged on the Field Service Order can be pushed to the Purchase Order line as delivered quantity.

  10. Vendor bills based on received quantities can then be created with the correct quantity.

  11. Worker reassignment is available for orders with at least one linked subcontract Purchase Order, even if all linked subcontract Purchase Orders are cancelled.

  12. Worker reassignment is only available before the Field Service Order reaches a closed stage.

Configuration

Subcontractor partner setup

  1. Go to Contacts.

  2. Open the partner linked to the Field Service worker, or the parent company of that partner.

  3. Configure as a vendor the partner that should receive the subcontract Purchase Order.

  4. Enable Is Subcontractor? on the relevant partner.

  5. The subcontract vendor is resolved with the following priority:

    • If the worker partner has a parent company and that parent company is marked as Is Subcontractor?, the Purchase Order is created for the parent company.

    • If the previous rule does not apply and the worker partner is marked as Is Subcontractor?, the Purchase Order is created directly for the worker partner, such as an individual freelancer.

    • If neither rule applies, no Purchase Order is created because the worker is considered internal.

  6. Configure vendor prices on the subcontracting service product for the partner that will receive the Purchase Order.

Subcontractor checkbox on the contact 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 resolved 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

Usage

Create the subcontract Purchase Order

  1. Create or open a Field Service Order that uses a template configured for subcontracting.

  2. Assign a worker.

  3. Move the order to the stage configured to create the subcontract Purchase Order.

Field Service Order buttons for subcontracting

  1. The module resolves the vendor before creating the Purchase Order.

  2. If the worker related partner has a parent company marked as subcontractor, the parent company is used as the vendor.

  3. Otherwise, if the worker related partner is marked as subcontractor, that partner is used as the vendor.

  4. If neither condition applies, the worker is considered internal and no Purchase Order is created. The Field Service Order chatter records that no Purchase Order was created for an internal worker.

  5. Use the Purchase Order smart button to open the generated draft Purchase Order.

  6. Review the Purchase Order. Its Expected Arrival is set from the Field Service Order Scheduled End (scheduled_date_end).

  7. 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.

Bug Tracker

Bugs are tracked on GitHub 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.

Do not contact contributors directly about support or help with technical issues.

Credits

Authors

  • Binhex

Contributors

Maintainers

This module is maintained by the OCA.

Odoo Community Association

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.

Current maintainer:

edescalona

This module is part of the OCA/field-service project on GitHub.

You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distributions

No source distribution files available for this release.See tutorial on generating distribution archives.

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

File details

Details for the file odoo_addon_fieldservice_subcontracting-18.0.1.0.0.3-py3-none-any.whl.

File metadata

File hashes

Hashes for odoo_addon_fieldservice_subcontracting-18.0.1.0.0.3-py3-none-any.whl
Algorithm Hash digest
SHA256 41584967d2089e0a0c4f719c96f53f31faa0a562534e9272e7bac6d99df43277
MD5 3a87c1b6a57ee47df196f7532795c88d
BLAKE2b-256 8a77ca1ee57aeaafc494b7a8ffe9c52059bd355edea1399d0c78d749eac31dd0

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page