Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Various fixes, mainly related to list column widths + editable readonly feature #37113

Closed
wants to merge 13 commits into from

Conversation

@aab-odoo
Copy link
Contributor

commented Sep 19, 2019

ClassNames 'oe_read_only' (resp. 'oe_edit_only') can be used in
x2many lists to hide columns in 'edit' (resp. 'readonly') modes.

However, before this rev., there were two issues:

  1. Having such a className on a tag didn't work well as
    the 'display: none' rule didn't apply on the body cell (it only
    applied on the button). Same could be observed on
    nodes.
  2. Having more than one invisible column (with those classNames)
    didn't work either, because the footer cells weren't hidden.
    We didn't notice it with one invisible column, because the
    footer contained one cell less than the header and the body.

Those two issues could be observed on the mrp.bom form view.

Task 2068261

Description of the issue/feature this PR addresses:

Current behavior before PR:

Desired behavior after PR is merged:

--
I confirm I have signed the CLA and read the PR guidelines at www.odoo.com/submit-pr

@robodoo robodoo added the seen 🙂 label Sep 19, 2019
@C3POdoo C3POdoo added the RD label Sep 19, 2019
@robodoo robodoo added CI 🤖 and removed CI 🤖 labels Sep 19, 2019
@aab-odoo

This comment has been minimized.

Copy link
Contributor Author

commented Sep 19, 2019

robodoo rebase-ff

@aab-odoo aab-odoo changed the title [FIX] web: correctly handle 'oe_read|edit_only' in lists Various fixes, mainly related to list column widths Sep 19, 2019
@robodoo

This comment has been minimized.

Copy link
Contributor

commented Sep 19, 2019

Merge method set to rebase and fast-forward

@aab-odoo aab-odoo force-pushed the odoo-dev:saas-12.5-list-fixes-aab branch 2 times, most recently from 8305017 to 0916f87 Sep 19, 2019
@robodoo robodoo added CI 🤖 and removed CI 🤖 labels Sep 19, 2019
@Arcasias Arcasias force-pushed the odoo-dev:saas-12.5-list-fixes-aab branch from 8790b6a to fb9327c Sep 20, 2019
@robodoo robodoo added the CI 🤖 label Sep 20, 2019
Copy link
Contributor Author

left a comment

The first two fixes deserve tests :-)

* is overflowing.
*
* @param {number} totalWidth
* @param {number} allowedWidth

This comment has been minimized.

Copy link
@aab-odoo

aab-odoo Sep 23, 2019

Author Contributor

@private

const thElements = [...thead.getElementsByTagName('th')];
const thWidths = thElements.map((th) => th.offsetWidth);
const allowedWidth = table.parentNode.offsetWidth;
const totalWidth = thElements.reduce((total, th) => total + th.offsetWidth, 0);

This comment has been minimized.

Copy link
@aab-odoo

aab-odoo Sep 23, 2019

Author Contributor

i'd do this in _trimLargestColumns

