This question has been flagged

class ProductTemplate(models.Model):

    _inherit = 'product.template'
    x_brand_name = fields.Char(string='Brand Name')
    x_est_location = fields.Char(string='EST Location')
    x_merchant_id = fields.Many2one('res.partner', string='Merchant Name')
    x_merchant_reference = fields.Char(string='Merchant Reference')
    current_location = fields.Char(string="Current Location", compute="_compute_current_location")
    lot_ids = fields.Many2one(string="lot", comodel_name='stock.production.lot', related="location_id.lot_id", store=True)

     def _compute_current_location(self): ...


 My goal is to add an attribute 'lot_ids' to this model, but this attribute is related to either 'stock.quant' or 'stock.production.lot'. I know that 'lot_id' is a Many2one field, but I'm not sure exactly how to implement this.

Can anyone guide me through this issue? Thanks in advance.

Avatar
Discard