I have a one2many tree field which contains many columns, every column uses a many2one field, the picture below shows two columns:
Is there a way to use a many2one field to get the values, let us say for the first column (prod1, prod2).
I am a beginner and do not know where to start from, any suggestions will be much appreciated!
P.S.: I am working with odoo v9
you can use this documentation form odoo:Odoo documentation
One2many field; the value of such a field is the recordset of all the records in comodel_name such that the field inverse_name is equal to the current record.
you can use these Parameters:
comodel_name -- name of the target model (string)
inverse_name -- name of the inverse Many2one field in comodel_name (string)
domain -- an optional domain to set on candidate values on the client side (domain or string)
context -- an optional context to use on the client side when handling that field (dictionary)
auto_join -- whether JOINs are generated upon search through that field (boolean, by default False)
limit -- optional limit to use upon read (integer)
if you need toĆ use domain like this:
field.One2many(comodel_name="model_name", inverse_name="inverse_field_name", string=None, domain=[('filed_name_in_comodel', 'operators', 'Value')])
Related
I would like to know how to copy a one2many field in odoo 14 .
Suppose i have a Model called "ModelA" with a one2many field ,which is related to a field stored in another model called "ModelB".
When i change a value of this one2many field in "ModelA", this change is passed on the "ModelB" field .
So i just want to copy the values of the one2many field in the "ModelA", so that changes will affect only the "modelA".
If possible i would like to keep the "one2many" type in the "modelA".
Thanks
I'm working for the first in a new app in odoo, and I have conditionals for several fields so I wanted to use a changing id with a many to one field, in other words my domain is where id=calculated_id which will be only one value, I tried to obtain a string of the name of the many to one field to try it to use it as the context but I retrieved a list of an object similar to [x_model_data(2,)] instead of the desired field value "test 2", I believe that the 2 of the parentheses relates to the calculated id=2
I have view for A model which contain following fields
Student_name field many2one
x_course_id field many2one
one2many field named 'b_ids' which refer B model.
b_ids is made as a tree in same view which contains following fields
some_field_name many2one
x_course_id field many2one
a_id field many2one which refer A model
Now, the problem is that the field some_field_name must be listed according to the value of course_id field which should be same as course_id field inAmodel.
I related field for course_id as
It is fetching value after saving that record, because of which my domain for some_field_name doesn't works
domain for some_field_name is written as [('x_course_id','=' x_course_id)]
But since this x_course_id on right hand side doesn't exist before saving the form, this domain doesn't works.
So, i wanted to know, is there a way by which i can get value of x_course_id in tree before saving the form.
Can any of the following fields be helpful in these case?? If yes, how?
I am new to openerp, In my customize module client_id,name other fields are showing only in Admin user of tree view but not showing in other Group user except Name field.
field
defines a column where the corresponding field should be displayed for each record. Can use the following attributes:
name:
the name of the field to display in the current model. A given name can only be used once per view
string:
the title of the field's column (by default, uses the string of the model's field)
invisible:
fetches and stores the field, but doesn't display the column in the table. Necessary for fields which shouldn't be displayed but are used by e.g. #colors
groups:
lists the groups which should be able to see the field
widget:
alternate representations for a field's display. Possible list view values are:
attrs:
dynamic attributes based on record values. Only effects the current field, so e.g. invisible will hide the field but leave the same field of other records visible, it will not hide the column itself.
I am creating a module(OpenERP 7.0) in which i have taken 2 fields both are many2many. First field is related with res.partner.category and second field is res.partner, what i have to do is-
after selecting categories in first field second field should get updated with partners of respected categories
thanks...
write an on change method on the first field which will search the partners related to selected categories and fill them in second field.