Skip to content

[IMP] Add Most Recently Used Option to M20 Field. - #4

Closed
zakiuu wants to merge 40 commits into
9.0-mig2-web_m2x_options-zakfrom
9.0-web_m2x_options-mru-zak
Closed

[IMP] Add Most Recently Used Option to M20 Field.#4
zakiuu wants to merge 40 commits into
9.0-mig2-web_m2x_options-zakfrom
9.0-web_m2x_options-mru-zak

Conversation

@zakiuu

@zakiuu zakiuu commented Sep 14, 2016

Copy link
Copy Markdown

No description provided.

hbrunn and others added 26 commits September 9, 2016 16:30
[ADD] support 'no_open_edit' on many2one
[FIX] typos
Adapt JS file to the new JS API and make the module installable
[MIG] adapt form.js to the new API.
[FIX] Fix bug mentioned in pull OCA#262.
[MIG] Make the module installable.
Make the module installable and update the module version
[MIG] Make the module installable and update the version
[FIX] Add the render_value function for the FieldMany2ManyTags and change
selector from oe_tag to badge
[FIX] change selector in the base.xml from span.oe_tag to span.badge
…is set or not and improve search_more condition statement
queue.push(self.get_value(true));
}
restore_mru_list[key] = queue;
}

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

if it's already in the queue, then it should be removed and reinserted on top?

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

Nope it will stay in place, you referring that the most recurrent one
should be on top?
On Wed, Sep 14, 2016 at 5:32 PM Stéphane Bidoul (ACSONE) <
notifications@github.com> wrote:

In web_m2x_options/static/src/js/form.js
#4 (comment):

  •        var key = self.compute_mru_key();
    
  •        // check if the localstorage has some items for the current model
    
  •        if (localStorage.getItem(mru_option)) {
    
  •            var restore_mru_list = JSON.parse(localStorage.getItem(mru_option));
    
  •            if (restore_mru_list[key]) {
    
  •                var queue = restore_mru_list[key];
    
  •                if (queue.indexOf(self.get_value(true)) < 0 && self.get_value(true)){
    
  •                    if (queue.length < 5) {
    
  •                        queue.push(self.get_value(true));
    
  •                    }else {
    
  •                        queue.shift();
    
  •                        queue.push(self.get_value(true));
    
  •                    }
    
  •                    restore_mru_list[key] = queue;
    
  •                }
    

if it's already in the queue, then it should be removed and reinserted on
top?


You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub
https://github.com/acsone/web/pull/4/files/1ab5431bcf13c489922e34a1ea8c6f97bb38dcfc#r78785062,
or mute the thread
https://github.com/notifications/unsubscribe-auth/AANkfciG82hE6aWYUnO1n8ooTvYdF_ehks5qqCG1gaJpZM4J8-Ur
.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

he most recurrent one should be on top

Yes, otherwise your most frequently used one will drop off the list, ex with a size of 3

  • A -> [ A ]
  • B -> [ B, A ]
  • A -> [ B, A ]
  • C -> [ C, B, A ]
  • A -> [ C, B, A ]
  • D -> [ D, C, B ] and you've lost A even though you use it often

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

Yeah I,ll do

On Wed, Sep 14, 2016 at 5:45 PM Stéphane Bidoul (ACSONE) <
notifications@github.com> wrote:

In web_m2x_options/static/src/js/form.js
#4 (comment):

  •        var key = self.compute_mru_key();
    
  •        // check if the localstorage has some items for the current model
    
  •        if (localStorage.getItem(mru_option)) {
    
  •            var restore_mru_list = JSON.parse(localStorage.getItem(mru_option));
    
  •            if (restore_mru_list[key]) {
    
  •                var queue = restore_mru_list[key];
    
  •                if (queue.indexOf(self.get_value(true)) < 0 && self.get_value(true)){
    
  •                    if (queue.length < 5) {
    
  •                        queue.push(self.get_value(true));
    
  •                    }else {
    
  •                        queue.shift();
    
  •                        queue.push(self.get_value(true));
    
  •                    }
    
  •                    restore_mru_list[key] = queue;
    
  •                }
    

he most recurrent one should be on top

Yes, otherwise your most frequently used one will drop off the list, ex
with a size of 3

  • A -> [ A ]
  • B -> [ B, A ]
  • A -> [ B, A ]
  • C -> [ C, B, A ]
  • A -> [ C, B, A ]
  • D -> [ D, C, B ] and you've lost A even though you use it often


You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub
https://github.com/acsone/web/pull/4/files/1ab5431bcf13c489922e34a1ea8c6f97bb38dcfc#r78787414,
or mute the thread
https://github.com/notifications/unsubscribe-auth/AANkfdW_F88NTUYXC1ydsTvvmUZ56MNXks5qqCSXgaJpZM4J8-Ur
.

@zakiuu
zakiuu force-pushed the 9.0-web_m2x_options-mru-zak branch from d26a86e to e586cd8 Compare September 15, 2016 10:21
@zakiuu
zakiuu force-pushed the 9.0-web_m2x_options-mru-zak branch from e586cd8 to b65e90d Compare September 15, 2016 13:14

@sbidoul sbidoul left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Don't worry with translations, they will be managed with transifex when merged. Touch this now generates merge conflicts.

@sbidoul

sbidoul commented Sep 17, 2016

Copy link
Copy Markdown
Member

image

@zakiuu This looks suspicious.

@sbidoul

sbidoul commented Sep 17, 2016

Copy link
Copy Markdown
Member

@zakiuu when web_m2x_options is installed, the style of the "create and edit..." changes. This is suspicious too, can you look into it? I've not tested on community, I hope it's possible to have a solution that works both on community and enterprise.

When not installed:
image

When installed:
image

@sbidoul

sbidoul commented Sep 17, 2016

Copy link
Copy Markdown
Member

I've had this stack trace while doing this.

  1. open a supplier invoice, click edit then
    image
  2. In the supplier popup, clieck on the account drop down
    image

And also this in the console

image

@zakiuu

zakiuu commented Sep 18, 2016

Copy link
Copy Markdown
Author

@sbidoul for the "create and edit...", unfortunately, there is a difference in the CSS class between the enterprise and community edition (o_m2o_dropdown_option,oe_m2o_dropdown_option respectively).

@sbidoul

sbidoul commented Sep 19, 2016

Copy link
Copy Markdown
Member

@zakiuu would it work if you put both classes (o and oe)?

@zakiuu

zakiuu commented Sep 19, 2016

Copy link
Copy Markdown
Author

Yeah it does work, but shouldn't we add something specific to enterprise
edition in a community module?

On Mon, Sep 19, 2016 at 7:44 AM Stéphane Bidoul (ACSONE) <
notifications@github.com> wrote:

@zakiuu https://github.com/zakiuu would it work if you put both classes
(o and oe)?


You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
#4 (comment), or mute
the thread
https://github.com/notifications/unsubscribe-auth/AANkfah4YzVe7zQDMOHO_KT2gX3jKemuks5qri9RgaJpZM4J8-Ur
.

@sbidoul

sbidoul commented Sep 19, 2016

Copy link
Copy Markdown
Member

Using both oe and o classes is not shocking to me. Odoo always sais the web api must be compatible for community and enterprise, so if using both classes it what it takes to have that compatibility, that's fine with me.

Also the oe_ classes seem to be gone in v10 so it's just anticipating a bit.

@zakiuu

zakiuu commented Sep 19, 2016

Copy link
Copy Markdown
Author

Ok sounds good to me

On Mon, Sep 19, 2016 at 8:45 AM Stéphane Bidoul (ACSONE) <
notifications@github.com> wrote:

Using both oe and o classes is not shocking to me. Odoo always sais the
web api must be compatible for community and enterprise, so if using both
classes it what it takes to have that compatibility, that's fine with me.

Also the oe_ classes seem to be gone in v10 so it's just anticipating a
bit.


You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
#4 (comment), or mute
the thread
https://github.com/notifications/unsubscribe-auth/AANkfS2J4poWElqustXH8kjwcrokccwmks5qrj2rgaJpZM4J8-Ur
.

zakmak88 and others added 10 commits September 19, 2016 09:17
display most recently used record to the user when the search_mru is true.

[IMP] add compute_mru_key to compute the key of the field in the local storage
in the form: dbname/model/view_id | action_id/field_name
[IMP] add get_search_mru to search if there is a list of values stored in the
local storage using the key generate.
[IMP] add update_mru_list to update they list of mru saved in local storage
[IMP] Add mru behavior to the get_search_value
[IMP] add web_m2x_options.search_mru option to the OPTIONS list
… item in the top of the list and add some important comments
@zakiuu
zakiuu force-pushed the 9.0-web_m2x_options-mru-zak branch from 03ce849 to d40f3bc Compare September 19, 2016 08:29
@lmignon
lmignon force-pushed the 9.0-mig2-web_m2x_options-zak branch 2 times, most recently from a9128a6 to b2303e5 Compare October 27, 2016 20:19
@lmignon
lmignon force-pushed the 9.0-mig2-web_m2x_options-zak branch 2 times, most recently from 2ca4915 to 0789d8f Compare November 4, 2016 09:08
@lmignon

lmignon commented Nov 9, 2016

Copy link
Copy Markdown
Member

superseded by #6

@lmignon lmignon closed this Nov 9, 2016
ThomasBinsfeld pushed a commit that referenced this pull request Mar 16, 2017
[FIX] web_shortcut: QWeb render doesn't use string keys
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.

7 participants