Перейти к содержимому
Меню
Чтобы взаимодействовать с сообществом, необходимо зарегистрироваться.
Этот вопрос был отмечен
2 Ответы
7008 Представления

I created a Many2many field from my custom module and I wanted this field to display from another model but the fields inside from the other models is not the same values with my custom module.  Images are here: https://jpst.it/2oHf2

 

custom.py

class CustomInherit(models.Model):
    _inherit = "custom"
    po_references = fields.Many2many("sale.order", "pdc_acc_payment_rel", "pdc_id", "pay_id", string="SI Number(s)")

 


account_payment.py
class account_payment(models.Model):
    _inherit = "account.payment"
    
    si_numbers = fields.Many2many("custom", "pdc_acc_payment_rel", "pay_id", "pdc_id", string="SI Number(s)")

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

Hi,
To display a many2many field from another model, follow the steps

custom.py

class CustomInherit(models.Model):
_inherit = "custom"
po_references = fields.Many2many("sale.order", string="SI Number(s)")

account_payment.py

class account_payment(models.Model):
_inherit = "account.payment"
si_numbers = fields.Many2many("custom", string="SI Number(s)")

Regards

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

Hi,

Upon seeing the code, that you have added, seems you are confused with the working of the many2many field in Odoo. From the code it seems, you have a many2many field in the model account.payment and in the custom model, and both seems to be referring to separate models.


Can you have a look at this video to get more idea about how the Many2many in odoo is working: Working of Many2many fields in Odoo


Thanks

Аватар
Отменить
Related Posts Ответы Просмотры Активность
1
февр. 24
1691
0
июл. 24
2617
0
июл. 22
60
1
июл. 22
2568
2
дек. 23
33142