Odoo Help


Odoo v8: can't write into website field (model: res.partner)

on 4/1/15, 9:33 AM 992 views

I've created my own field company_origin. It is only visible if the partner (res.partner modell) is a company.

The field company_origin is a Many2one field, related to a modell origin which i added to res_partner.

My Problem is that i can't write values into the children of the company. For some fields it works (e.g. street) but for some it doesn't. (e.g. website). I also can not write the fields that i added to res.partner with my own model.

Here is some code that shows my problem, street changes but website doesnt (both are fields.Char() fields).

    def _set_children_origin(self):
        if self.child_ids != False:
            for child in self.child_ids:
                child.street = "teststreet"
                child.website = "testsite"

Thanks, for any advice.

Both fields are in the view xml?

on 4/1/15, 2:31 PM

Yes i can see both fields and they are defined in res.partner (view). I use _inherit=res.partner in my modell to add new elements. But those two fields both are untouched. I really would like to know why i can not write into child.website. Thanks for your reply.

on 4/1/15, 3:07 PM

Cyril Gaspard (GEM)

--Cyril Gaspard (GEM)--
Cyril Gaspard (GEM)
| 5 6 8
Paris, France
--Cyril Gaspard (GEM)--

Forum contributor since 2008

Cyril Gaspard (GEM)
On 4/1/15, 6:30 PM

see documentation (not tested) :


Many2many One2many Behavior

One2many and Many2many fields have some special behavior to be taken in account. At that time (this may change at release) using create on a multiple relation fields will not introspect to look for the relation.

self.line_ids.create({'name': 'Tho'}) # this will fail as order is not set

self.line_ids.create({'name': 'Tho', 'order_id': self.id}) # this will work

self.line_ids.write({'name': 'Tho'}) # this will write all related lines



| 6 4 7
Lodz, Poland

On 4/1/15, 3:37 PM

I previously poorly understood your construction. Now my answer:

  • @api.onchange scope is limited to the same screen / model

you define relation fields in your model, if it is necessary.

PS> line

if self.child_ids != False: 

is redundant

On 4/1/15, 3:03 PM

It is possibke to write, if I use self.env['res.partner'].browse(child.id).write({'website': "test"}) .

If someone knows why it doesnt work with child.website = ..., pls help out. Would be interesting to know how those operations are different and how they really work.

Your Answer

Please try to give a substantial answer. If you wanted to comment on the question or answer, just use the commenting tool. Please remember that you can always revise your answers - no need to answer the same question twice. Also, please don't forget to vote - it really helps to select the best questions and answers!

About This Community

This platform is for beginners and experts willing to share their Odoo knowledge. It's not a forum to discuss ideas, but a knowledge base of questions and their answers.


Odoo Training Center

Access to our E-learning platform and experience all Odoo Apps through learning videos, exercises and Quizz.

Test it now

Question tools

2 follower(s)


Asked: 4/1/15, 9:33 AM
Seen: 992 times
Last updated: 4/2/15, 6:05 PM