I need to make a 2 way binding between 2 records of 2 different models. the best way I found was using 2 Many2many fields:
https://odoo-development.readthedocs.io/en/latest/dev/py/fields.html#many2many
I tested it between a costume mode and product.prduct it worked prefectly. but when I tested between 2 costume models it didn't work. the tables are there but they are not connected in any way
<<< model 1 >>>
class License(models.Model):
_name="license.license"
_rec_name = "license_number"
license_number = fields.Char(string="License Number",required=True)
product_ids = fields.Many2many('license.product', "license_product_table_1" "license_to_table_col", "table_to_license_col")
<<< model 2 >>>
class LicenseProduct(models.Model):
_name="license.product"
# there a constrains function for the name field
name = fields.Char(string="Name", default="Draft", readonly=True)
license_ids = fields.Many2many("license.license", "license_product_table_1", "table_to_license_col", "license_to_table_col")
Thanks for any help in advance.