How may i increase the size of "Selection Options " of selection filed - odoo

i am creating a list of value by selection fields and giving values for user select by selection option property . but when i am doing for three or four item . it is going to good . but when i want to add more items in selection option then i am unable to do this task . selection option property is not giving me more space for adding new value.
so please any one give me solution so i'll add more values .
and other problem is that i've created a button in form . but i want that whenever any user press this button , a another fields should be display . and when again user will click on this button , a 3rd fields should be display.
i've created this 3 fields namely one,two,there.
syntax:-
if click "my" button , a another fields "two" should be display .
thank you

If you have more values in "Selection" field then you should create a class for those selection values and make your selection filed many2one. In your xml file make your field as selection using widget="selection"
For example:
class ur_class(osv.osv):
_columns = {'ur_field_name': fields.many2one('select.type', 'Select')}
ur_class()
class select_type(osv.osv):
_name = 'select.type'
_columns = {'name': fields.char('Type', size=50)}
select_type()
Now in ur xml use widget='selection' like this:
<field name="ur_field_name" widget="selection"/>
Now about your 2nd question to show fields from button click:
If you are changing state in button's method then you can use "attrs" attribute in your xml. You can find examples in addons.
Thank You,

Related

My query, getting value from a textbox inside a subform, shows "small box"

The overall scenario: Actually trying to implement an order entry
system. A button on the main form opens 2nd form. In the 2nd form,
there are some combo-boxes and list-boxes from which the user selects
an item. Then pressing a button add that item with append query.
The problem is, as soon as I click anywhere in the 2nd (child) form;
the the id (autonumber) from parent vanishes(becomes null) for new
entry in the 2nd form. (I have lately discovered this vanishing by
using a text box to show current parent-id. Also found a solution,
posting as an answer)
I am trying to get two values from a textbox and a combo box. In the query datasheet view, i checked that, one value is received correctly but the other value it shows a very small box (putting picture below)
)
In this picture, "Expr2" field is showing small box. I used below statement to pull value from subform:
Expr2:[Forms]![customer_f]![products_add_subf].[Form]![customer_id]
And here is the code in sql-view:
INSERT INTO products_t ( product_name, customer_id )
SELECT [Forms]![customer_f]![products_add_subf].[Form]![item_combo] AS Expr1, [Forms]![customer_f]![products_add_subf].[Form]![customer_id] AS Expr2;
What this small box mean and how to avoid it ? How to pull correct value instead of small box ?
The solution will prevent vanishing of parent-id from first form(parent); in the 2nd form (child).
Just disable "Allow Addition" in the 2nd form's property.
Steps:
Open the 2nd form in "design view" . Double Click at the upper left corner of the form to open its property sheet. Goto "data" tab. In the "Allow Addition" select "no".
Now your append query will be able to grab the parent id field. It will not vanish !

MS Access - FIlter subform based off listbx

I am trying to filter a subform based off a value selected in a listbox.
My list box is called cboCurrentListName and this is populated using a select query
The subform is called Form_subform_ListContents
For the change event for the list box I have the following code, however no filters are applied when its executed.
Me.Form_subform_ListContents.Form.Filter = "[ListName]=" & Me.cboCurrentListName.Value
Me.Form_subform_ListContents.Form.Filter = True
I have also tried using Master/Child links to execute this using the following steps, but this caused an input box to pop up when the fom loaded:
first I set the 'link child fields' option in the properties of the subform to 'ListName' (this is the field name that populates the list box and is present in the subform
then I set the 'link master fields' option in the properties of the subform to 'cboCurrentListName' (the listbox name)
then in the listbox properties I set the control source to 'cboCurrentListName'
The above steps cased an input box to pop up on opening the form (the value typed in here does filter the subform). However I don't want an input box in order to do this, I want to use the listbox.
I have googled this and fried different methods but have had no luck. I am pretty new to access and of the control source sections aren't a strong point of mine, which is why I tried to use the VBA on the event change instead
Any help would be appricaited, I tried a few things and had no luck.
EDIT: When trying the master/hild option I also get an error 'Can'y build a link between unbound forms' if I click the 3 dots in the poperties. SO for the above steps I had to manually type in the otpions.

odoo button definition not working before setting value to a mandatory field

I have a button say 'calc_val' when I click on the button I had to pass values to a mandatory field.But my button definition is not working while the mandatory field is empty.Only if I put some values to the mandatory field and after when I click on the button , the button works.The whole thing is in a 'wizard'
Please help.Thanks in advance.
Because in odoo after clicking on any button create or write function called before executing the working function of your button and for create and write you have to fill mandatory fields thats why you have to fill mandatory fields before executing any button functionality.
Hello, vbt
You have to set some default value in that specific field.
After set default value, you can use that button behavior.
And if you want to change that value, they can change also.
May Help this answer.
Thank you.
I have done this by removing the mandatory field and then adding a validation while clicking on the final button in the wizard (For not keeping the mandatory field empty).
If any other answers are available,feel free to post.Thanks

Add a field value to text box

I have an Access Table named Count. It has one field named Anz and it has only 1 record. I want to Show this record in a TextBox on a form named overview. So in the design mode of the form inside the TextBox I use the code
[Count]![Anz]
but it Returns me #Name? error when I Switch back to form mode. Where am I going wrong?
You can use in Control Source of your unbound text box =Dlookup("[Anz]","[Count]")
Also you can bound your form to Count table and use for text box control source Anz

show/hide fields based on selection in openerp 7

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...