1

Hello to all Odoo Developers!

I am currently trying to migrate a addon from Odoo 13 to 15. My addon worked fine in Odoo 13 so I am trying to understand which changes were made in Odoo 15 to upgrade my module.

First error I got was the following:

Field selection_mobile_tablet referenced in related field definition devices.inuse.selection_mobile_tablet does not exist.

for the code:


devices_in_use_ids = fields.One2many(
        'devices.inuse', 'contacts_addon_class_id', string="Secure APPS Versions")


class DevicesInUse(models.Model):
    _name = 'devices.inuse'
    _rec_name = 'devices_in_use'

    contacts_addon_class_id = fields.Many2one(
        'res.partner', string="Contacts Class")

    devices_in_use = fields.Many2one(
        'device.setup', string="Devices In Use", tracking=1)
    selection_mobile_tablet = fields.Selection(
        related='devices_in_use.selection_mobile_tablet', string="Mobile / Tablet", tracking=1)

It seems that the Selection field is not working, has anyone made this experience in Odoo 15 and figured that out ?

Thanks.


UPDATE:

I commentend the above mentioned code out in the hope that It would take me any further but now I get an error which I understand even less.But maybe someone can help with that one:

psycopg2.errors.InvalidTableDefinition: column "id" is in a primary key

kayalotta
  • 53
  • 9

2 Answers2

1

Error message says that the related field "devices_in_use.selection_mobile_tablet", ie, the field named selection_mobile_tablet is not existing in the model "device.setup". Can you check and confirm whether the field is there ?

Odoo Mates
  • 11
  • 1
  • As it’s currently written, your answer is unclear. Please [edit] to add additional details that will help others understand how this addresses the question asked. You can find more information on how to write good answers [in the help center](/help/how-to-answer). – Community Dec 14 '21 at 12:54
  • Thanks for your answer. The device.setup class/model was in another module which I had not installed yet. After installing the module which contains the class device.setup the error "Field selection_mobile_tablet referenced in related field definition devices.inuse.selection_mobile_tablet does not exist." was gone. Now I am facing an sql related error : "psycopg2.errors.InvalidTableDefinition: column "id" is in a primary key". Does anyone have an opinion on that ? – kayalotta Dec 14 '21 at 13:01
0

As Odoo Mates said at begining you havea problem whith "devices_in_use.selection_mobile_tablet". As you said it's in another module not migrated. So I understand you have a dependency to the other module.

First things first. All migration should began with dependences you cannot migrate a module if his dependences aren't migrated.

Error you are facing now is caused by an misactualitzation of your module. Table (as there are some fields "disapered"/commented) is inconsistent. Which lines have you commented?

IMHO You should uncomment that code and begin migrating dependent module.

Ramil Aliyev 007
  • 4,437
  • 2
  • 31
  • 47
q.reb
  • 13
  • 5