CopyPastor

Detecting plagiarism made easy.

Score: 1; Reported for: String similarity Open both answers

Possible Plagiarism

Reposted on 2024-11-19
by CZoellner

Original Post

Original - Posted on 2022-08-08
by CZoellner



            
Present in both answers; Present only in the new answer; Present only in the old answer;

It's the `_inherit = "res.partner"`. Odoo is inheriting the model with a new model name which means it's creating a new table and copying all fields. For `channel_ids` it's trying to create the many2many "join" table, but with the same name as in `res.partner`. That happens because the table name is directly defined in [the field](https://github.com/odoo/odoo/blob/6c72297e72e0936e5564f175dcb1716057e0ac4b/addons/mail/models/res_partner.py#L24) (`mail_channel_partner`).
```python channel_ids = fields.Many2many('mail.channel', 'mail_channel_partner', 'partner_id', 'channel_id', string='Channels', copy=False) ```
So to solve the problem you have to "redefine" `channel_ids` on your new model again and change the table name, for example like:
```python channel_ids = fields.Many2many(relation='mail_channel_library_book_partner') ```
It's the `_inherit = "res.partner"`. Odoo is inheriting the model with a new model name which means it's creating a new table and copying all fields. For `channel_ids` it's trying to create the many2many "join" table, but with the same name as in `res.partner`. That happens because the table name is directly defined in [the field](https://github.com/odoo/odoo/blob/6c72297e72e0936e5564f175dcb1716057e0ac4b/addons/mail/models/res_partner.py#L24) (`mail_channel_partner`).
```python channel_ids = fields.Many2many('mail.channel', 'mail_channel_partner', 'partner_id', 'channel_id', string='Channels', copy=False) ```
So to solve the problem you have to "redefine" `channel_ids` on your new model again and change the table name, for example like:
```python channel_ids = fields.Many2many(relation='mail_channel_library_book_partner') ```

        
Present in both answers; Present only in the new answer; Present only in the old answer;