@@ -1264,6 +1259,43 @@ ListRenderer.include({
return $(th).outerWidth();
});
},
/**
* Set a maximum width on the largest columns in the list in case the table
* is overflowing.

This comment has been minimized.

Copy link
@aab-odoo

aab-odoo Sep 23, 2019

Author Contributor

I'd explain the whole idea of the algorithm here

this._trimLargestColumns(totalWidth, allowedWidth);
}

const thWidths = thElements.map(th => Number(th.style.maxWidth.split('px')[0]) || th.offsetWidth);

This comment has been minimized.

Copy link
@aab-odoo

aab-odoo Sep 23, 2019

Author Contributor

not a fan of the maxWidth.split stuff, maybe we should try to find another way (like storing the max widths we set in another structure)

@aab-odoo aab-odoo force-pushed the odoo-dev:saas-12.5-list-fixes-aab branch from fb9327c to 86074e8 Sep 23, 2019
@robodoo robodoo added CI 🤖 and removed CI 🤖 labels Sep 23, 2019
@aab-odoo aab-odoo force-pushed the odoo-dev:saas-12.5-list-fixes-aab branch from 86074e8 to 6158f3e Sep 23, 2019
@robodoo robodoo added CI 🤖 and removed CI 🤖 labels Sep 23, 2019
@aab-odoo aab-odoo force-pushed the odoo-dev:saas-12.5-list-fixes-aab branch from 6158f3e to 3316297 Sep 24, 2019
@robodoo robodoo removed the CI 🤖 label Sep 24, 2019
@aab-odoo aab-odoo force-pushed the odoo-dev:saas-12.5-list-fixes-aab branch 2 times, most recently from 1269180 to c3cc028 Sep 24, 2019
@aab-odoo aab-odoo changed the title Various fixes, mainly related to list column widths Various fixes, mainly related to list column widths + editable readonly feature Sep 24, 2019
@aab-odoo aab-odoo force-pushed the odoo-dev:saas-12.5-list-fixes-aab branch 3 times, most recently from c75b767 to 8b93004 Sep 24, 2019
@aab-odoo aab-odoo force-pushed the odoo-dev:saas-12.5-list-fixes-aab branch from 669ca94 to 1dc58c6 Sep 25, 2019
Arcasias and others added 5 commits Sep 16, 2019
Since the commit allowing all list views to be editable, there are some
views in which we need to ensure that certain fields are always readonly.

Affected modules:
- account
- crm
- product
- purchase
- sale

Task 1967602
Changed the information dipslayed by the confirmation modal in multi edition
in list views.

Before this commit, the modal simply showed a one-line message with the amount of valid records.

Now, there are 3 elements:
- If all of the fields cannot be changed, a first line warns the amount of valid records.
- A second (or first if all fields can be updated) line ensuring that the user is aware of
the occuring changes.
- A table displaying the affected field and the updated value (readonly widget with the new value).

Part of task 1967602
*:board,hr_skills

Hold on tight, this is a tricky one.

Allows *any* readonly list view (only plain lists, not x2manies) to
become partially editable when checking records.

This means that once checked, a record line acts just like it was
in an editable list. You can click on it, edit any of its values as long as
they're not constrained by readonly modifiers, and save them on the fly.

Clicking on an unchecked record will have the same effect as before:
it will open the record, regardless of the other selected records.

You can also check multiple records and edit them all at once by
changing the value of one selected record (just like standard multi edition).

Keyboard navigation is also allowed between selected records (TAB and SHIFT+TAB
to navigate and ENTER to save).

/!\ If a list is only made of records having all of their fields locked by
readonly modifiers, checking a record and clicking on it will do absolutely
nothing. This is to keep consistency with the rest of the specs.

Task 1967602
Setting 'overflow: hidden' on the (hidden) textarea used to compute
the (visible) textarea height ensures that there is no vertical
scrollbar, which would lead to a not so precise computation of the
height. The bug could be observed in sale.order form view, in the
order line x2many (description field), and had been introduced by
ef46378.
Go to Accounting > Accounting > General ledger. The view is grouped
by account. There is a layout issue as the first column (date) is
positionned after the group names, leaving a large blank space.
This is because the date field is considered as an aggregated field
(for sorting purpose, in python), but the JS can't (and we don't
want to) display it. This rev. ensures that such field types are
completely ignored by the JS, s.t. they do not impact the layout.
@aab-odoo aab-odoo force-pushed the odoo-dev:saas-12.5-list-fixes-aab branch from 1dc58c6 to 2bdc283 Sep 25, 2019
@robodoo robodoo added the CI 🤖 label Sep 25, 2019
@VincentSchippefilt

This comment has been minimized.

Copy link
Contributor

commented Sep 25, 2019

robodoo r+

@robodoo robodoo added the r+ 👌 label Sep 25, 2019
@robodoo

This comment has been minimized.

Copy link
Contributor

commented Sep 25, 2019

Linked pull request(s) odoo/enterprise#5745 not ready. Linked PRs are not staged until all of them are ready.

robodoo pushed a commit that referenced this pull request Sep 25, 2019
Go to Accounting > Accounting > General ledger. The view is grouped
by account. There is a layout issue as the first column (date) is
positionned after the group names, leaving a large blank space.
This is because the date field is considered as an aggregated field
(for sorting purpose, in python), but the JS can't (and we don't
want to) display it. This rev. ensures that such field types are
completely ignored by the JS, s.t. they do not impact the layout.

closes #37113

Signed-off-by: VincentSchippefilt <VincentSchippefilt@users.noreply.github.com>
@xmo-odoo

This comment has been minimized.

Copy link
Collaborator

commented Sep 25, 2019

@robodoo p=1

@robodoo robodoo added merged 🎉 and removed merging 👷 labels Sep 25, 2019
@robodoo

This comment has been minimized.

Copy link
Contributor

commented Sep 25, 2019

Merged at 1787ff0, thanks!

@robodoo

This comment has been minimized.

Copy link
Contributor

commented Sep 25, 2019

Unable to stage PR ({"message":"Merge conflict","documentation_url":"https://developer.github.com/v3/repos/merging/#perform-a-merge"})

@Arcasias

This comment has been minimized.

Copy link
Contributor

commented Oct 9, 2019

@jpp-odoo commit for textarea line return: 67cccb5

@jpp-odoo

This comment has been minimized.

Copy link
Contributor

commented Oct 9, 2019

@Arcasias Thanks!

@fw-bot fw-bot deleted the odoo-dev:saas-12.5-list-fixes-aab branch Oct 18, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
7 participants
You can’t perform that action at this time.