Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
38 commits
Select commit Hold shift + click to select a range
2054fdf
[ADD] add fleet_vehicle_stock
marcelsavegnago Apr 3, 2021
76a0867
[UPD] README.rst
OCA-git-bot Apr 13, 2021
dfe955e
[UPD] Update fleet_vehicle_stock.pot
oca-travis Apr 13, 2021
d47b9dd
Added translation using Weblate (Portuguese (Brazil))
marcelsavegnago Apr 27, 2021
ad5bcb9
Translated using Weblate (Portuguese (Brazil))
marcelsavegnago Apr 27, 2021
f3e2c83
[IMP] fleet_vehicle_stock: black, isort, prettier
marcelsavegnago Jan 27, 2022
881c925
[MIG] fleet_vehicle_stock: Migration to 13.0
marcelsavegnago Jan 27, 2022
853f961
[RFC] fleet_vehicle_stock: test refactor
marcelsavegnago Aug 17, 2022
a75b97c
[UPD] Update fleet_vehicle_stock.pot
oca-travis Aug 18, 2022
ecf3346
[UPD] README.rst
OCA-git-bot Aug 18, 2022
3af181d
[IMP] fleet_vehicle_stock: black, isort, prettier
marcelsavegnago Aug 18, 2022
c0f77bf
[MIG] fleet_vehicle_stock: Migration to 14.0
marcelsavegnago Aug 18, 2022
c50ddd0
[UPD] Update fleet_vehicle_stock.pot
oca-travis Aug 30, 2022
094024b
[UPD] README.rst
OCA-git-bot Aug 30, 2022
b8e7e11
[MIG] fleet_vehicle_stock: Migration to 15.0
rodrigonevest Mar 29, 2023
cae670c
[UPD] Update fleet_vehicle_stock.pot
Apr 4, 2023
2bfef6d
[UPD] README.rst
OCA-git-bot Apr 4, 2023
a685bf0
Update translation files
weblate Apr 5, 2023
6adfcb6
[MIG] fleet_vehicle_stock: Migration to 16.0
kaynnan Apr 6, 2023
0680101
[IMP] fleet_vehicle_stock: add tests
kaynnan Apr 6, 2023
3b7be48
[IMP] fleet_vehicle_stock: add contributing name
kaynnan Apr 6, 2023
a3db73b
[UPD] Update fleet_vehicle_stock.pot
Apr 6, 2023
f0806be
[UPD] README.rst
OCA-git-bot Apr 6, 2023
52b0337
Update translation files
weblate Apr 6, 2023
b2b4db8
Added translation using Weblate (Italian)
mymage Apr 17, 2023
c42d250
Translated using Weblate (Italian)
mymage Apr 17, 2023
2a0abcf
Translated using Weblate (Italian)
mymage Apr 18, 2023
438e53e
Translated using Weblate (Italian)
francesco-ooops Jul 17, 2023
6a93911
Added translation using Weblate (Spanish)
Ivorra78 Aug 3, 2023
a9a6a8f
Translated using Weblate (Spanish)
Ivorra78 Aug 3, 2023
e016ee1
[UPD] README.rst
OCA-git-bot Sep 3, 2023
9011ce1
Update translation files
weblate Oct 9, 2023
4f032ec
Translated using Weblate (Italian)
mymage Nov 2, 2023
f2a9b24
Translated using Weblate (Portuguese (Brazil))
May 17, 2024
fd1aa0a
Translated using Weblate (Italian)
mymage Aug 22, 2024
6e7efdf
Added translation using Weblate (Dutch)
bosd Sep 8, 2025
4fbc40a
[IMP] fleet_vehicle_stock: pre-commit stuff
JulioFabio Nov 24, 2025
54b2901
[MIG] fleet_vehicle_stock: Migration to 18.0
JulioFabio Nov 25, 2025
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
79 changes: 79 additions & 0 deletions fleet_vehicle_purchase/tests/test_purchase.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,79 @@
# Copyright 2023 Dixmit
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl).

from odoo import fields
from odoo.tests import Form
from odoo.tests.common import TransactionCase


class TestPurchase(TransactionCase):
@classmethod
def setUpClass(cls):
super().setUpClass()
cls.brand = cls.env["fleet.vehicle.model.brand"].create(
{
"name": "Audi",
}
)
cls.model = cls.env["fleet.vehicle.model"].create(
{
"brand_id": cls.brand.id,
"name": "A3",
}
)
cls.car_1 = cls.env["fleet.vehicle"].create(
{
"model_id": cls.model.id,
"driver_id": cls.env.user.partner_id.id,
"plan_to_change_car": False,
}
)
cls.product = cls.env["product.product"].create(
{
"name": "product",
"type": "service",
}
)

def test_purchase(self):
self.assertEqual(0, self.car_1.purchase_order_count)
order_action = self.car_1.action_view_purchase_orders()
self.assertFalse(
self.env[order_action["res_model"]].search(order_action["domain"])
)
with Form(self.env["purchase.order"]) as form:
form.partner_id = self.env.user.partner_id
form.fleet_vehicle_id = self.car_1
with form.order_line.new() as form_line:
form_line.product_id = self.product
form_line.price_unit = 100
self.assertEqual(1, self.car_1.purchase_order_count)
purchase = form.save()
self.assertEqual(
purchase, self.env[order_action["res_model"]].search(order_action["domain"])
)
purchase.button_confirm()
purchase.order_line.qty_received = 1
invoice_action = purchase.action_create_invoice()
invoice = self.env[invoice_action["res_model"]].browse(invoice_action["res_id"])
invoice.invoice_date = fields.Date.today()
self.assertTrue(invoice.invoice_line_ids.vehicle_id)
self.assertFalse(self.car_1.log_services)
invoice.action_post()
self.assertTrue(self.car_1.log_services)

def test_purchase_no_vehicle(self):
"""Test purchase order flow without a fleet vehicle."""
with Form(self.env["purchase.order"]) as form:
form.partner_id = self.env.user.partner_id
with form.order_line.new() as form_line:
form_line.product_id = self.product
form_line.price_unit = 100

purchase = form.save()
purchase.button_confirm()
purchase.order_line.qty_received = 1
invoice_action = purchase.action_create_invoice()
invoice = self.env[invoice_action["res_model"]].browse(invoice_action["res_id"])

self.assertFalse(invoice.invoice_line_ids.vehicle_id)
124 changes: 124 additions & 0 deletions fleet_vehicle_stock/README.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,124 @@
===================
Fleet Vehicle Stock
===================

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

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

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

This module is an add-on for the Fleet application in Odoo. It allows
you to track your Fleet Vehicles in stock moves.

**Table of contents**

.. contents::
:local:

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

Products can be automatically converted into Fleet Vehicle. This is only
available only for products tracked by serial number. This needs to be
enabled both on Operation Types and Products. For example, we may want
to create the Fleet Vehicle on Delivery, or on Receipts.

To enable on Products:

- Go to Inventory > Master Data > Products
- Open the Product form, Inventory tab
- On the "Traceability" section, make sure "Tracking" is set to "By
Unique Serial Number"
- Enable the "Creates Fleet Vehicle" checkbox
- Open Fleet tab
- Select Fleet Vehicle Model

To enable on Operation Types:

- Go to Inventory > Configuration > Operation Types
- Select the intended Operation Type ("Receipts" for example)
- On the "Traceability" section, enable the "Create Fleet Vehicle"
checkbox

Usage
=====

A completed stock move for a properly configured Product on a configured
stock Operation Type will automatically create a fleet vehicle.

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

Bugs are tracked on `GitHub Issues <https://github.com/OCA/fleet/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/fleet/issues/new?body=module:%20fleet_vehicle_stock%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
-------

* Escodoo

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

- Marcel Savegnago <marcel.savegnago@escodoo.com.br>
- Kaynnan Lemes <kaynnan.lemes@escodoo.com.br>

Other credits
-------------

The development of this module has been financially supported by:

- Escodoo - https://www.escodoo.com.br

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

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

|maintainer-marcelsavegnago|

This module is part of the `OCA/fleet <https://github.com/OCA/fleet/tree/18.0/fleet_vehicle_stock>`_ project on GitHub.

You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute.
1 change: 1 addition & 0 deletions fleet_vehicle_stock/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
from . import models
26 changes: 26 additions & 0 deletions fleet_vehicle_stock/__manifest__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
# Copyright 2021 - TODAY, Escodoo
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).


{
"name": "Fleet Vehicle Stock",
"summary": """
This module is an add-on for the Fleet application in Odoo. It allows
you to track your Fleet Vehicles in stock moves.""",
"version": "18.0.1.0.0",
"license": "AGPL-3",
"author": "Escodoo,Odoo Community Association (OCA)",
"website": "https://github.com/OCA/fleet",
"category": "Human Resources/Fleet",
"maintainers": ["marcelsavegnago"],
"depends": ["stock", "fleet"],
"data": [
"views/stock_production_lot.xml",
"views/stock_picking_type.xml",
"views/product_template.xml",
"views/product_product.xml",
"views/fleet_vehicle.xml",
"views/fleet_vehicle_model.xml",
],
"demo": [],
}
131 changes: 131 additions & 0 deletions fleet_vehicle_stock/i18n/es.po
Original file line number Diff line number Diff line change
@@ -0,0 +1,131 @@
# Translation of Odoo Server.
# This file contains the translation of the following modules:
# * fleet_vehicle_stock
#
msgid ""
msgstr ""
"Project-Id-Version: Odoo Server 16.0\n"
"Report-Msgid-Bugs-To: \n"
"PO-Revision-Date: 2023-08-03 21:10+0000\n"
"Last-Translator: Ivorra78 <informatica@totmaterial.es>\n"
"Language-Team: none\n"
"Language: es\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: \n"
"Plural-Forms: nplurals=2; plural=n != 1;\n"
"X-Generator: Weblate 4.17\n"

