I have a many2one field for which the selection of nothing (e.g. none, false, null) is a normal and valid state.
However the many2one widget in Odoo per default allows no empty selection. After a the record has been set, the user cannot unset the field with the normal widget.
Is there maybe some flag or Odoo feature that I can use to enable null selection?
As described in the comments, an empty value is selected when all text in the many2one widget is removed and one clicks outside.
So you can select from the drop down an item. When you remove part of the items name, it is still selected. When you remove all text in the field, the selection changes to empty. I was not aware of this because I am used to having an empty row at the top or bottom in the drop down that represents the null selection.
If you want to assign empty value for a Many2one field through code try this:
self._your_many2one_field = 0
And if you want to select blank in a Selection field try this:
self._your_selection_feild = False
Related
In oracle apex, if the value of Upload Status column is NEW, then the Edit Button icon should be disabled in Interactive Report.
I am aware that some dynamic action has to be added.
The name of my table is intg and it has a column named upload_status. If the value of it is NEW then I should not be able to edit that record.
From my point of view, the simplest option is to disable link column in Interactive Report's attributes and create your own link as part of the select statement. Something like this:
select case when upload_status <> 'NEW' then
'<img src="#IMAGE_PREFIX#ed-item.gif" border="0">'
end as link_icon,
id,
name,
whatever
from your_table;
As the link_icon column contains HTML tags, you'll have to set "Escape special characters" to "No" for this column (otherwise you'll actually see the tags instead of the icon).
Then, in column's properties, set its type to "Link". Edit "Link" section and set it to navigate to another page in this application (you know which one, and which parameters to pass).
That should do it.
I'm setting the control source of text fields to return the value of a function (multiple fields with different filtering conditions). The form has a combo box with a list of years: when the user selects a specific year, the on change event triggers a refresh of all the fields.
My problem is the fields don't show any values unless after combo box's On Change events. I have to click on the form/fields before the values start showing up.
I tried to do form refresh & field's requery but doesn't work.
The text field's Control Source is set to:
=SummaryReport("Projects","G","1",[Forms]![frmSUMMARY_REPORT]![cmbYEARS])
What I'm trying to do is when the user selects a year from a drop down, the fields values are updated & displayed by the On Change event - currently they seem to be updated but are not showing unless I click on the screen and that's when values start showing up in each field.
The method to update calculated fields is Me.Recalc (or myForm.Recalc):
https://learn.microsoft.com/en-us/office/vba/api/access.form.recalc
Try this instead of .Refresh.
Also I think the better event to use is After Update instead of On Change for a combo box.
I have defined an extended product view which uses a checkbox field to define that a product has certain attributes.
I would like that when user clicks on that checkbox a given value in Units of Measure dropdown field is automatically selected.
So, how do I select a value on a dropdown list when user clicks on a checkbox? (same view).
Thanks
It should be done by onchange method. You can define new boolean fields in that model and need to write onchange function for that.
#api.onchange('boolean_field1','boolean_field2')
def onchange_boolean(self):
if self.boolean_field:
self.product_uom_id = product_uom_record_id
else:
self.product_uom_id = product_uom_record_id
#Your custom code
Here,
product_uom_record_id : you need to search product uom record and set it there. Make sure you must assign ID not the object (browsable
record)
By this way you can call this function while onchange happen on this boolean field.
I have a selection field in openerp form
what I want is that when I select any value from this field , another field (which is hidden or invisible ) is shown automatically , based on the selected value.
I know that it is possible to show or hide a field checking or unchecking a boolean field in your view (e.g. needs_moreinfo).
<field name="moreinfo" attrs="{'invisible':['needs_moreinfo','=', false]}" />
I guess you could do the same, based on the IDs of the elements of your selection field. But it has to be hardcoded and you have to know in advance the ids in you DB...
I've a dijit.form.Combobox field which uses a ItemFileReadStore to pull Its data.
Teh ItemFileReadStore has two attribute per Item value which will be used for form submission , generally Unique Integers and label which is Human Understandable String.
In ComboBox HTML I've done searchAttr="value" labelAttr="label"
When the ComboBox Shows the list it uses teh label Attribute.
But When the User selects one of the Item it shows the value of that Item.
What I want is , The value Attribute will Still be used for Form Submission. But the User will always see the label in the combobox Control.
alt text http://img822.imageshack.us/img822/6660/dijitcombo.jpg
e.g. I Want to Show The Label for value 3 (Admin) instead of 3
Use FilteringSelect instead of Combobox.
Note: ComboBox only has a single value that matches what is displayed while FilteringSelect incorporates a hidden value that corresponds to the displayed value.
I have tried the following.
var cmbObject = Registry.byId('combo dojo id'); var id =
cmbObject.item.<Code Property>;
You should check if item is null.