Skip to content

Conversation

dhrp-odoo
Copy link
Contributor

@dhrp-odoo dhrp-odoo commented Jul 4, 2025

Description:

Steps to reproduce

  • Create a table with headers
  • Select some rows including the header row, but not the whole table
  • Try to move the selected rows

Current behavior

The move is allowed even when only part of the table (including headers) is selected.
This results in broken table structure or orphaned headers.

Desired behavior after PR is merged

Row moves are allowed only if:

  • The headers are not included in the selection, or
  • The entire table (including headers) is selected.

Task: 4862731

review checklist

  • feature is organized in plugin, or UI components
  • support of duplicate sheet (deep copy)
  • in model/core: ranges are Range object, and can be adapted (adaptRanges)
  • in model/UI: ranges are strings (to show the user)
  • undo-able commands (uses this.history.update)
  • multiuser-able commands (has inverse commands and transformations where needed)
  • new/updated/removed commands are documented
  • exportable in excel
  • translations (_t("qmsdf %s", abc))
  • unit tested
  • clean commented code
  • track breaking changes
  • doc is rebuild (npm run doc)
  • status is correct in Odoo

@robodoo
Copy link
Collaborator

robodoo commented Jul 4, 2025

Pull request status dashboard

Copy link
Contributor

@hokolomopo hokolomopo left a comment

Choose a reason for hiding this comment

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

👋

Please update the spec of the task in Odoo, without reading all the chatter it isn't clear that you're not doing point B 🙂

@dhrp-odoo dhrp-odoo force-pushed the 18.0-fix-table-move-columns-rows-dhrp branch from b0e7f83 to faa8eba Compare July 15, 2025 07:50
@dhrp-odoo dhrp-odoo force-pushed the 18.0-fix-table-move-columns-rows-dhrp branch 2 times, most recently from 9acf943 to 17cd172 Compare August 13, 2025 09:10
return CommandResult.Success;
}

private isMovingTableHeader(sheetId: UID, selectedRows: number[]): boolean {
Copy link
Collaborator

Choose a reason for hiding this comment

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

Suggested change
private isMovingTableHeader(sheetId: UID, selectedRows: number[]): boolean {
private isMovingTableHeader(sheetId: UID, movingRows: HeaderIndex[]): boolean {

return false;
}

const headerRowEnd = top + config.numberOfHeaders;
Copy link
Collaborator

Choose a reason for hiding this comment

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

Suggested change
const headerRowEnd = top + config.numberOfHeaders;
const headerRowEnd = top + config.numberOfHeaders - 1;

then check <=

return false;
}

const isTablePartiallySelected = range(top, bottom + 1).some((r) => !selectedRowSet.has(r));
Copy link
Collaborator

Choose a reason for hiding this comment

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

since the spec and commit message hint that we only allow the move either if:

  • we don't touch the headers
  • we move the whole table as a whole

i would consider writing the code to reflect this formulation and not the opposite (as it is now)o
i think it'd be clearer and easier to name the steps/variables

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I’ve updated the code to reflect that logic, please have a look :)

Steps to reproduce:
- Create a table with headers
- Select some rows including the header row, but not the whole table
- Try to move the selected rows

Before this commit:
Partial moves of rows including headers were allowed, which could break
the table structure or leave orphaned headers.

After this commit:
Row moves are allowed only if the headers are not included, or if the
entire table (including headers) is selected.

Task: 4862731
@dhrp-odoo dhrp-odoo force-pushed the 18.0-fix-table-move-columns-rows-dhrp branch from 17cd172 to b4aa672 Compare August 20, 2025 09:10
@rrahir
Copy link
Collaborator

rrahir commented Aug 20, 2025

Nice, thanks for the update :) I think it's clearer this way

robodoo r+

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants