Skip to Content
Menu
This question has been flagged
5312 Views

I am working on Chap 8  of "Getting Started" (Titled "(Relations of Models)").

I have a One2many fields in a model named estate.estate as below:

offer_ids = fields.One2many('estate.property.offer', 'partner_id', string='Offers4')

In the co-model estate.property.offer I have a Many2one counterpart:

partner_id = fields.Many2one('res.partner', string='Property Offers', required=True)

In the form view of the model estate.estate, I have the following XML data



estate.estate.form
estate.estate

































I get the correct display, but in the field where the One2many field offer_ids supposed to work,

when I hit "Add a line", I got the following exception:

Traceback (most recent call last):
  File "/home/albert/src/odoo/odoo/http.py", line 639, in _handle_exception
    return super(JsonRequest, self)._handle_exception(exception)
  File "/home/albert/src/odoo/odoo/http.py", line 315, in _handle_exception
    raise exception.with_traceback(None) from new_cause
ValueError: Invalid field 'Title' on model 'res.partner'
Where the co-called invalid field is the first field declaration in my XML file. When I mark out

that line, then the error message will show the next field as invalid on model 'res.partner'.

I think I had some mistakes on XML description. But I cannot find out after searching

it for 5 hours.

Avatar
Discard

I also face same issue, after spending some time and re-reading related article I found the solution. The issue is with second parameter, it should be the "field-name in that model referring this record" i.e. instead of partner_id it should be property_id.

offer_ids = fields.One2many("estate.property.offer", "property_id", string="Offers")

Related Posts Replies Views Activity
2
Sep 22
7886
2
Apr 22
2448
1
Mar 21
3339
5
Aug 20
16276
2
Jun 20
6536