This question has been flagged
2177 Views

0

my model: school.partner.school

Here is the declaration of my field:

foyer_id = fields.Many2one(string="Foyer", comodel_name="horanet.relation.foyer")

Here is my function to show you what I want to extract when exporting data:

@api.onchange('school_statut')
def _get_import_id_foyer(self):
    if self.school_statut:
        record_ids = self.env["ir.model.data"].search([('res_id', '=', self.partner_id.foyer_relation_ids.foyer_id.id), ('module', '=', 'horanet_tpa_smartbambi')])
        for rec in record_ids:
            print "Import ID Foyer de " + str(self._origin.partner_id.name) + " est : " + rec.name

My problem :

I wish that during my export, the focus_id field exports the external identifier which is located on the name field of the table ir.model.data,

except that currently Odoo is exporting something like this: horanet_relation_foyer_5432.

Why ?

Example, for the partner_id (of the same model) which is declared like this:

partner_id = fields.Many2one(string="Child", comodel_name="res.partner")

I have no problem. It gets me the external ID and not res_partner_3501.

Why ?

Can you help me ?

Thank you


Avatar
Discard