Display different field's value instead of 'name' field in of many2one - odoo-8

There are 3 country fields which are many2one. As per current behaviour, in 3 fields it is displaying country names. I just want to display short code of that country in one of that field. How can i do that?

Related

Kentico 12: change value of one page type field based on value of another field

I have a custom page type with two fields, StateName and StateCode. I would like it so that when a value is selected in either of these fields, the other field’s value changes to match.
So for example, if I select “Alabama” in the StateName field, the value of the StateCode field would automatically change to “AL.” Or if I select “CO” in the StateCode field, the StateName field would automatically change to “Colorado,” etc. Is this possible?
(I have to keep these as two separate fields, because I need to display either the state name or the state code on the front-end depending on context. Therefore, I can’t use a single field with options like AL;Alabama because then the field only returns the value AL and I have no way of getting the display name Alabama).
I know Kentico has options for setting “dependent” fields, but that only appears to determine visibility – e.g. only display Field B if I select a particular value in Field A. I can’t find a way to actually change the selected value in one field based on the selected value in another field.
Two control solution seems some kind of an overkill here. You can use StateInfoProvider to get what you want.
StateInfo state = StateInfoProvider.GetStateInfo("Alabama")
The other way would be to use a simple drop down control and use
query like that :
select stateCode + '|'+ StateDisplayName, StateDisplayName from cms_State
to get get code and display name as value separated by |

Create DropDowns that are based on which criteria are searched for

I am trying to allow the user to search on any of 4 criteria and have the rest of the 3 remaining field data validate based on the first search for selection.
I have four fields that I am trying to make dependent drop downs for the remaining 3 based on what you search for 1st. For example:
Scenario 1 - I search the data range validation for NAME and select a name in Cell L2.
I want the Phone, Email and Address to become dependent on the name was chosen (as there may be multiple records with the name of the person chosen).
I have accomplished this by using a secondary filter formula to filter address based on the name chosen and then applied data validation from the filter.
My problem is that I can't seem to figure out how to do the same thing if they pick the address first. Because my data validation is set on the filtered values and not the entire database. If they picked the address first, I want to validate based on ALL addresses and then filter-validate the NAME, PHONE and EMAIL.
I really just want them to be able to search whatever of the 4 criteria and then validate the other 3 on that result.
Any thoughts would help.
You can see my formula for filtering Addresses based on the Name selection in Cell S2 of the Customer Record Tab.
=if(L6="Address",filter('Sample Data'!$C:$C,'Sample Data'!$E:$E=L6),IF(L6="Phone",filter('Sample Data'!$C:$C,'Sample Data'!$D:$D=L3),IF(L6="Email",filter('Sample Data'!$C:$C,'Sample Data'!$J:$J=L4),L2)))
https://docs.google.com/spreadsheets/d/1E7adi88aEgvdV4ao8unbMHgZLEyu5CCRdTOjv8thjtc/edit#gid=1427488050
Select Name and only the Phones, Emails and Addresses for that selected name can be selected.
Select the Address and only the Names, Phones and Emails for that Address can be selected.
Same for Phone and for Email

Change a field property in SNOW

I'm trying to change a field's default property in SNOW. Here in incidents we've a field Assigned to and it accepts some default values. But instead of that I want it to accept any values (Integer, String, Special characters etc). In my SNOW Form lay out tried the below.
Created a new String field, Named it as Assigned to Label and name as assigned_to and saved it and it ended up as shown below.
and when I added some random text in this field, it gave me the below error.
please let me know on how can I change this field to accept any string as Input.
Thanks
You are referencing the sys_user table on the form field Assigned to. You need to provide the value for the Assigned to field the sys_id from the User record.
Providing it with any text will result in an invalid reference since it is looking for the unique sys_id on the user table.

MS Access table list order is defaulted in subform

I have a subform with a table, where some fields are restricted to tables. The tables are sorted in the correct order, but when it is used in the subform, it is set to default sorting. I can't find the location of the correct place to set the sorting criteria. I tried using query instead of a table, but i could only sort either by ascending or descending (or nothing). All three options resultet in undesired order. Example of the phase being sorted as default despite the table settings:
Suggestions?
As Gustav suggests, add another field to your t_Phase table, which will be the order you want this list to appear in the drop-down (make sure it is a number field):
Supply the numeric order:
In your other table, you can use the ID field from your t_Phase table by selecting it through the lookup wizard:
Move across the ID and the new "Order" field you just created:
Use the "Order" field as the field you want to use for sorting and make sure "Ascending" is selected:
Continue through the wizard:
Select the field that has the data you want to go in to the record of your table (I assume it's the ID field rather than the Order field, so make sure ID is selected):
Finish the lookup wizard and go in to Datasheet View on your table and check that the dropdown is now in numeric order. You've probably noticed a problem though as it is showing both the ID and the Order columns:
To hide the unnecessary Order column, go back in to Design View and click on your phase field to select it.
At the bottom should be a "Lookup" tab. Click on this and notice the Column Widths property... it's showing 2 different widths values; the first one is the ID field and the second one is the Order field. Set the Order field to 0cm to hide it. I'd then recommend setting the remaining Id field width to something that will be wide enough to show all your ID field's options. Then I'd set the List Width property to the same width.
8cm, for example:
This should result in something like the following, which is hopefully what you're after.
If you're not adding a lookup field to the design structure of a table, but are instead using a combo-box on a form or subform, the principle is pretty much the same; you'll just have to amend the combo-box properties from the form's Property Sheet "Format" tab instead:
Combo- and listboxes always contain text, thus your column is not sorted numeric.
To have a numeric sort, add a column with the number only and - in the source - sort only on that. If you don't the number separately, create it from this expression:
Val(Mid([PhaseField], 7))

Dojo Composite/Group validation

Given 2 text fields that (e.g. House Number, and House Name) on a form, and in order to be valid the user must enter a number or name in the appropriate field before the 'group' of 2 fields is considered valid.
A user could enter just a house number, or a house name, but entering a value in either field marks both of them valid.
Is there a way to do this in Dijit/Dojo? The idea of a composite or group of validation elements would be perfect.
Thanks,
dijit.form.Form has an isValid function that by default makes sure all of its children dijit.form widgets are valid. You can use stock dijit.form.ValidationTextBox widgets in combination with attributes like regexp and required, or descendants like NumberTextBox to specify validation rules.

Resources