change value of field dynamically (OpenERP) - odoo

lets say I have a char field under osv.osv_memory
I generate a dynamic form (in "dialog" window) via the fields_view_get method containing this field.
During the generation of the dynamic form, how do I set the value of this field so that when the form is displayed it will contain this value (the value itself depends on the type of processing).
default_get works but only on initialization.
I can change attributes of the field such as readonly, string etc...
But the value itself need to be able to change.

If your osv.osv_memory object is opening from osv.osv, then first create a record of osv_memory object and try to open this record in the wizard. you will not need the default_get function now to load the data to the wizard

Related

Script to extract and assign values from a nested JS object

I presently have a nested JS object of the format:
var oNames = {
Adobe:{LastUpdate:'03/09/2022',Website:'adobe.com',UserID:'jdoe#gmail.com',PWD:'1234567',PrimaryCC:'',SecondaryCC:'',PrimaryBank:'',SecondaryBank:'',SQ1:'First girlfriend',SA1:'Denise',SQ2:'Grade school attended',SA2:'OLPH',Notes1:'',Notes2:''},
Amazon:{LastUpdate:'10/06/2020',Website:'amazon.com',UserID:'jdoe#gmail.com',PWD:'1234567',PrimaryCC:'Discover',SecondaryCC:'Capital One',PrimaryBank:'',SecondaryBank:'',SQ1:'',SA1:'',SQ2:'',SA2:'',Notes1:'',Notes2:''},
AmericanGiant:{LastUpdate:'01/25/2022',Website:'american-giant.com',UserID:'jdoe#gmail.com',PWD:'1234567',PrimaryCC:'',SecondaryCC:'',PrimaryBank:'',SecondaryBank:'',SQ1:'',SA1:'',SQ2:'',SA2:'',Notes1:'Best Hoodies Made in the USA',Notes2:''},
Asus:{LastUpdate:'11/05/2022',Website:'https://www.asus.com/us/',UserID:'jdoe#gmail.com',PWD:'1234567',PrimaryCC:'',SecondaryCC:'',PrimaryBank:'',SecondaryBank:'',SQ1:'',SA1:'',SQ2:'',SA2:'',Notes1:'Goto for MB & Laptop Computers',Notes2:''},
.
.
.
]
Can someone please provide me with a sample script that loops through the object above to obtain the values for the properties in the object above associated with each name using the variable, cName, that derives its value from a selection made by an end user from a drop-down box form field that resides on a PDF form. In short, the value provided by the variable 'cName' will be one to match any one of the name values in the object, i.e., Adobe, Amazon, AmericanGiant, Asus in which event the remaining fields residing on the PDF form will be populated with those property values associated with the name selected. Hope this explanation is clear. Unfortunately, I am not as familiar working with object pairs as I am with arrays and as such am stuck creating a script that works with a nested object as provided above. Thank you ahead of time.
for(j=0;j<15;j++){
f=getField("inf."+j);
cName = oVendors[event.value][j];
}
"inf."+j denotes 1 of 15 PDF form fields to be populated from the values in the object associated
with the name in the object equal to 'cName', the name selected in the combo box that resides on the PDF form.
Upon further study of the JS object and its methods, the following script is
required to extract names stored inside a JS data object in a hidden text field
used to populate a drop-down box on the PDF form as follows:
dsFld =getField("dataSrc");// call getField method used to obtain the stored
data value in the hidden text field that resides on the PDF form
oVendors = JSON.parse(dsFld.value);// parse the JSON string to convert to a JS
object to complete tasks to follow
f = getField("cbNames");// call the getField method to get the
drop-down combo box field or later use
aNames=new Array();// create the temp array
for(var key in oVendors){// script to populate the temp array from names
taken from/stored in oVendors data object
aNames.push(key);
}
aNames.sort();// sort the names alphabetically in the temp array
f.setItems(aNames);// assign names from the array to the drop-down
Combo Box field on the PDF form
f.insertItemAt("Add or lookup and select a name");// Insert text item at
the topmost item provided in the drop-down combo box list
dsFld.value=JSON.stringify(oVendors);// convert JS obj back to a JSON
string value stored in the hidden text field
Sorry for the initial ambiguous post and any inconvenience to the forum.

Method from a data bind (DevExpress Report)

I am creating a label report for bank check printing. I would like to know which component of the toolbox I can use to create a method (which I already have) to convert the numeric value to value in full.
Follow the design screen.
Report
I think you could place an XRLabel control onto the report for the text value and handle its BeforePrint event to invoke your method for converting the numeric value to text.

How to write correct field criteria to get rid of the 'enter parameter value' erro?

PICTURE OF QUERY :
I'm plotting graphs for 10 machines (machine 1, machine 2,...) performance -
average vs date graph.
User shall select the machine from a combobox (i made the values obtained from query, or should I make it from the table?) and set it to contain unique values only.
After selecting the machine, user shall click OK button. and a graph of the selected machine should be displayed in a new form.
Problem is, every time I click OK, it prompts me with the ENTER PARAMETER VALUE Forms!ViewReport!Combo9.
After I enter "machine 1" in the ENTER PARAMETER VALUE, it displays the graph correctly. I am expecting the graph to be displayed directly without the error.
The dialog appears because the query has no access to the field Combo9. Probably your form is not open or ViewReport is a subform, in this case, the reference to Combo9 should be different. Check, for instance, this giude for controls references.
But the most reliable method is to create a public function in the standard module, which should return the value from the desired form's field. It can check if the form is open and return the default value if the form is not available or the value is not selected. This function can be used in queries as criteria or in calculated fields.

How to get the value of a control that's bound to a binding source in VB?

I have a Dialog which has a ComboBox (aComboBox, say) with the following properties set:
DataSource linked to a BindingSource which is linked to an SQL table
DisplayMember linked to a column in that table which is of type String
Here is a pic of how the properties are set:
I want the String value of the item selected in the combo box but I am getting System.Data.DataRowViewwhen I use this code at run time:
aComboBox.SelectedItem.ToString()
How do I get the String value?
Do not use aComboBox.SelectedItem.ToString()
Instead of that Use : aComboBox.SelectedValue()
I managed to fix this by setting the Value Member attribute as shown in the following image, I am then able to retrieve the String value by calling aComboBox.SelectedValue.ToString() :
Note: Before, I only had the Display Member attribute set.

How to get dynamic created table's total column and row using Request.Form in vb.net

I am doing my project in Vb.net using MVC 4.0
I have created dynamic table and in that textboxes in td using javascript and now i want to get that table's total row and column as well for further process in Controller function.
How I can get using above using VB.net?
I have used Request.Form but the id of the textboxes in table is created uniquely so first I want to find the total column and row so based on that I can move further and check using for loop.
It seems like if you are generating your table through javascript you should also be able to set the value of a hidden field to the value you are outputting to your totals column. If you created a hidden field with the value set you should be able to access it from the Request collection. If it is not actually in a field that gets posted back you will only be able to access the value from the client-side.
document.getElementById("myInput").value = "Value you are outputting to your "total" cell
[Solved]
I got all the controls on code behind by it's name by using FormCollection just i need to do is post back the form using form action method because with using ajax i am not getting the formcollection in code behind but directly using form action method i can get all the controls name.
These are the textbox ids by which i can get the value just need to do further process like:
For Each _formvalues As String In formcol
formcol(_formvalues)
Next
fomcol is an object of FormCollection,_formvalues is used for moving one by one name coming in formcol and to take the data inside means name just write formcol(_formvalues) that's it.