Dear all,
I am doing a code review of some of our custom modules and found the following models which habe a many2One relation from both models.
Could you please explain me if this can be correct, and if so what logic behind this is? I assumed the models are linked with each other if I add a relation filed on one side.
class product_template(models.Model):
_inherit="product.template"
handling_group_id = fields.Many2one('handling.group', string='Handling Group')
class HandlingGroup(models.Model):
_name='handling.group'
_rec_name = 'handle_grp'
name = fields.Char(required=True)
product_id = fields.Many2one("product.product", string="Product ID")
Next I found was a relation on the one model as Many2Many and on the other as Many2One relation.
class product_template(models.Model):
_inherit="product.template"
branding_ids = fields.Many2many('branding.item', 'branding_item_rel', 'product_id', 'brand_id', string="Branding Items")
class BrandingPosition(models.Model):
_name = 'branding.position'
_description = 'Branding'
_order = "name"
product_id = fields.Many2one('product.product', string="SKU", required=True)
Hope you can explain to me what the sense of this is. And why I would implement it like this.
Thanks in advance!
You must learn odoo customization: https://plus.google.com/collection/MrdEWE