Skip to content

Conversation

lvsz
Copy link
Contributor

@lvsz lvsz commented Nov 21, 2024

Versions

  • 17.0+

Steps

  1. Create a pricelist with 200 price rules;
  2. export pricelist to xlsx;
  3. delete original pricelist;
  4. import pricelist, setting batch size to 100.

Test files ready for import:

Issue

Pricelist is imported with 400 price rules.

Cause

The back-end signals there's nothing left to import by having nextrow be falsy1. The front-end ignores this, and continues looping until it's taken as many steps as it initially planned.

The upfront totalSteps calculation is too high when an imported record has a number of nested relational records that's larger than the batch size.

Solution

If the ORM returns a falsy nextrow value, call stopImport.

opw-4164056

Footnotes

  1. see note on f583682

@robodoo
Copy link
Contributor

robodoo commented Nov 21, 2024

Pull request status dashboard

@C3POdoo C3POdoo added the OE the report is linked to a support ticket (opw-...) label Nov 21, 2024
@lvsz lvsz marked this pull request as ready for review November 21, 2024 16:36
@C3POdoo C3POdoo requested review from a team, xmo-odoo and rco-odoo and removed request for a team November 21, 2024 16:38
Copy link
Member

@rco-odoo rco-odoo left a comment

Choose a reason for hiding this comment

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

Looks consistent with the description of the issue.
But that's not in my area of expertise.

@rco-odoo rco-odoo requested review from kebeclibre and removed request for xmo-odoo December 3, 2024 15:32
@lvsz lvsz requested review from a team and aab-odoo and removed request for a team and aab-odoo December 4, 2024 12:56
@kebeclibre
Copy link
Contributor

@lvsz
Missing a test in JS
A test kinda exists in python (def test_batches), that kinda documents newtrow=0 case. Leading to commit (f583682), (that should be mentioned in this commit)

Not my area either I'm afraid

@lvsz lvsz force-pushed the 17.0-opw-4164056-stop_importing_when_everything_has_been_imported-sile branch from d388add to ec90d26 Compare January 14, 2025 14:31
Versions
--------
- 17.0+

Steps
-----
1. Create a pricelist with 200 price rules;
2. export pricelist to xlsx;
3. delete original pricelist;
4. import pricelist, setting batch size to 100.

Issue
-----
Pricelist is imported with 400 price rules.

Cause
-----
The back-end signals there's nothing left to import by having `nextrow`
be falsy[^1]. The front-end ignores this, and continues looping until
it's taken as many steps as it initially planned.

The upfront `totalSteps` calculation is too high when an imported
record has a number of nested relational records that's larger than
the batch size.

Solution
--------
If the ORM returns a falsy `nextrow` value, call `stopImport`.

opw-4164056

[^1]: see note on f583682
@lvsz lvsz force-pushed the 17.0-opw-4164056-stop_importing_when_everything_has_been_imported-sile branch from ec90d26 to 3c40553 Compare January 14, 2025 14:35
@lvsz lvsz requested a review from Iucapad January 14, 2025 14:37
@lvsz
Copy link
Contributor Author

lvsz commented Jan 14, 2025

Missing a test in JS

Done

@Iucapad I have a feeling you're the only one familiar with this part of the codebase

@Iucapad
Copy link
Contributor

Iucapad commented Jan 15, 2025

The fix seems good. Thank you

@Iucapad
Copy link
Contributor

Iucapad commented Jan 15, 2025

@robodoo r+

robodoo pushed a commit that referenced this pull request Jan 15, 2025
Versions
--------
- 17.0+

Steps
-----
1. Create a pricelist with 200 price rules;
2. export pricelist to xlsx;
3. delete original pricelist;
4. import pricelist, setting batch size to 100.

Issue
-----
Pricelist is imported with 400 price rules.

Cause
-----
The back-end signals there's nothing left to import by having `nextrow`
be falsy[^1]. The front-end ignores this, and continues looping until
it's taken as many steps as it initially planned.

The upfront `totalSteps` calculation is too high when an imported
record has a number of nested relational records that's larger than
the batch size.

Solution
--------
If the ORM returns a falsy `nextrow` value, call `stopImport`.

opw-4164056

[^1]: see note on f583682

closes #188092

Signed-off-by: Luca Vitali (luvi) <luvi@odoo.com>
@robodoo robodoo closed this Jan 15, 2025
BurkhalterY pushed a commit to Burkhalter-IT/odoo that referenced this pull request Jan 28, 2025
Versions
--------
- 17.0+

Steps
-----
1. Create a pricelist with 200 price rules;
2. export pricelist to xlsx;
3. delete original pricelist;
4. import pricelist, setting batch size to 100.

Issue
-----
Pricelist is imported with 400 price rules.

Cause
-----
The back-end signals there's nothing left to import by having `nextrow`
be falsy[^1]. The front-end ignores this, and continues looping until
it's taken as many steps as it initially planned.

The upfront `totalSteps` calculation is too high when an imported
record has a number of nested relational records that's larger than
the batch size.

Solution
--------
If the ORM returns a falsy `nextrow` value, call `stopImport`.

opw-4164056

[^1]: see note on f583682

closes odoo#188092

Signed-off-by: Luca Vitali (luvi) <luvi@odoo.com>
@fw-bot fw-bot deleted the 17.0-opw-4164056-stop_importing_when_everything_has_been_imported-sile branch January 29, 2025 13:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
OE the report is linked to a support ticket (opw-...)
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants