Skip to content

Commit

Permalink
[MIG] fleet_vehicle_history_date_end: Migration to 18.0
Browse files Browse the repository at this point in the history
  • Loading branch information
HeliconiaSolutions committed Dec 31, 2024
1 parent 7395e3f commit 8f36fd1
Show file tree
Hide file tree
Showing 5 changed files with 20 additions and 13 deletions.
2 changes: 2 additions & 0 deletions fleet_vehicle_history_date_end/README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,8 @@ Contributors

- Marcel Savegnago <marcel.savegnago@escodoo.com.br>

- `Heliconia Solutions Pvt. Ltd. <https://www.heliconia.io>`__

Maintainers
-----------

Expand Down
2 changes: 1 addition & 1 deletion fleet_vehicle_history_date_end/__manifest__.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
"development_status": "Production/Stable",
"website": "https://github.com/OCA/fleet",
"license": "AGPL-3",
"version": "16.0.1.0.0",
"version": "18.0.1.0.0",
"depends": ["fleet"],
"data": [],
"installable": True,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,16 +7,19 @@
class FleetVehicleAssignationLog(models.Model):
_inherit = "fleet.vehicle.assignation.log"

@api.model
def create(self, vals):
res = super().create(vals)
history = self.search(
[
("vehicle_id", "=", res.vehicle_id.id),
("date_end", "=", False),
("id", "!=", res.id),
]
)
if history:
history.write({"date_end": res.date_start})
@api.model_create_multi
def create(self, vals_list):
res = super().create(vals_list)

for res_item in res:
history = self.search(
[
("vehicle_id", "=", res_item.vehicle_id.id),
("date_end", "=", False),
("id", "!=", res_item.id),
]
)
if history:
history.write({"date_end": res_item.date_start})

return res
1 change: 1 addition & 0 deletions fleet_vehicle_history_date_end/readme/CONTRIBUTORS.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,4 @@
- Manuel Marquez \<<manuel.marquez@druidoo.io>\>
- [Escodoo](https://www.escodoo.com.br):
- Marcel Savegnago \<<marcel.savegnago@escodoo.com.br>\>
- [Heliconia Solutions Pvt. Ltd.](https://www.heliconia.io)
Original file line number Diff line number Diff line change
Expand Up @@ -414,6 +414,7 @@ <h2><a class="toc-backref" href="#toc-entry-4">Contributors</a></h2>
<li>Marcel Savegnago &lt;<a class="reference external" href="mailto:marcel.savegnago&#64;escodoo.com.br">marcel.savegnago&#64;escodoo.com.br</a>&gt;</li>
</ul>
</li>
<li><a class="reference external" href="https://www.heliconia.io">Heliconia Solutions Pvt. Ltd.</a></li>
</ul>
</div>
<div class="section" id="maintainers">
Expand Down

0 comments on commit 8f36fd1

Please sign in to comment.