Skip to Content
Меню
Чтобы взаимодействовать с сообществом, необходимо зарегистрироваться.
Этот вопрос был отмечен
1 Ответить
4157 Представления

I have two custom modules. In module A, I have a One2many relation to a model in module B, and in module B, I have a Many2one relation to the model in module A.

However, this creates a dependency issue, as both modules cannot depend on each other.

I tried adding module B as a dependency in module A __manifest__.py, and vice versa, but this doesn't work, and the modules don't install. 

Is there a way to do this?

Аватар
Отменить
Лучший ответ

Hi  Brandon Chetty,

Add B in A's  __manifest__.py.

inherit B's model and add  Many2one relation  in Module A  itself.


In Module A

class A(models.Model):
_name = "A.A"

name = fields.Char("Name")
b_lines = fields.One2many('B.B', 'a_id')

class B(models.Model):
_inherit = "B.B"

a_id = fields.Many2one('A.A')


Аватар
Отменить
Related Posts Ответы Просмотры Активность
2
дек. 23
6090
2
мая 22
1607
1
сент. 21
9905
1
апр. 23
2395
1
дек. 22
2531