跳至内容
菜单
此问题已终结

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.

形象
丢弃
相关帖文 回复 查看 活动
1
5月 23
2196
1
10月 22
2908
2
4月 23
6192
2
9月 21
3125
3
12月 19
5782