Skip to content

[FIX] maintenance_equipment_sequence: convert create to api.model_create_multi#564

Open
miquelrosell99 wants to merge 2 commits into
OCA:17.0from
miquelrosell99:17.0-fix-maintenance-equipment-sequence-model-create-multi
Open

[FIX] maintenance_equipment_sequence: convert create to api.model_create_multi#564
miquelrosell99 wants to merge 2 commits into
OCA:17.0from
miquelrosell99:17.0-fix-maintenance-equipment-sequence-model-create-multi

Conversation

@miquelrosell99

Copy link
Copy Markdown

Converts MaintenanceEquipmentCategory.create() and MaintenanceEquipment.create() to batch-compatible api.model_create_multi for Odoo 17 best practice.

@OCA-git-bot

Copy link
Copy Markdown
Contributor

Hi @AdriaGForgeFlow,
some modules you are maintaining are being modified, check this out!

@OCA-git-bot OCA-git-bot added series:17.0 mod:maintenance_equipment_sequence Module maintenance_equipment_sequence labels May 20, 2026

@dalonsod dalonsod left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

See possible performance improvement comment

Comment thread maintenance_equipment_sequence/models/maintenance.py Outdated
Comment thread maintenance_equipment_sequence/models/maintenance.py Outdated
@miquelrosell99 miquelrosell99 force-pushed the 17.0-fix-maintenance-equipment-sequence-model-create-multi branch from 4135a30 to e786ec7 Compare May 21, 2026 06:15
…ate_multi

Converts MaintenanceEquipmentCategory.create() and
MaintenanceEquipment.create() to batch-compatible
api.model_create_multi for Odoo 17 best practice.

Browse calls are batched outside loops to avoid
repeated database queries when creating records in bulk.
@miquelrosell99 miquelrosell99 force-pushed the 17.0-fix-maintenance-equipment-sequence-model-create-multi branch from e786ec7 to 09eedbd Compare May 27, 2026 10:05
@miquelrosell99

Copy link
Copy Markdown
Author

Hi @dalonsod, thanks for the review.

The batching change you suggested is already in place in the current branch:

  • In MaintenanceEquipmentCategory.create, the ir.sequence records are browsed once and mapped by ID before looping over vals_list.
  • In MaintenanceEquipment.create, the maintenance.equipment.category records are browsed once and mapped to their sequence before looping over the created equipments.

I believe this addresses the performance concern. Could you please re-review when you have a moment?

@cgarcia-solvos cgarcia-solvos left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code review. LGTM

Comment thread maintenance_equipment_sequence/models/maintenance.py Outdated
Co-authored-by: Carlos García <carlos.garcia@solvos.es>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

mod:maintenance_equipment_sequence Module maintenance_equipment_sequence series:17.0

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants