Search Menu Location in odoo12 - python

In some forms, the search menu stays at the top. I need to see him always. How to do this?

that is Many2many view, the common list doesn't have that kind of structure, if you really need it, you can try to extend the basic search view in the main structure of Odoo.

Related

Wagtail large list within stream field block

We use wagtail for our blogs that are part of an eCommerce site. When we want to add a product to the blog as it stands we have to put the exact product name in which then matches on save. As names can change this then breaks that blog which isnt ideal.
What we would like to do is add a field to our streamfield block that lets you pick from our list of products, however as we have 200k+ products and there might be up to 20 products on each blog loading the list into a dropdown is no good. What we need is to replicate what we do in Django admin using django-autocomplete-light where you start typing and get results based on that rather than loading the list into the HTML.
What we cant work out is how to do that within a streamfield block, I have seen libraries like "Wagtail Autocomplete" however it seems you can only use that as a panel rather than within a block. As far as we can see you can only use sub-classes of wagtail.core.blocks or they dont show up in the interface.
Any ideas?
Thanks in advance!
You can extend the editor. Although the examples are mainly focussed on adding CSS style, it still should be possible. You can read more on this at the documentation: http://docs.wagtail.io/en/v2.8/advanced_topics/customisation/extending_draftail.html#
Another option would be is to use the Wagtail autocomplete panel for specifying the product you need to reference to, in a seperate field of course. Then, using a regular f-string replacement, place the proper product details in the text.

Add button next page - wizard - Odoo v8

I'm trying to create a wizard which has several pages.
I know how to pass to 'target' new or current, to pass the action to a form or tree view, but what I actually need, before that, is to create several steps which will be on different "views" of this wizard, like a form with 'next' and 'back' buttons.
Is there some example code I can look for that?
I've searched on default addons, with no success.
The best way to do this is to have a popup target=new and have a statusbar on top right which will be clickable/not readonly (so that the user can go back). And depending on the state of your record, show the appropriate fields
You can of course create a popup, and when the user clicks next destroy that popup and create another one but that doesn't seem like a good idea to me.

Option to add extra choices in django form

I am trying to create a model via a form that has multiple other models related to it. Say I have a model Publisher, then another model Article with a foreign key to Publisher. When creating a Publisher via a form, I want to create An article at the same time. I know how to do this via formsets. However, I don't know how to add a button that says add extra article at the same view, without having to be redirected to a new page and losing the old data since the form was not saved. What I want is when someone clicks add new article, for a new form for article to appear and for the user to add a new Article. Is this possible to be done in the same view in django, if so can someone give me and idea how to approach this?
I would show code or my attempts, but I am not sure how to even approach it.
This can only be done using JavaScript. The hard part is to have the management form sync up with the number of rows.
But there's two alternatives:
Semi-javascript (Mezzanine's approach): Generate a ton of rows in the formset and only show one empty. Upon the click of the "add another row" button, unhide the next one. This makes it easier to handle the management form as the unfilled extra's don't need any work.
No fix needed: Add as many rows as is humanly sane. In general, people don't need 40 rows, they get bored with filling out the form or worry that all that work is lost when the browser crashes.
Hope this helps you along. Good luck!

Is possible with django-autocomplete-ligth to browse relateds objects

I would like to browse related objects in addition to search . like in the raw_id_field widget in the admin.
Is it possible with django-autocomplete-light?
Thanks!
Not with DAL, but you can certainly implement such thing. The article is about populating an HTML select field with a JS popup, but you can just omit that part and populate a text input instead like raw_id_field, all the rest of the article is valid for your case.

Customizing admin-site: delete_selected

I'm working on recreating the admin site to match the theme of the current website and it's been fine up till now, but when I try to select multiple users and use the "delete selected users" action nothing happens.
I have a bit of code, so I have it pasted here
The button is called in admin/actions.html on line 4.
From reading the admin-site's source I was able to find the method delete_selected in admin/actions.py.I have only been copying and pasting tags from the original admin-site templates to fit my new ones with the site's style, so I can't figure out why the method isn't being passed.
Here's apicture of the finished page, where everything works except that Go button.
I feel like there might be a way to recreate a template tag to do it for me but I'm not sure what to call or how ?
The check boxes each have the object's ID as values but I'm not sure why it's not being passed to the 'go' button there.
Sorry, it was the simplest thing. I forgot to include the form surrounding the table. I hope this question will be helpful to anyone looking to customize the admin-site in the future.
Thanks!

Categories