#. module: fleet_vehicle_stock
#: model:ir.model.fields,field_description:fleet_vehicle_stock.field_stock_picking_type__create_fleet_vehicle
msgid "Create Fleet Vehicle"
msgstr "Crear flota de vehículos"

#. module: fleet_vehicle_stock
#: model:ir.model.fields,field_description:fleet_vehicle_stock.field_product_product__create_fleet_vehicle
#: model:ir.model.fields,field_description:fleet_vehicle_stock.field_product_template__create_fleet_vehicle
msgid "Creates a Fleet Vehicle"
msgstr "Crear una flota de vehículos"

#. module: fleet_vehicle_stock
#: model:ir.model.fields,field_description:fleet_vehicle_stock.field_fleet_vehicle__current_stock_location_id
msgid "Current Inventory Location"
msgstr "Ubicación actual del inventario"

#. module: fleet_vehicle_stock
#: model:ir.model.fields,field_description:fleet_vehicle_stock.field_fleet_vehicle_model__product_id
msgid "Default Product"
msgstr "Producto por defecto"

#. module: fleet_vehicle_stock
#: model_terms:ir.ui.view,arch_db:fleet_vehicle_stock.product_template_form_view
#: model_terms:ir.ui.view,arch_db:fleet_vehicle_stock.product_variant_easy_edit_view
msgid "Fleet"
msgstr "Flota"

#. module: fleet_vehicle_stock
#: model:ir.model.fields,field_description:fleet_vehicle_stock.field_stock_lot__fleet_vehicle_id
msgid "Fleet Vehicle"
msgstr "Vehículo de Flota"

#. module: fleet_vehicle_stock
#: model_terms:ir.ui.view,arch_db:fleet_vehicle_stock.fleet_vehicle_form_view
#: model_terms:ir.ui.view,arch_db:fleet_vehicle_stock.fleet_vehicle_model_form_view
msgid "Inventory"
msgstr "Inventario"

#. module: fleet_vehicle_stock
#: model:ir.model.constraint,message:fleet_vehicle_stock.constraint_product_template_non_product_tracking_for_vehicle_model
msgid ""
"It is mandatory to configure the traceability by serial number in order to "
"be able to configure the vehicle model of the fleet in this product."
msgstr ""
"Es obligatorio configurar la trazabilidad por número de serie para poder "
"configurar el modelo de vehículo de la flota en este producto."

#. module: fleet_vehicle_stock
#: model:ir.model,name:fleet_vehicle_stock.model_stock_lot
msgid "Lot/Serial"
msgstr "Lote/Serie"

#. module: fleet_vehicle_stock
#: model:ir.model,name:fleet_vehicle_stock.model_fleet_vehicle_model
msgid "Model of a vehicle"
msgstr "Modelo de vehículo"

#. module: fleet_vehicle_stock
#: model:ir.model,name:fleet_vehicle_stock.model_stock_picking_type
msgid "Picking Type"
msgstr "Tipo de recogida"

#. module: fleet_vehicle_stock
#: model:ir.model,name:fleet_vehicle_stock.model_product_template
#: model:ir.model.fields,field_description:fleet_vehicle_stock.field_fleet_vehicle__product_id
msgid "Product"
msgstr "Producto"

#. module: fleet_vehicle_stock
#: model:ir.model,name:fleet_vehicle_stock.model_product_product
msgid "Product Variant"
msgstr "Variante de Producto"

#. module: fleet_vehicle_stock
#: model:ir.model.fields,help:fleet_vehicle_stock.field_stock_picking_type__create_fleet_vehicle
msgid ""
"Products with the \"Creates a Fleet Vehicle\" flagwill automatically be "
"converted to an Fleet Vehicle."
msgstr ""
"Los productos con la bandera \"Crea un Vehículo de Flota\" se convertirán "
"automáticamente en un Vehículo de Flota."

#. module: fleet_vehicle_stock
#: model:ir.model.fields,field_description:fleet_vehicle_stock.field_fleet_vehicle__lot_id
msgid "Serial #"
msgstr "Número de serie #"

#. module: fleet_vehicle_stock
#: model:ir.model,name:fleet_vehicle_stock.model_stock_move
msgid "Stock Move"
msgstr "Movimiento de existencias"

#. module: fleet_vehicle_stock
#. odoo-python
#: code:addons/fleet_vehicle_stock/models/stock_move.py:0
#, python-format
msgid ""
"The product '%s' is configure to create a fleet vehicle but vehicle model is "
"not configured in the product."
msgstr ""
"El producto '%s' está configurado para crear un vehículo de flota pero el "
"modelo de vehículo no está configurado en el producto."

#. module: fleet_vehicle_stock
#: model:ir.model,name:fleet_vehicle_stock.model_fleet_vehicle
msgid "Vehicle"
msgstr "Vehículo"

#. module: fleet_vehicle_stock
#: model:ir.model.fields,field_description:fleet_vehicle_stock.field_product_product__fleet_vehicle_model_id
#: model:ir.model.fields,field_description:fleet_vehicle_stock.field_product_template__fleet_vehicle_model_id
msgid "Vehicle Model"
msgstr "Modelo del vehículo"
Loading