Skip to content
Snippets Groups Projects
Commit 77f616e9 authored by Nans Lefebvre's avatar Nans Lefebvre
Browse files

[FIX] ir_fields: import many2one_reference fields


Since a many2one_reference is simply an int, we can defer
_str_to_many2one_reference to _str_to_integer.

Note that to really validate the integer, we need the model_field of the
field, which should be stored in the record's values.
To get this information, _extract_records would have to be modified.

For the reported use-case, it does not matter as the create of the
message record checks for the existence of the related record,
so the validation works as expected.

Better support for this type of fields would be to allow for
import/export of xml_ids, which would avoid the need for the model.

opw 2087353

closes odoo/odoo#39591

Signed-off-by: default avatarXavier Morel (xmo) <xmo@odoo.com>
parent e3644c6b
No related branches found
No related tags found
No related merge requests found
......@@ -416,6 +416,10 @@ class IrFieldsConverter(models.AbstractModel):
id, _, w2 = self.db_id_for(model, field, subfield, record[subfield])
return id, w1 + w2
@api.model
def _str_to_many2one_reference(self, model, field, value):
return self._str_to_integer(model, field, value)
@api.model
def _str_to_many2many(self, model, field, value):
[record] = value
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment