I am trying to change the displayed name Vendors in the Purchase application. I was successful in changing the submenu name from Settings--> Technical--> User interface(menu items). Now when i select this submenu the page that gets displayed has 'Vendors' displayed on the left top and in the filters. How do i change Vendors to some other name wherever it occurs.
I am using odoo 12
there are two methods,
the simplest is to change the name for each action view (form, tree). See the photos
the second, the same thing but by editing the xml of action code by inheriting the targeted view in order to modify it.
i hope that's can help you
Related
I searched in the last day for information about how to add a select/deselect all checkbox into my Django admin panel but I didn't find the solution.
I like to have these checkbox for all the columns not just for the first (in this case the user model). I like to manage all the objects with one checkbox click but it is also important to save the choice and if I come back to this site it should show the condition I saved before.
I attached an image about what I like to do.
I want to know if I can add more fields to the signup form if a user checks a box. For example, if the user checks the box that says he is a photographer one more field will appear in which he can specify what type of photography he does.
This is what DHTML is. You need to add an event on the checkbox which will dynamically add the INPUT element in the form. something like.
<input type="checkbox" onclick="addInput(this)" id="photography">
now in the method add a text element dynamically with dynamic id e.g.(value-photography) so that you can take an action on server side.
you need to make use of
document.appendChild()
You can use jQuery as well.
I'm working on a small project using Django and I have a detail page of a digital product. The user should have the avability to update the status of this product through 3 Buttons. This status represents one ChoiceField in the database. The choices are: Dismiss, In Review and Approve.
Clicking the button should submit the form directly.
My question is, what is the best way to solve that (without Ajax)?
My first idea was to add 3 forms and every form has another action url.
I'm still fairly new to Django and don't know if my approach is the best solution.
As described in this question and in the docs you should be able to get what you want with a RadioSelect form widget.
If you add a bit of CSS to hide the radio inputs themselves, and style the labels as buttons, you should be good!
Edit to include my comment below:
To get a single click submission, you could write some simple javascript that catches the onclick event on your buttons, and submits the form as you click.
I have a basic many to many relationship of:
Song to Playlist with PlaylistMember as the through model
Now I am displaying the songs in the playlist detail view using an inline View that is a subclass of TabularInline:
class PlaylistMemberInline(TabularInline):
model = PlaylistMember
raw_id_fields = ('Sound',)
class PlaylistAdmin(TranslatableAdmin):
...
inlines = [PlaylistMemberInline]
To add multiple sounds I have to click on "Add another Sound", and then find that sound on a popup. This is annoying in my case, as I can find all sounds I want to add, but then have to click one and go back to "Add another Sound".
Is there a widget where I can search for, select and then add multiple Objects?
Django source code (1.8 branch here, line 254) suggests that you can add your ForeignKey to radio_fields or raw_id_fields, resulting in a different widget.
In this case, add the field name "Sound" to PlaylistMemberInline.raw_id_fields,
consider adding it to PlaylistMemberInline.radio_fields.
(All code is some kind of pseudocode, just for better reading
I have an Invoice model:
class Invoice(models.Model):
// many fields here
I need to attach some products (with price for unit, and quantity fields) to this invoice, so I made additional table:
class InvoiceProduct(models.Model):
product = models.ForeignKey
quantity = models.IntegerField
unit_price = models.DecimalField
invoice = models.ForeignKey(Invoice)
So, this is almost first question — «Could it be done better way?»
My second problem is, that in django admin I have manage these models by inlines:
Screenshot
But my customer wants otherwise. He wants one button (Add product) then pop-up windows appears, with fields:
product, quantity, unit price. He fills them, press OK. Then pop-up window closes and line with "product fields" appears in main form.
I suppose I need override admin form template? Or I need to write my own widget or smth like that?
Sorry for my English.
My suggestion for your customer's request
He wants one button (Add product) then pop-up windows appears, with fields: product, quantity, unit price. He fills them, press OK.
Do NOT use the django admin for this. Only use it for people who want to access the data almost directly. In my head I see it just one half step up from the database itself. This means it is not suitable for users rather than administrators.
Or I need to write my own widget or smth like that?
Yes