[FIX] base_import: one product imported twice
Steps to reproduce: 1. Install stock 2. Go to Inventory > Products 3. Cog wheel > Import records 4. Make a xlsx document where: 5. the first sheet has at least 2400 records (with header) 6. the second sheet only one record (with header) 7. Upload the document 8. Select the second sheet 9. Set batch limit at 2000 10. Click on import 11. 2 records successfully imported Cause of the issue: When initially uploaded, this.state.fileLength is set to the length of the first sheet And isn't refreshed when changing sheet opw-3507544 closes odoo/odoo#139470 X-original-commit: 27f0a0253bc9b44854e5d6436d6e550429cdb93c Signed-off-by: Luca Vitali (luvi) <luvi@odoo.com> Signed-off-by: Antoine Demany (ande) <ande@odoo.com>
This commit is contained in:
@@ -103,7 +103,13 @@ export class ImportAction extends Component {
|
||||
|
||||
async onOptionChanged(name, value, fieldName = null) {
|
||||
this.model.block();
|
||||
await this.model.setOption(name, value, fieldName);
|
||||
const result = await this.model.setOption(name, value, fieldName);
|
||||
if (result) {
|
||||
const { res, error } = result;
|
||||
if (!error && res.file_length) {
|
||||
this.state.fileLength = res.file_length;
|
||||
}
|
||||
}
|
||||
this.model.unblock();
|
||||
}
|
||||
|
||||
|
||||
@@ -313,7 +313,7 @@ export class BaseImportModel {
|
||||
}
|
||||
this.importOptionsValues[optionName].value = value;
|
||||
if (this.importOptionsValues[optionName].reloadParse) {
|
||||
await this.updateData();
|
||||
return this.updateData();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user