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
Related
Lets say I have a One2Many field which is computed and not stored. Now I have a Boolean field which is computed and stored. The compute method of the Boolean field has the decorator api.depends('non_stored_field'). The non stored field would be the One2Many field in my case. Does the function still trigger when the One2Many field changes?
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')])
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 install the model product_custom_info who add specified field to product (Custom Properties)
And Now I would create a filter by this field ( It's one2many field)
i would recommend you to use many2many field instead and you can make it searchable like the way you do to other fields (char, many2one etc.)
hope it helps
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.